[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240723100333.gf2ih3kbjllq7xmb@basti-XPS-13-9310>
Date: Tue, 23 Jul 2024 12:03:33 +0200
From: Sebastian Fricke <sebastian.fricke@...labora.com>
To: Benjamin Gaignard <benjamin.gaignard@...labora.com>
Cc: mchehab@...nel.org, ezequiel@...guardiasur.com.ar,
hverkuil-cisco@...all.nl, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-rockchip@...ts.infradead.org,
kernel@...labora.com
Subject: Re: [PATCH v5 3/3] media: verisilicon: Use V4L2_FMT_FLAG_ENUM_ALL
flag
Hey Benjamin,
On 22.07.2024 17:05, Benjamin Gaignard wrote:
>By adding support of V4L2_FMT_FLAG_ENUM_ALL flag into the driver
s/support of/support for the/
>we allowing userspce applications to discover all possible
Either:
s/we allowing/we allow/
or
s/we allowing/we are allowing/
are correct.
s/userspce/userspace/
>pixel formats of the hardware block. This way userspace can decide
>of which decoder to use given the support pixel formats.
s/of which/which/
s/support/supported/
>
>Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...labora.com>
>---
> .../media/platform/verisilicon/hantro_v4l2.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/media/platform/verisilicon/hantro_v4l2.c b/drivers/media/platform/verisilicon/hantro_v4l2.c
>index df6f2536263b..77f024aaa22d 100644
>--- a/drivers/media/platform/verisilicon/hantro_v4l2.c
>+++ b/drivers/media/platform/verisilicon/hantro_v4l2.c
>@@ -201,7 +201,14 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
> struct hantro_ctx *ctx = fh_to_ctx(priv);
> const struct hantro_fmt *fmt, *formats;
> unsigned int num_fmts, i, j = 0;
>- bool skip_mode_none;
>+ bool skip_mode_none, enum_all_formats;
>+ u32 index = f->index & ~V4L2_FMT_FLAG_ENUM_ALL;
As described in the previous patch, I think this operation will turn out
to be very common, so maybe we can add a macro for that.
>+
>+ /*
>+ * If V4L2_FMT_FLAG_ENUM_ALL flag is set, we want to enumerate all
s/If/If the/
>+ * hardware supported pixels formats
s/pixels/pixel/
Greetings,
Sebastian
>+ */
>+ enum_all_formats = !!(f->index & V4L2_FMT_FLAG_ENUM_ALL);
>
> /*
> * When dealing with an encoder:
>@@ -222,9 +229,9 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
>
> if (skip_mode_none == mode_none)
> continue;
>- if (!hantro_check_depth_match(fmt, ctx->bit_depth))
>+ if (!hantro_check_depth_match(fmt, ctx->bit_depth) && !enum_all_formats)
> continue;
>- if (j == f->index) {
>+ if (j == index) {
> f->pixelformat = fmt->fourcc;
> return 0;
> }
>@@ -242,9 +249,9 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
> for (i = 0; i < num_fmts; i++) {
> fmt = &formats[i];
>
>- if (!hantro_check_depth_match(fmt, ctx->bit_depth))
>+ if (!hantro_check_depth_match(fmt, ctx->bit_depth) && !enum_all_formats)
> continue;
>- if (j == f->index) {
>+ if (j == index) {
> f->pixelformat = fmt->fourcc;
> return 0;
> }
>--
>2.43.0
>
>_______________________________________________
>Kernel mailing list -- kernel@...lman.collabora.com
>To unsubscribe send an email to kernel-leave@...lman.collabora.com
>This list is managed by https://mailman.collabora.com
Powered by blists - more mailing lists