diff mbox series

media: coda: don't overwrite h.264 profile_idc on decoder instance

Message ID 20180801141804.19684-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series media: coda: don't overwrite h.264 profile_idc on decoder instance | expand

Commit Message

Lucas Stach Aug. 1, 2018, 2:18 p.m. UTC
On a decoder instance, after the profile has been parsed from the stream
__v4l2_ctrl_s_ctrl() is called to notify userspace about changes in the
read-only profile control. This ends up calling back into the CODA driver
where a mssing check on the s_ctrl caused the profile information that has
just been parsed from the stream to be overwritten with the default
baseline profile.

Later on the driver fails to enable frame reordering, based on the wrong
profile information.

Fixes: 347de126d1da (media: coda: add read-only h.264 decoder
                     profile/level controls)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/media/platform/coda/coda-common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Philipp Zabel Aug. 1, 2018, 2:26 p.m. UTC | #1
On Wed, 2018-08-01 at 16:18 +0200, Lucas Stach wrote:
> On a decoder instance, after the profile has been parsed from the stream
> __v4l2_ctrl_s_ctrl() is called to notify userspace about changes in the
> read-only profile control. This ends up calling back into the CODA driver
> where a mssing check on the s_ctrl caused the profile information that has
> just been parsed from the stream to be overwritten with the default
> baseline profile.
> 
> Later on the driver fails to enable frame reordering, based on the wrong
> profile information.
> 
> Fixes: 347de126d1da (media: coda: add read-only h.264 decoder
>                      profile/level controls)
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

> ---
>  drivers/media/platform/coda/coda-common.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
> index c7631e117dd3..1ae15d4ec5ed 100644
> --- a/drivers/media/platform/coda/coda-common.c
> +++ b/drivers/media/platform/coda/coda-common.c
> @@ -1719,7 +1719,8 @@ static int coda_s_ctrl(struct v4l2_ctrl *ctrl)
>  		break;
>  	case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
>  		/* TODO: switch between baseline and constrained baseline */
> -		ctx->params.h264_profile_idc = 66;
> +		if (ctx->inst_type == CODA_INST_ENCODER)
> +			ctx->params.h264_profile_idc = 66;
>  		break;
>  	case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
>  		/* nothing to do, this is set by the encoder */

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index c7631e117dd3..1ae15d4ec5ed 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1719,7 +1719,8 @@  static int coda_s_ctrl(struct v4l2_ctrl *ctrl)
 		break;
 	case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
 		/* TODO: switch between baseline and constrained baseline */
-		ctx->params.h264_profile_idc = 66;
+		if (ctx->inst_type == CODA_INST_ENCODER)
+			ctx->params.h264_profile_idc = 66;
 		break;
 	case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
 		/* nothing to do, this is set by the encoder */