]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: rkvdec: Fix frame size enumeration
authorJonas Karlman <jonas@kwiboo.se>
Tue, 25 Feb 2025 09:40:33 +0000 (10:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:07:08 +0000 (11:07 +0100)
[ Upstream commit f270005b99fa19fee9a6b4006e8dee37c10f1944 ]

The VIDIOC_ENUM_FRAMESIZES ioctl should return all frame sizes (i.e.
width and height in pixels) that the device supports for the given pixel
format.

It doesn't make a lot of sense to return the frame-sizes in a stepwise
manner, which is used to enforce hardware alignments requirements for
CAPTURE buffers, for coded formats.

Instead, applications should receive an indication, about the maximum
supported frame size for that hardware decoder, via a continuous
frame-size enumeration.

Fixes: cd33c830448b ("media: rkvdec: Add the rkvdec driver")
Suggested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/media/rkvdec/rkvdec.c

index d16cf4115d03a5832a3b0c4560cc4198573f6cfa..b5847259f45415a0cc44f65abf75ac3a33a6bab5 100644 (file)
@@ -213,8 +213,14 @@ static int rkvdec_enum_framesizes(struct file *file, void *priv,
        if (!fmt)
                return -EINVAL;
 
-       fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
-       fsize->stepwise = fmt->frmsize;
+       fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
+       fsize->stepwise.min_width = 1;
+       fsize->stepwise.max_width = fmt->frmsize.max_width;
+       fsize->stepwise.step_width = 1;
+       fsize->stepwise.min_height = 1;
+       fsize->stepwise.max_height = fmt->frmsize.max_height;
+       fsize->stepwise.step_height = 1;
+
        return 0;
 }