mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	 p.zabel@pengutronix.de, mchehab@kernel.org, hverkuil@xs4all.nl
Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	 linux-kernel@vger.kernel.org, kernel@collabora.com
Subject: Re: [PATCH] media: verisilicon: Export only needed pixels formats.
Date: Thu, 26 Jun 2025 08:59:00 -0400	[thread overview]
Message-ID: <dc841d1e6b12c46388aec8ebcd0b002f56d30d1c.camel@collabora.com> (raw)
In-Reply-To: <20250624122938.62004-1-benjamin.gaignard@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 2708 bytes --]

Hi Benjamin,

Le mardi 24 juin 2025 à 14:29 +0200, Benjamin Gaignard a écrit :
> When enumerating the pixels formats check if the context
> request to only export post-processed pixels formats.
> The exception is when V4L2_FMTDESC_FLAG_ENUM_ALL is set, we
> need to export all pixels formats.

The change looks good. The explanation could perhaps be improved. Perhaps
something along this instead ?

	Some pixel formats can only be produced if the decoder outputs 
	reference pictures directly. In some cases, such as AV1 film-grain,
	the use of the post-processor is strictly required. In this case,
	only enumerate the post-processor supported formats. The exception is
	when V4L2_FMTDESC_FLAG_ENUM_ALL is set, in this case, we enumerate
	everything regardless of the state.

Perhaps long term we should rename need_postproc by force_postproc. I think this
would help reading the code.

> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
> Fixes: bcd4f091cf1e ("media: verisilicon: Use V4L2_FMTDESC_FLAG_ENUM_ALL flag")

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

> ---
>  drivers/media/platform/verisilicon/hantro_v4l2.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/verisilicon/hantro_v4l2.c b/drivers/media/platform/verisilicon/hantro_v4l2.c
> index 7c3515cf7d64..7869faf921f4 100644
> --- a/drivers/media/platform/verisilicon/hantro_v4l2.c
> +++ b/drivers/media/platform/verisilicon/hantro_v4l2.c
> @@ -222,6 +222,7 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
>  	unsigned int num_fmts, i, j = 0;
>  	bool skip_mode_none, enum_all_formats;
>  	u32 index = f->index & ~V4L2_FMTDESC_FLAG_ENUM_ALL;
> +	bool need_postproc = ctx->need_postproc;
>  
>  	/*
>  	 * If the V4L2_FMTDESC_FLAG_ENUM_ALL flag is set, we want to enumerate all
> @@ -230,6 +231,9 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
>  	enum_all_formats = !!(f->index & V4L2_FMTDESC_FLAG_ENUM_ALL);
>  	f->index = index;
>  
> +	if (enum_all_formats)
> +		need_postproc = HANTRO_AUTO_POSTPROC;
> +
>  	/*
>  	 * When dealing with an encoder:
>  	 *  - on the capture side we want to filter out all MODE_NONE formats.
> @@ -242,7 +246,7 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
>  	 */
>  	skip_mode_none = capture == ctx->is_encoder;
>  
> -	formats = hantro_get_formats(ctx, &num_fmts, HANTRO_AUTO_POSTPROC);
> +	formats = hantro_get_formats(ctx, &num_fmts, need_postproc);
>  	for (i = 0; i < num_fmts; i++) {
>  		bool mode_none = formats[i].codec_mode == HANTRO_MODE_NONE;
>  		fmt = &formats[i];

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

      reply	other threads:[~2025-06-26 12:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 12:29 Benjamin Gaignard
2025-06-26 12:59 ` Nicolas Dufresne [this message]

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=dc841d1e6b12c46388aec8ebcd0b002f56d30d1c.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@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 \
    /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

all inboxes | Powered by JetHome®