linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Boris Brezillon <boris.brezillon@collabora.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@iki.fi>,
	linux-media@vger.kernel.org
Cc: Tomasz Figa <tfiga@chromium.org>,
	Hirokazu Honda <hiroh@chromium.org>,
	Nicolas Dufresne <nicolas@ndufresne.ca>,
	Brian Starkey <Brian.Starkey@arm.com>,
	kernel@collabora.com
Subject: Re: [RFC PATCH v3 1/6] media: v4l2: Extend pixel formats to unify single/multi-planar handling (and more)
Date: Mon, 21 Oct 2019 10:41:30 +0200	[thread overview]
Message-ID: <9b289f76-6c09-b088-204d-ce5b5009bd7b@xs4all.nl> (raw)
In-Reply-To: <20191008091119.7294-2-boris.brezillon@collabora.com>

On 10/8/19 11:11 AM, Boris Brezillon wrote:
> This is part of the multiplanar and singleplanar unification process.
> v4l2_ext_pix_format is supposed to work for both cases.
> 
> We also add the concept of modifiers already employed in DRM to expose
> HW-specific formats (like tiled or compressed formats) and allow
> exchanging this information with the DRM subsystem in a consistent way.
> 
> Note that V4L2_BUF_TYPE_VIDEO[_OUTPUT]_OVERLAY and
> V4L2_BUF_TYPE_VIDEO_{CAPTURE,OUTPUT}_MPLANE types are no longer accepted
> in v4l2_ext_format and will be rejected if you use the {G,S,TRY}EXT_FMT
> ioctls. V4L2_BUF_TYPE_VIDEO_{CAPTURE,OUTPUT}_MPLANE is dropped as part
> of the multiplanar/singleplanar unification.
> V4L2_BUF_TYPE_VIDEO[_OUTPUT]_OVERLAY seems to be used mostly on old
> drivers and supporting it would require some extra rework.
> 
> New hooks have been added to v4l2_ioctl_ops to support those new ioctls
> in drivers, but, in the meantime, the core takes care of converting
> {S,G,TRY}_EXT_FMT requests into {S,G,TRY}_FMT so that old drivers can
> still work if the userspace app/lib uses the new ioctls.
> The conversion is also done the other around to allow userspace
> apps/libs using {S,G,TRY}_FMT to work with drivers implementing the
> _ext_ hooks.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---

<snip>

>  
> +#define VIDIOC_G_EXT_FMT	_IOWR('V', 104, struct v4l2_ext_format)
> +#define VIDIOC_S_EXT_FMT	_IOWR('V', 105, struct v4l2_ext_format)
> +#define VIDIOC_TRY_EXT_FMT	_IOWR('V', 106, struct v4l2_ext_format)
>  /* Reminder: when adding new ioctls please add support for them to
>     drivers/media/v4l2-core/v4l2-compat-ioctl32.c as well! */
>  
> 

Since we're extending g/s/try_fmt, we should also provide a replacement for
enum_fmt, esp. given this thread:

https://www.mail-archive.com/linux-media@vger.kernel.org/msg150871.html

So here is a preliminary suggestion:

struct v4l2_ext_fmtdesc {
        __u32               index;             /* Format number      */
        __u32               type;              /* enum v4l2_buf_type */
	__u32               which;             /* enum v4l2_subdev_format_whence, ignored if mbus_code == 0 */
        __u32               mbus_code;         /* Mediabus Code (set to 0 if n/a) */
        __u32               flags;
        __u8                description[32];   /* Description string */
        __u32               pixelformat;       /* Format fourcc      */
};

This would solve (I think) the issue raised in the thread since you can now get
just for formats that are valid for the given mediabus code and the which field.

Other improvements that could be made is to return more information about the
format (similar to struct v4l2_format_info). In particular v4l2_pixel_encoding
and mem/comp_planes would be useful for userspace to know.

Finally, we can also add a new ioctl that combines ENUM_FMT/ENUM_FRAMESIZES/ENUM_FRAMEINTERVALS
and returns an array of all valid formats/sizes/intervals, requiring just a single ioctl
to obtain all this information.

Regards,

	Hans

  reply	other threads:[~2019-10-21  8:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08  9:11 [RFC PATCH v2 0/7] media: v4l2: Add extended fmt and buffer ioctls Boris Brezillon
2019-10-08  9:11 ` [RFC PATCH v3 1/6] media: v4l2: Extend pixel formats to unify single/multi-planar handling (and more) Boris Brezillon
2019-10-21  8:41   ` Hans Verkuil [this message]
2019-10-21  9:26     ` Tomasz Figa
2019-10-21  9:37       ` Hans Verkuil
2019-10-21  9:48         ` Tomasz Figa
2019-10-21 10:17           ` Hans Verkuil
2019-11-20  8:50             ` Tomasz Figa
2020-02-24 14:17   ` Maxime Jourdan
2020-02-24 14:58     ` Boris Brezillon
2019-10-08  9:11 ` [RFC PATCH v3 2/6] media: v4l2: Add extended buffer operations Boris Brezillon
2020-03-04 17:54   ` [RFC PATCH 3/3] " Fritz Koenig
2020-03-04 18:25     ` Fritz Koenig
2019-10-08  9:11 ` [RFC PATCH v3 3/6] media: videobuf2: Expose helpers to implement the _ext_fmt and _ext_buf hooks Boris Brezillon
2019-10-08  9:11 ` [RFC PATCH v3 4/6] media: mediabus: Add an helper to convert a ext_pix format to an mbus_fmt Boris Brezillon
2019-10-08  9:11 ` [RFC PATCH v3 5/6] media: vivid: Convert the capture and output drivers to EXT_FMT/EXT_BUF Boris Brezillon
2019-10-08  9:11 ` [RFC PATCH v3 6/6] media: vimc: Implement the ext_fmt and ext_buf hooks Boris Brezillon
2019-10-08  9:13 ` [RFC PATCH v2 0/7] media: v4l2: Add extended fmt and buffer ioctls Boris Brezillon
2020-03-10 22:18 ` Fritz Koenig

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=9b289f76-6c09-b088-204d-ce5b5009bd7b@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=Brian.Starkey@arm.com \
    --cc=boris.brezillon@collabora.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hiroh@chromium.org \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=sakari.ailus@iki.fi \
    --cc=tfiga@chromium.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;
as well as URLs for NNTP newsgroup(s).