LinuxTV Patchwork [10/10] media: coda: require all decoder command flags to be cleared

login
register
mail settings
Submitter Philipp Zabel
Date April 8, 2019, 12:32 p.m.
Message ID <20190408123256.22868-10-p.zabel@pengutronix.de>
Download mbox | patch
Permalink /patch/55536/
State New
Delegated to: Hans Verkuil
Headers show

Comments

Philipp Zabel - April 8, 2019, 12:32 p.m.
The memory-to-memory stateful video decoder interface documentation
requires the decoder stop command initiating the drain sequence to have
flags set to zero.
Stop to black makes no sense as stopped memory-to-memory decoders do not
produce any frames, and stopping immediately can be achieved by stopping
the output video queue with VIDIOC_STREAMOFF.

The mute audio start command flag serves no purpose as the coda driver
does not handle any audio formats, and does not support playback at
non-standard speeds.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/media/platform/coda/coda-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Philipp Zabel - April 9, 2019, 4:57 p.m.
On Mon, 2019-04-08 at 14:32 +0200, Philipp Zabel wrote:
> The memory-to-memory stateful video decoder interface documentation
> requires the decoder stop command initiating the drain sequence to have
> flags set to zero.
> Stop to black makes no sense as stopped memory-to-memory decoders do not
> produce any frames, and stopping immediately can be achieved by stopping
> the output video queue with VIDIOC_STREAMOFF.
> 
> The mute audio start command flag serves no purpose as the coda driver
> does not handle any audio formats, and does not support playback at
> non-standard speeds.
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/media/platform/coda/coda-common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
> index 318f0be103bb..96798f98734a 100644
> --- a/drivers/media/platform/coda/coda-common.c
> +++ b/drivers/media/platform/coda/coda-common.c
> @@ -1050,10 +1050,10 @@ static int coda_try_decoder_cmd(struct file *file, void *fh,
>  	if (dc->cmd != V4L2_DEC_CMD_STOP)
>  		return -EINVAL;
>  
> -	if (dc->flags & V4L2_DEC_CMD_STOP_TO_BLACK)
> +	if (dc->stop.pts != 0)
>  		return -EINVAL;
>  
> -	if (!(dc->flags & V4L2_DEC_CMD_STOP_IMMEDIATELY) && (dc->stop.pts != 0))
> +	if (dc->flags != 0)
>  		return -EINVAL;

This change currently causes a v4l2-compliance failure

                fail: v4l2-test-codecs.cpp(104): ret != 0
        test VIDIOC_(TRY_)DECODER_CMD: FAIL

because it still expects V4L2_DEC_CMD_STOP_IMMEDIATELY to be supported.

regards
Philipp
Hans Verkuil - April 10, 2019, 1:53 p.m.
On 4/9/19 6:57 PM, Philipp Zabel wrote:
> On Mon, 2019-04-08 at 14:32 +0200, Philipp Zabel wrote:
>> The memory-to-memory stateful video decoder interface documentation
>> requires the decoder stop command initiating the drain sequence to have
>> flags set to zero.
>> Stop to black makes no sense as stopped memory-to-memory decoders do not
>> produce any frames, and stopping immediately can be achieved by stopping
>> the output video queue with VIDIOC_STREAMOFF.
>>
>> The mute audio start command flag serves no purpose as the coda driver
>> does not handle any audio formats, and does not support playback at
>> non-standard speeds.
>>
>> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
>> ---
>>  drivers/media/platform/coda/coda-common.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
>> index 318f0be103bb..96798f98734a 100644
>> --- a/drivers/media/platform/coda/coda-common.c
>> +++ b/drivers/media/platform/coda/coda-common.c
>> @@ -1050,10 +1050,10 @@ static int coda_try_decoder_cmd(struct file *file, void *fh,
>>  	if (dc->cmd != V4L2_DEC_CMD_STOP)
>>  		return -EINVAL;
>>  
>> -	if (dc->flags & V4L2_DEC_CMD_STOP_TO_BLACK)
>> +	if (dc->stop.pts != 0)
>>  		return -EINVAL;
>>  
>> -	if (!(dc->flags & V4L2_DEC_CMD_STOP_IMMEDIATELY) && (dc->stop.pts != 0))
>> +	if (dc->flags != 0)
>>  		return -EINVAL;
> 
> This change currently causes a v4l2-compliance failure
> 
>                 fail: v4l2-test-codecs.cpp(104): ret != 0
>         test VIDIOC_(TRY_)DECODER_CMD: FAIL
> 
> because it still expects V4L2_DEC_CMD_STOP_IMMEDIATELY to be supported.

I've fixed this in my v4l-utils work-in-progress branch:

https://git.linuxtv.org/hverkuil/v4l-utils.git/log/?h=vicodec

But I want to hold off on this patch a little bit.

I think we need to add helpers for the try_en/decoder_cmd ioctls
to v4l2-mem2mem.c since it will be the same for all codecs.

I also had to fix vicodec since the checks it did weren't complete:

https://git.linuxtv.org/hverkuil/media_tree.git/commit/?h=vicodec&id=4e95bff9a15b63179fab20ac2113c238dc20665b

Regards,

	Hans

Patch

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 318f0be103bb..96798f98734a 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1050,10 +1050,10 @@  static int coda_try_decoder_cmd(struct file *file, void *fh,
 	if (dc->cmd != V4L2_DEC_CMD_STOP)
 		return -EINVAL;
 
-	if (dc->flags & V4L2_DEC_CMD_STOP_TO_BLACK)
+	if (dc->stop.pts != 0)
 		return -EINVAL;
 
-	if (!(dc->flags & V4L2_DEC_CMD_STOP_IMMEDIATELY) && (dc->stop.pts != 0))
+	if (dc->flags != 0)
 		return -EINVAL;
 
 	return 0;

Privacy Policy