From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
mchehab@kernel.org, ezequiel@vanguardiasur.com.ar
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rockchip@lists.infradead.org, kernel@collabora.com
Subject: Re: [PATCH v5 2/3] media: test-drivers: Use V4L2_FMT_FLAG_ENUM_ALL flag
Date: Wed, 31 Jul 2024 09:05:57 +0200 [thread overview]
Message-ID: <fb7f0071-503c-4f06-bae2-1c0e6d69a5e3@collabora.com> (raw)
In-Reply-To: <92c88d0f-219e-43b4-9dce-5ae99585b767@xs4all.nl>
Le 30/07/2024 à 09:13, Hans Verkuil a écrit :
> On 22/07/2024 17:05, Benjamin Gaignard wrote:
>> Since V4L2_FMT_FLAG_ENUM_ALL flag mostly targeting stateless
>> decoder pixel formats enumeration, update vicodec visl test
>> drivers to use it.
>>
>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
>> ---
>> drivers/media/test-drivers/vicodec/vicodec-core.c | 7 ++++---
>> drivers/media/test-drivers/visl/visl-video.c | 11 +++++++----
>> 2 files changed, 11 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c
>> index 3e011fe62ae1..1b4cd8ddd7c2 100644
>> --- a/drivers/media/test-drivers/vicodec/vicodec-core.c
>> +++ b/drivers/media/test-drivers/vicodec/vicodec-core.c
>> @@ -706,6 +706,7 @@ static int enum_fmt(struct v4l2_fmtdesc *f, struct vicodec_ctx *ctx,
>> bool is_out)
>> {
>> bool is_uncomp = (ctx->is_enc && is_out) || (!ctx->is_enc && !is_out);
>> + u32 index = f->index & ~V4L2_FMT_FLAG_ENUM_ALL;
> This is not what I am looking for: to properly test this in v4l2-compliance this
> flag actually has to make a difference in the result. I.e. you actually have to
> add some limitation. This might be easier to do in visl than vicodec. As long as
> at least one test-driver support this, then that's good enough for me.
Ok I will focus on visl and made it return another list of formats when the
flag is set.
Regards,
Benjamin
> Regards,
>
> Hans
>
>>
>> if (V4L2_TYPE_IS_MULTIPLANAR(f->type) && !multiplanar)
>> return -EINVAL;
>> @@ -718,18 +719,18 @@ static int enum_fmt(struct v4l2_fmtdesc *f, struct vicodec_ctx *ctx,
>>
>> if (ctx->is_enc ||
>> !vb2_is_streaming(&ctx->fh.m2m_ctx->cap_q_ctx.q))
>> - info = v4l2_fwht_get_pixfmt(f->index);
>> + info = v4l2_fwht_get_pixfmt(index);
>> else
>> info = v4l2_fwht_find_nth_fmt(info->width_div,
>> info->height_div,
>> info->components_num,
>> info->pixenc,
>> - f->index);
>> + index);
>> if (!info)
>> return -EINVAL;
>> f->pixelformat = info->id;
>> } else {
>> - if (f->index)
>> + if (index)
>> return -EINVAL;
>> f->pixelformat = ctx->is_stateless ?
>> V4L2_PIX_FMT_FWHT_STATELESS : V4L2_PIX_FMT_FWHT;
>> diff --git a/drivers/media/test-drivers/visl/visl-video.c b/drivers/media/test-drivers/visl/visl-video.c
>> index f8d970319764..c5f3e13b4198 100644
>> --- a/drivers/media/test-drivers/visl/visl-video.c
>> +++ b/drivers/media/test-drivers/visl/visl-video.c
>> @@ -341,21 +341,24 @@ static int visl_enum_fmt_vid_cap(struct file *file, void *priv,
>> struct v4l2_fmtdesc *f)
>> {
>> struct visl_ctx *ctx = visl_file_to_ctx(file);
>> + u32 index = f->index & ~V4L2_FMT_FLAG_ENUM_ALL;
>>
>> - if (f->index >= ctx->coded_format_desc->num_decoded_fmts)
>> + if (index >= ctx->coded_format_desc->num_decoded_fmts)
>> return -EINVAL;
>>
>> - f->pixelformat = ctx->coded_format_desc->decoded_fmts[f->index];
>> + f->pixelformat = ctx->coded_format_desc->decoded_fmts[index];
>> return 0;
>> }
>>
>> static int visl_enum_fmt_vid_out(struct file *file, void *priv,
>> struct v4l2_fmtdesc *f)
>> {
>> - if (f->index >= ARRAY_SIZE(visl_coded_fmts))
>> + u32 index = f->index & ~V4L2_FMT_FLAG_ENUM_ALL;
>> +
>> + if (index >= ARRAY_SIZE(visl_coded_fmts))
>> return -EINVAL;
>>
>> - f->pixelformat = visl_coded_fmts[f->index].pixelformat;
>> + f->pixelformat = visl_coded_fmts[index].pixelformat;
>> return 0;
>> }
>>
>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2024-07-31 7:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-22 15:05 [PATCH v5 0/3] Enumerate all pixels formats Benjamin Gaignard
2024-07-22 15:05 ` [PATCH v5 1/3] media: videodev2: Add flag to unconditionnaly enumerate " Benjamin Gaignard
2024-07-23 9:00 ` Sebastian Fricke
2024-07-30 7:08 ` Hans Verkuil
2024-07-30 7:19 ` Hans Verkuil
2024-07-31 7:00 ` Benjamin Gaignard
2024-07-31 6:59 ` Benjamin Gaignard
2024-07-22 15:05 ` [PATCH v5 2/3] media: test-drivers: Use V4L2_FMT_FLAG_ENUM_ALL flag Benjamin Gaignard
2024-07-23 9:49 ` Sebastian Fricke
2024-07-30 7:15 ` Hans Verkuil
2024-07-30 7:13 ` Hans Verkuil
2024-07-31 7:05 ` Benjamin Gaignard [this message]
2024-07-22 15:05 ` [PATCH v5 3/3] media: verisilicon: " Benjamin Gaignard
2024-07-23 10:03 ` Sebastian Fricke
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=fb7f0071-503c-4f06-bae2-1c0e6d69a5e3@collabora.com \
--to=benjamin.gaignard@collabora.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=hverkuil-cisco@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 \
/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