Re: [PATCH v2 2/3] media: verisilicon: reject MPEG-1 controls
From: Nicolas Dufresne
Date: Mon Nov 23 2026 - 17:26:32 EST
Le samedi 21 novembre 2026 à 10:10 +0000, Arun Iyengar via B4 Relay a écrit :
> From: Arun Iyengar <aiyengar1990@xxxxxxxxx>
>
> 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@xxxxxxxxx>
> ---
> 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,
Attachment:
signature.asc
Description: This is a digitally signed message part