diff mbox series

[v6,11/11] media: rkvdec: Fix enumerate frame sizes

Message ID 20240909192522.1076704-12-jonas@kwiboo.se (mailing list archive)
State New
Headers show
Series media: rkvdec: Add H.264 High 10 and 4:2:2 profile support | expand

Commit Message

Jonas Karlman Sept. 9, 2024, 7:25 p.m. UTC
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.

For coded format returning the frame size used to enforce HW alignment
requirements for CAPTURE buffers does not make fully sense.

Instead, signal applications what the maximum frame size that is
supported by the HW decoder using a frame size of continuous type.

Fixes: cd33c830448b ("media: rkvdec: Add the rkvdec driver")
Suggested-by: Alex Bee <knaerzche@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
v6:
- New patch

With this change FFmpeg V4L2 Request API hwaccels can implement a strict
check if frame size is supported by the video device:
https://ffmpeg.org/pipermail/ffmpeg-devel/2024-August/332037.html
---
 drivers/staging/media/rkvdec/rkvdec.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Nicolas Dufresne Oct. 25, 2024, 5:46 p.m. UTC | #1
Le lundi 09 septembre 2024 à 19:25 +0000, Jonas Karlman a écrit :
> 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.
> 
> For coded format returning the frame size used to enforce HW alignment
> requirements for CAPTURE buffers does not make fully sense.
> 
> Instead, signal applications what the maximum frame size that is
> supported by the HW decoder using a frame size of continuous type.
> 
> 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>

> ---
> v6:
> - New patch
> 
> With this change FFmpeg V4L2 Request API hwaccels can implement a strict
> check if frame size is supported by the video device:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2024-August/332037.html
> ---
>  drivers/staging/media/rkvdec/rkvdec.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
> index c8c14f35ac44..9002eb3a59e5 100644
> --- a/drivers/staging/media/rkvdec/rkvdec.c
> +++ b/drivers/staging/media/rkvdec/rkvdec.c
> @@ -334,8 +334,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;
>  }
>
diff mbox series

Patch

diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
index c8c14f35ac44..9002eb3a59e5 100644
--- a/drivers/staging/media/rkvdec/rkvdec.c
+++ b/drivers/staging/media/rkvdec/rkvdec.c
@@ -334,8 +334,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;
 }