diff mbox series

[3/7] media: coda: disable encoder ioctls for decoder devices

Message ID 20220404163533.707508-3-p.zabel@pengutronix.de
State Accepted
Commit ca43692ae15ed74d47a794884588dc7ff5afb384
Headers show
Series [1/7] media: coda: set output buffer bytesused to appease v4l2-compliance | expand

Commit Message

Philipp Zabel April 4, 2022, 4:35 p.m. UTC
Use v4l2_disable_ioctl() to disable the encoder ioctls
VIDIOC_ENUM_FRAMESIZES, VIDIOC_ENUM_FRAMEINTERVALS, VIDIOC_G_PARM, and
VIDIOC_S_PARM, to fix this v4l2-compliance test failure:

		fail: v4l2-test-formats.cpp(1363): node->is_m2m && !is_stateful_enc
	test VIDIOC_G/S_PARM: FAIL

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/media/platform/chips-media/coda-common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Nicolas Dufresne April 5, 2022, 2:13 p.m. UTC | #1
Le lundi 04 avril 2022 à 18:35 +0200, Philipp Zabel a écrit :
> Use v4l2_disable_ioctl() to disable the encoder ioctls
> VIDIOC_ENUM_FRAMESIZES, VIDIOC_ENUM_FRAMEINTERVALS, VIDIOC_G_PARM, and
> VIDIOC_S_PARM, to fix this v4l2-compliance test failure:
> 
> 		fail: v4l2-test-formats.cpp(1363): node->is_m2m && !is_stateful_enc
> 	test VIDIOC_G/S_PARM: FAIL

nit: Perhaps this comment can be improved. VIDIOC_ENUM_FRAMESIZES (even though
it could arguably be nicer to implement it for decoders) was returning ENOTTY
already, so I think its unlikely it was causing a test failures. For other it
G/S_PARM that looks logical, we usually don't use these for decoding unless the
decoders can report the rate from the VUI or something, though this is not yet
specified.

For the change itself, which looks all right.

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/media/platform/chips-media/coda-common.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/chips-media/coda-common.c b/drivers/media/platform/chips-media/coda-common.c
> index dc75133b0ead..c60473b18b6b 100644
> --- a/drivers/media/platform/chips-media/coda-common.c
> +++ b/drivers/media/platform/chips-media/coda-common.c
> @@ -1269,9 +1269,6 @@ static int coda_enum_framesizes(struct file *file, void *fh,
>  	struct coda_q_data *q_data_dst;
>  	const struct coda_codec *codec;
>  
> -	if (ctx->inst_type != CODA_INST_ENCODER)
> -		return -ENOTTY;
> -
>  	if (fsize->index)
>  		return -EINVAL;
>  
> @@ -2888,6 +2885,10 @@ static int coda_register_device(struct coda_dev *dev, int i)
>  	} else {
>  		v4l2_disable_ioctl(vfd, VIDIOC_ENCODER_CMD);
>  		v4l2_disable_ioctl(vfd, VIDIOC_TRY_ENCODER_CMD);
> +		v4l2_disable_ioctl(vfd, VIDIOC_ENUM_FRAMESIZES);
> +		v4l2_disable_ioctl(vfd, VIDIOC_ENUM_FRAMEINTERVALS);
> +		v4l2_disable_ioctl(vfd, VIDIOC_G_PARM);
> +		v4l2_disable_ioctl(vfd, VIDIOC_S_PARM);
>  	}
>  
>  	ret = video_register_device(vfd, VFL_TYPE_VIDEO, 0);
diff mbox series

Patch

diff --git a/drivers/media/platform/chips-media/coda-common.c b/drivers/media/platform/chips-media/coda-common.c
index dc75133b0ead..c60473b18b6b 100644
--- a/drivers/media/platform/chips-media/coda-common.c
+++ b/drivers/media/platform/chips-media/coda-common.c
@@ -1269,9 +1269,6 @@  static int coda_enum_framesizes(struct file *file, void *fh,
 	struct coda_q_data *q_data_dst;
 	const struct coda_codec *codec;
 
-	if (ctx->inst_type != CODA_INST_ENCODER)
-		return -ENOTTY;
-
 	if (fsize->index)
 		return -EINVAL;
 
@@ -2888,6 +2885,10 @@  static int coda_register_device(struct coda_dev *dev, int i)
 	} else {
 		v4l2_disable_ioctl(vfd, VIDIOC_ENCODER_CMD);
 		v4l2_disable_ioctl(vfd, VIDIOC_TRY_ENCODER_CMD);
+		v4l2_disable_ioctl(vfd, VIDIOC_ENUM_FRAMESIZES);
+		v4l2_disable_ioctl(vfd, VIDIOC_ENUM_FRAMEINTERVALS);
+		v4l2_disable_ioctl(vfd, VIDIOC_G_PARM);
+		v4l2_disable_ioctl(vfd, VIDIOC_S_PARM);
 	}
 
 	ret = video_register_device(vfd, VFL_TYPE_VIDEO, 0);