public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [RFC PATCH] v4l2-ioctl: fill in the description for VIDIOC_ENUM_FMT
Date: Mon, 23 Mar 2015 10:24:47 +0100	[thread overview]
Message-ID: <1427102687.3170.7.camel@pengutronix.de> (raw)
In-Reply-To: <550C0FCF.4030302@xs4all.nl>

Hi Hans,

Am Freitag, den 20.03.2015, 13:17 +0100 schrieb Hans Verkuil:
> The descriptions used in drivers for the formats returned with ENUM_FMT
> are all over the place.
> 
> So instead allow the core to fill in the description and flags. This
> allows drivers to drop the description and flags.
> 
> If the format is not found in the list, and if the description field is
> filled in, then just return but call WARN_ONCE to let developers know
> that this list needs to be extended.
> 
> Based on an earlier patch from Philipp Zabel:
> http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/81411
> 
> But this patch moves the code into the core and away from drivers.

I like it. There's one small error in the NV42 description below,
otherwise
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
>
> ---
>  drivers/media/v4l2-core/v4l2-ioctl.c | 222 +++++++++++++++++++++++++++++++++--
>  1 file changed, 215 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 09ad8dd..694d1e0 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1101,6 +1101,205 @@ static int v4l_enumoutput(const struct v4l2_ioctl_ops *ops,
>  	return ops->vidioc_enum_output(file, fh, p);
>  }
>  
> +static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> +{
> +	const unsigned sz = sizeof(fmt->description);
> +	const char *descr = NULL;
> +
> +	switch (fmt->pixelformat) {
> +	/* Max description length mask:	descr = "0123456789012345678901234567890" */
> +	case V4L2_PIX_FMT_RGB332:	descr = "8-bit RGB 3-3-2"; break;
[...]
> +	case V4L2_PIX_FMT_NV12:		descr = "Y/CbCr 4:2:0"; break;
> +	case V4L2_PIX_FMT_NV21:		descr = "Y/CrCb 4:2:0"; break;
> +	case V4L2_PIX_FMT_NV16:		descr = "Y/CbCr 4:2:2"; break;
> +	case V4L2_PIX_FMT_NV61:		descr = "Y/CrCb 4:2:0"; break;
> +	case V4L2_PIX_FMT_NV24:		descr = "Y/CbCr 4:4:4"; break;
> +	case V4L2_PIX_FMT_NV42:		descr = "Y/CrCb 4:2:0"; break;

That should be 4:4:4 for NV42.

regards
Philipp


      parent reply	other threads:[~2015-03-23  9:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 12:17 [RFC PATCH] v4l2-ioctl: fill in the description for VIDIOC_ENUM_FMT Hans Verkuil
2015-03-22 12:03 ` Sakari Ailus
2015-03-22 20:38 ` Laurent Pinchart
2015-03-23 14:52   ` Hans Verkuil
2015-03-23  9:24 ` Philipp Zabel [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=1427102687.3170.7.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.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