media: verisilicon: Explicitly disable selection api ioctls for decoders
Subsystems (3)
PATCH v2 1/1 media: verisilicon: Explicitly disable selection api ioctls for decoders
Call the dedicated v4l2_disable_ioctl helper instead of manually checking whether the current context is an encoder for the selection api ioctls.
Signed-off-by Paul Kocialkowski <[email protected]>
Reviewed-by Nicolas Dufresne <[email protected]>
--- drivers/media/platform/verisilicon/hantro_drv.c | 2 ++ drivers/media/platform/verisilicon/hantro_v4l2.c | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/media/platform/verisilicon/hantro_drv.c +2 -0
@@ -916,6 +916,8 @@ static int hantro_add_func(struct hantro_dev *vpu, unsigned int funcid) vpu->decoder = func;v4l2_disable_ioctl (vfd,VIDIOC_TRY_ENCODER_CMD );v4l2_disable_ioctl (vfd,VIDIOC_ENCODER_CMD ); +v4l2_disable_ioctl (vfd,VIDIOC_G_SELECTION ); +v4l2_disable_ioctl (vfd,VIDIOC_S_SELECTION ); }video_set_drvdata (vfd, vpu);
drivers/media/platform/verisilicon/hantro_v4l2.c +2 -4
@@ -663,8 +663,7 @@ static int vidioc_g_selection(struct file *file, void *priv,struct hantro_ctx *ctx =file_to_ctx (file);/* Crop only supported on source. */ -if (!ctx->is_encoder || - sel->type !=V4L2_BUF_TYPE_VIDEO_OUTPUT ) +if (sel->type !=V4L2_BUF_TYPE_VIDEO_OUTPUT )return -EINVAL ;switch (sel->target) {
@@ -696,8 +695,7 @@ static int vidioc_s_selection(struct file *file, void *priv,struct vb2_queue *vq;/* Crop only supported on source. */ -if (!ctx->is_encoder || - sel->type !=V4L2_BUF_TYPE_VIDEO_OUTPUT ) +if (sel->type !=V4L2_BUF_TYPE_VIDEO_OUTPUT )return -EINVAL ;/* Change not allowed if the queue is streaming. */
Signature · 1 line
2.50.1