Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Paul Kocialkowski <paulk@sys-base.io>,
	linux-media@vger.kernel.org,  linux-rockchip@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: Re: [PATCH] media: verisilicon: Explicitly disable all encoder ioctls for decoders
Date: Wed, 27 Aug 2025 10:30:40 -0400	[thread overview]
Message-ID: <ee7416c9db2128ab1a8c1bbdc7cd231da21e5b53.camel@collabora.com> (raw)
In-Reply-To: <20250826190416.1287089-1-paulk@sys-base.io>


[-- Attachment #1.1: Type: text/plain, Size: 2569 bytes --]

Hi Paul,

Le mardi 26 août 2025 à 21:04 +0200, Paul Kocialkowski a écrit :
> Call the dedicated v4l2_disable_ioctl helper instead of manually
> checking whether the current context is an encoder for the selection
> ioctls.
> 
> Signed-off-by: Paul Kocialkowski <paulk@sys-base.io>
> ---
>  drivers/media/platform/verisilicon/hantro_drv.c  | 2 ++
>  drivers/media/platform/verisilicon/hantro_v4l2.c | 6 ++----
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c
> b/drivers/media/platform/verisilicon/hantro_drv.c
> index 4cc9d00fd293..6fb28a6293e7 100644
> --- a/drivers/media/platform/verisilicon/hantro_drv.c
> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
> @@ -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);

Disabling this IOCTL for JPEG is fine, but for VP8, H.264, HEVC, VP9 and AV1, it
is pretty much mandatory. Otherwise your stream will advertise the padded
dimentions and there would be no way to tell it that what is the cropping window
for bitstream generation purpose. Considering you are looking forward adding
H.264 encoding, do you really want to apply this fix ?

Nicolas

>  	}
>  
>  	video_set_drvdata(vfd, vpu);
> diff --git a/drivers/media/platform/verisilicon/hantro_v4l2.c
> b/drivers/media/platform/verisilicon/hantro_v4l2.c
> index 6bcd892e7bb4..fcf3bd9bcda2 100644
> --- a/drivers/media/platform/verisilicon/hantro_v4l2.c
> +++ b/drivers/media/platform/verisilicon/hantro_v4l2.c
> @@ -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. */

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2025-08-27 15:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26 19:04 [PATCH] media: verisilicon: Explicitly disable all encoder ioctls for decoders Paul Kocialkowski
2025-08-27 14:30 ` Nicolas Dufresne [this message]
2025-08-27 16:11   ` Paul Kocialkowski
2025-08-27 17:47     ` Nicolas Dufresne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee7416c9db2128ab1a8c1bbdc7cd231da21e5b53.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=paulk@sys-base.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox