All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com
Subject: Re: [PATCH 04/14] media: omap3isp: implement enum_fmt_vid_cap/out
Date: Mon, 1 Dec 2025 09:40:58 +0100	[thread overview]
Message-ID: <9cd8b533-95fb-4495-a67b-bdf5c7774a74@kernel.org> (raw)
In-Reply-To: <aPiOIoe24l5NNz6z@kekkonen.localdomain>

On 22/10/2025 09:56, Sakari Ailus wrote:
> Hi Hans,
> 
> On Fri, Oct 17, 2025 at 03:26:41PM +0200, Hans Verkuil wrote:
>> Add missing ioctls. This makes v4l2-compliance happier:
>>
>> fail: v4l2-test-formats.cpp(516): pixelformat 59565955 (UYVY) for buftype 1 not reported by ENUM_FMT
>> 	test VIDIOC_G_FMT: FAIL
>> fail: v4l2-test-formats.cpp(516): pixelformat 59565955 (UYVY) for buftype 1 not reported by ENUM_FMT
>> 	test VIDIOC_TRY_FMT: FAIL
>> fail: v4l2-test-formats.cpp(516): pixelformat 56595559 (YUYV) for buftype 1 not reported by ENUM_FMT
>> 	test VIDIOC_S_FMT: FAIL
>>
>> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
>> ---
>>  drivers/media/platform/ti/omap3isp/ispvideo.c | 34 +++++++++++++++++++
>>  1 file changed, 34 insertions(+)
>>
>> diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.c b/drivers/media/platform/ti/omap3isp/ispvideo.c
>> index 864d38140b87..77beea00d507 100644
>> --- a/drivers/media/platform/ti/omap3isp/ispvideo.c
>> +++ b/drivers/media/platform/ti/omap3isp/ispvideo.c
>> @@ -652,6 +652,38 @@ isp_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
>>  	return 0;
>>  }
>>  
>> +static int
>> +isp_video_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *f)
>> +{
>> +	struct isp_video *video = video_drvdata(file);
>> +	unsigned int i, j;
>> +	unsigned int skip_last_fmts = 1;
>> +
>> +	if (f->type != video->type)
>> +		return -EINVAL;
>> +
>> +	/*
>> +	 * The last two formats have the same pixelformat as the two
>> +	 * formats before them, but they do have different mediabus
>> +	 * codes. So to avoid reporting duplicate pixelformats we skip
>> +	 * those two, provided f->mbus_code is 0.
>> +	 */
>> +	if (!f->mbus_code)
>> +		skip_last_fmts += 2;
>> +	for (i = 0, j = 0; i < ARRAY_SIZE(formats) - skip_last_fmts; i++) {
>> +		if (f->mbus_code && formats[i].code != f->mbus_code)
>> +			continue;
> 
> How about, instead of the skip_last_fmts thingy, using this:
> 
> 		/* Weed out pixelformats with the same mbus code. */
> 		if (i && formats[i - 1].code == formats[i].code)
> 			continue;

Good idea, but it should be this:

               /* Weed out duplicate pixelformats with different mbus codes */
               if (!f->mbus_code && i &&
                   formats[i - 1].pixelformat == formats[i].pixelformat)
                       continue;

And the duplicate pixelformats in the formats array must be together in the
array for this to work. Easy enough to change.

Regards,

	Hans

> 
>> +
>> +		if (j == f->index) {
>> +			f->pixelformat = formats[i].pixelformat;
>> +			return 0;
>> +		}
>> +		j++;
>> +	}
>> +
>> +	return -EINVAL;
>> +}
>> +
>>  static int
>>  isp_video_get_format(struct file *file, void *fh, struct v4l2_format *format)
>>  {
>> @@ -1258,9 +1290,11 @@ isp_video_s_input(struct file *file, void *fh, unsigned int input)
>>  
>>  static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {
>>  	.vidioc_querycap		= isp_video_querycap,
>> +	.vidioc_enum_fmt_vid_cap	= isp_video_enum_format,
>>  	.vidioc_g_fmt_vid_cap		= isp_video_get_format,
>>  	.vidioc_s_fmt_vid_cap		= isp_video_set_format,
>>  	.vidioc_try_fmt_vid_cap		= isp_video_try_format,
>> +	.vidioc_enum_fmt_vid_out	= isp_video_enum_format,
>>  	.vidioc_g_fmt_vid_out		= isp_video_get_format,
>>  	.vidioc_s_fmt_vid_out		= isp_video_set_format,
>>  	.vidioc_try_fmt_vid_out		= isp_video_try_format,
> 


  reply	other threads:[~2025-12-01  8:41 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17 13:26 [PATCH 00/14] media: omap3isp: v4l2-compliance fixes Hans Verkuil
2025-10-17 13:26 ` [PATCH 01/14] media: omap3isp: configure entity functions Hans Verkuil
2025-10-17 13:26 ` [PATCH 02/14] media: omap3isp: add V4L2_CAP_IO_MC and don't set bus_info Hans Verkuil
2025-10-17 13:26 ` [PATCH 03/14] media: omap3isp: isp_video_mbus_to_pix/pix_to_mbus fixes Hans Verkuil
2025-10-22  7:48   ` Sakari Ailus
2025-12-01  8:27     ` Hans Verkuil
2025-12-01 10:22       ` Sakari Ailus
2025-12-01 12:56         ` Sakari Ailus
2025-12-01 15:35           ` Hans Verkuil
2025-12-01 16:43             ` Sakari Ailus
2025-12-02  7:18               ` Hans Verkuil
2025-10-17 13:26 ` [PATCH 04/14] media: omap3isp: implement enum_fmt_vid_cap/out Hans Verkuil
2025-10-22  7:56   ` Sakari Ailus
2025-12-01  8:40     ` Hans Verkuil [this message]
2025-12-01 11:35       ` Sakari Ailus
2025-12-01 13:44         ` Hans Verkuil
2025-12-01 15:27           ` Sakari Ailus
2025-10-17 13:26 ` [PATCH 05/14] media: omap3isp: use V4L2_COLORSPACE_SRGB instead of _JPEG Hans Verkuil
2025-10-17 13:26 ` [PATCH 06/14] media: omap3isp: set initial format Hans Verkuil
2025-10-17 13:26 ` [PATCH 07/14] media: omap3isp: rework isp_video_try/set_format Hans Verkuil
2025-10-22  8:04   ` Sakari Ailus
2025-12-01  8:48     ` Hans Verkuil
2025-12-01 12:42       ` Sakari Ailus
2025-10-17 13:26 ` [PATCH 08/14] media: omap3isp: implement create/prepare_bufs Hans Verkuil
2025-10-22  8:06   ` Sakari Ailus
2025-12-01  8:54     ` Hans Verkuil
2025-12-01 12:42       ` Sakari Ailus
2025-10-17 13:26 ` [PATCH 09/14] media: omap3isp: better VIDIOC_G/S_PARM handling Hans Verkuil
2025-10-22  8:09   ` Sakari Ailus
2025-12-01 10:28     ` Hans Verkuil
2025-12-01 13:40       ` Hans Verkuil
2025-12-01 15:10         ` Sakari Ailus
2025-10-17 13:26 ` [PATCH 10/14] media: omap3isp: support ctrl events for isppreview Hans Verkuil
2025-10-17 13:26 ` [PATCH 11/14] media: omap3isp: ispccp2: always clamp in ccp2_try_format() Hans Verkuil
2025-10-17 13:26 ` [PATCH 12/14] media: omap3isp: isppreview: always clamp in preview_try_format() Hans Verkuil
2025-10-17 13:26 ` [PATCH 13/14] DO NOT MERGE: media: omap3isp: change default resolution to 864x648 Hans Verkuil
2025-10-17 13:26 ` [PATCH 14/14] DO NOT MERGE: omap3-beagle-xm.dts: add Leopard Imaging li5m03 support Hans Verkuil

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=9cd8b533-95fb-4495-a67b-bdf5c7774a74@kernel.org \
    --to=hverkuil+cisco@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.