[PATCH v2 2/3] media: verisilicon: reject MPEG-1 controls

Nicolas Dufresne nicolas.dufresne at collabora.com
Mon Nov 23 14:26:23 PST 2026


Le samedi 21 novembre 2026 à 10:10 +0000, Arun Iyengar via B4 Relay a écrit :
> From: Arun Iyengar <aiyengar1990 at gmail.com>
> 
> The driver decodes everything in MPEG-2 mode. Reject
> V4L2_MPEG2_SEQ_FLAG_MPEG1, the full pel flags and D-pictures, which it
> would otherwise decode as MPEG-2. Compile tested only.

That change flags the the API is not backward compatible. Please fix.

Nicolas

> 
> Signed-off-by: Arun Iyengar <aiyengar1990 at gmail.com>
> ---
>  drivers/media/platform/verisilicon/hantro_drv.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
> index 26e5d5547466..c910a69e8e3c 100644
> --- a/drivers/media/platform/verisilicon/hantro_drv.c
> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
> @@ -264,6 +264,16 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
>  		if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2)
>  			/* Only 8-bit and 10-bit are supported */
>  			return -EINVAL;
> +	} else if (ctrl->id == V4L2_CID_STATELESS_MPEG2_SEQUENCE) {
> +		if (ctrl->p_new.p_mpeg2_sequence->flags & V4L2_MPEG2_SEQ_FLAG_MPEG1)
> +			return -EINVAL;
> +	} else if (ctrl->id == V4L2_CID_STATELESS_MPEG2_PICTURE) {
> +		const struct v4l2_ctrl_mpeg2_picture *pic = ctrl->p_new.p_mpeg2_picture;
> +
> +		if (pic->picture_coding_type == V4L2_MPEG2_PIC_CODING_TYPE_D ||
> +		    pic->flags & (V4L2_MPEG2_PIC_FLAG_FULL_PEL_FORWARD |
> +				  V4L2_MPEG2_PIC_FLAG_FULL_PEL_BACKWARD))
> +			return -EINVAL;
>  	} else if (ctrl->id == V4L2_CID_STATELESS_VP9_FRAME) {
>  		const struct v4l2_ctrl_vp9_frame *dec_params = ctrl->p_new.p_vp9_frame;
>  
> @@ -435,11 +445,13 @@ static const struct hantro_ctrl controls[] = {
>  		.codec = HANTRO_MPEG2_DECODER,
>  		.cfg = {
>  			.id = V4L2_CID_STATELESS_MPEG2_SEQUENCE,
> +			.ops = &hantro_ctrl_ops,
>  		},
>  	}, {
>  		.codec = HANTRO_MPEG2_DECODER,
>  		.cfg = {
>  			.id = V4L2_CID_STATELESS_MPEG2_PICTURE,
> +			.ops = &hantro_ctrl_ops,
>  		},
>  	}, {
>  		.codec = HANTRO_MPEG2_DECODER,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-rockchip/attachments/20261123/9060c722/attachment.sig>


More information about the Linux-rockchip mailing list