]> www.infradead.org Git - users/hch/misc.git/commitdiff
media: verisilicon: Explicitly disable selection api ioctls for decoders
authorPaul Kocialkowski <paulk@sys-base.io>
Thu, 28 Aug 2025 13:49:18 +0000 (15:49 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Thu, 4 Sep 2025 08:37:05 +0000 (10:37 +0200)
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 <paulk@sys-base.io>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/verisilicon/hantro_drv.c
drivers/media/platform/verisilicon/hantro_v4l2.c

index 4cc9d00fd2936dcfaa4574d8bd9a23b9ae9b5476..6fb28a6293e71b3a2653f47fefecb46519971555 100644 (file)
@@ -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);
index 6bcd892e7bb49c654aae5841664d68c1692064bd..fcf3bd9bcda2d02481fa7e1f20e6b7ca54d6d786 100644 (file)
@@ -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. */