]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: rkvdec: Ensure decoded resolution fit coded resolution
authorJonas Karlman <jonas@kwiboo.se>
Fri, 13 May 2022 20:29:16 +0000 (22:29 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Tue, 17 May 2022 08:07:08 +0000 (10:07 +0200)
Ensure decoded CAPTURE buffer resolution is larger or equal to the coded
OUTPUT buffer resolution.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/rkvdec/rkvdec.c

index e3d44d5b35f361b91cf01c77dd61d083d6686b00..2bc4b1a409895d8f410e7f6ec91bf002985beda5 100644 (file)
@@ -257,6 +257,8 @@ static int rkvdec_try_capture_fmt(struct file *file, void *priv,
                pix_mp->pixelformat = coded_desc->decoded_fmts[0];
 
        /* Always apply the frmsize constraint of the coded end. */
+       pix_mp->width = max(pix_mp->width, ctx->coded_fmt.fmt.pix_mp.width);
+       pix_mp->height = max(pix_mp->height, ctx->coded_fmt.fmt.pix_mp.height);
        v4l2_apply_frmsize_constraints(&pix_mp->width,
                                       &pix_mp->height,
                                       &coded_desc->frmsize);