public inbox for linux-rockchip@lists.infradead.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
To: Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>,
	Tomasz Figa <tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: kernel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org,
	Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>,
	Jonas Karlman <jonas-uIzNG4q0ceqzQB+pC5nmwQ@public.gmane.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	Hans Verkuil
	<hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>,
	Sakari Ailus
	<sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Nicolas Dufresne
	<nicolas.dufresne-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>,
	Linux Media Mailing List
	<linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 01/10] media: Introduce helpers to fill pixel format structs
Date: Thu, 21 Feb 2019 16:26:10 -0300	[thread overview]
Message-ID: <d53c1a3c8ffdc0bbc4460e6eaa4810456c723304.camel@collabora.com> (raw)
In-Reply-To: <ea53ac3d-a337-d725-3317-1cef42481820-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>

On Wed, 2019-02-20 at 09:39 +0100, Hans Verkuil wrote:
> On 2/20/19 7:53 AM, Tomasz Figa wrote:
> > On Thu, Feb 7, 2019 at 1:36 AM Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org> wrote:
> > > On 2/6/19 5:22 PM, Ezequiel Garcia wrote:
> > > > On Wed, 2019-02-06 at 11:43 +0100, Hans Verkuil wrote:
> > > > > Hi Ezequiel,
> > > > > 
> > > > > A quick review below. This looks really useful, BTW.
> > > > > 
> > > > > On 2/5/19 9:24 PM, Ezequiel Garcia wrote:
> > 
> > [snip]
> > > > > > +/**
> > > > > > + * struct v4l2_format_info - information about a V4L2 format
> > > > > > + * @format: 4CC format identifier (V4L2_PIX_FMT_*)
> > > > > > + * @header_size: Size of header, optional and used by compressed formats
> > > > > > + * @num_planes: Number of planes (1 to 3)
> > > > > 
> > > > > This is actually 1-4 since there may be an alpha channel as well. Not that we have
> > > > > such formats since the only formats with an alpha channel are interleaved formats,
> > > > > but it is possible.
> > 
> > How about 1 to VIDEO_MAX_PLANES to be a bit more consistent?
> > Tbh. I'm not sure why we have that defined to 8, but if we have such
> > constant already, it could make sense to use it here as well.
> 
> We didn't know at the time how many planes we would need. I think we
> chose 8 because 1) that fit inside struct v4l2_format and 2) it allowed
> room for planes carrying meta data.
> 
> In hindsight we probably should have chosen 4 instead of 8.
> 
> In any case, since this is an internal API I think chosing MAX_PLANES
> here would waste unnecessary memory.
> 

4 it is then.

> > [snip]
> > > > Also, note that drm-fourcc deprecates cpp, to support tile formats.
> > > > Hopefully we don't need that here?
> > > 
> > > We do have tile formats (V4L2_PIX_FMT_NV12MT_16X16), but it is up to the
> > > driver to align width/height accordingly.
> > > 
> > 
> > I'd still make these helpers align to the constraints defined by the
> > format itself (e.g. 16x16), since it doesn't cost us anything, and
> > have the driver do any further alignment only if they need so.
> 
> Yes, sorry, I should have said that: for tiled pixel formats this
> struct should give the alignments.
> 
> But those alignments differ from hsub/vsub: those values restrict the
> resolution, but the 'tiled' alignments are on top of that.
> 

Hm, OK. So the idea is support tiling formats on this helpers?

Might need to change the way we describe formats, as DRM does,
to incorporate some notion of pixel blocks.

> > > > > > + * @hsub: Horizontal chroma subsampling factor
> > > > > > + * @vsub: Vertical chroma subsampling factor
> > > > > 
> > > > > A bit too cryptic IMHO. I would prefer hdiv or hsubsampling. 'hsub' suggests
> > > > > subtraction :-)
> > > > > 
> > > > 
> > > > Ditto, this name follows drm-fourcc. I'm fine either way.
> > > > 
> > 
> > I personally like hsub and vsub too, but maybe I just spent too much
> > time with DRM code. *subsampling would make the initializers super
> > wide, so if we decide that we don't like *sub, I'd go with *div.
> > 

Note that there's a v2 patch, where I went with *div :-)

> > > > > > + * @multiplanar: Is it a multiplanar variant format? (e.g. NV12M)
> > > > > 
> > > > > This should, I think, be renamed to num_non_contig_planes to indicate how many
> > > > > non-contiguous planes there are in the format.
> > > > > 
> > > > > So this value is 1 for NV12 and 2 for NV12M. For V4L2_PIX_FMT_YUV444M it is 3.
> > > > > 
> > > > > You can stick this value directly into pixfmt_mp->num_planes.
> > > > > 
> > > > 
> > > > Fine by me, but I have to admit I don't see the value of adding the
> > > > number of non-contiguous planes. For multiplanar non-contiguous formats
> > > > the number of planes is equal to the number of planes.
> > > 
> > > Hmm, that's true. Choose whatever gives you the shortest code :-)
> > > 
> > > > Although maybe it will be clear this way for readers?
> > > > 
> > > > > As an aside: perhaps we should start calling the 'multiplanar API' the
> > > > > 'multiple non-contiguous planes API', at least in the documentation. It's the
> > 
> > To me, "multiple non-contiguous planes API" would suggest that the
> > planes themselves are non-contiguous.
> > 
> > Many drivers (especially Samsung ones) have a distinction between
> > "color planes" and "memory planes" internally, so maybe "Multiple
> > memory planes API" could make sense?
> 
> Huh, that's an idea. So _MPLANE should have been _MMPLANE?
> 
> > > > > first time that I found a description that actually covers the real meaning.
> > > > > 
> > > > 
> > > > Yes, indeed. In fact, my first version of this code had something like
> > > > "is_noncontiguous" instead of the "multiplanar" field.
> > > 
> > > I'm fine with that. Add a comment after it like: /* aka multiplanar */
> > > 
> > 
> > FWIW, some of the drivers have .num_cplanes and .num_mplanes in their
> > format descriptors.
> 
> 

This sounds nice.

To be clear, this means that instead of a boolean is_noncontigous, we describe
the number of (non-contiguous) memory planes and the number of component planes.

I really dislike the name "color planes", because it could be misleading
as chroma planes, so I think "component planes" makes it more clear.

Thanks for reviewing!
Eze

  parent reply	other threads:[~2019-02-21 19:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05 20:24 [PATCH v1 00/10] Add MPEG-2 decoding to Rockchip VPU Ezequiel Garcia
     [not found] ` <20190205202417.16555-1-ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-02-05 20:24   ` [PATCH 01/10] media: Introduce helpers to fill pixel format structs Ezequiel Garcia
     [not found]     ` <20190205202417.16555-2-ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-02-06 10:43       ` Hans Verkuil
     [not found]         ` <79ad7cf7-90d5-9542-06ea-e28ddeb14e94-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2019-02-06 16:22           ` Ezequiel Garcia
     [not found]             ` <85ff24016b4d4b55a1a02f1aee6b42dbbaf2279a.camel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-02-06 16:36               ` Hans Verkuil
     [not found]                 ` <d1ea8698-e4c6-a826-0820-b8395c8c2a6f-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2019-02-20  6:53                   ` Tomasz Figa
     [not found]                     ` <CAAFQd5DLTOJ0kheFdxzTV7Hrtc5MpG4Utn00HgNh06d+h_qJfQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-02-20  8:39                       ` Hans Verkuil
     [not found]                         ` <ea53ac3d-a337-d725-3317-1cef42481820-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2019-02-21 19:26                           ` Ezequiel Garcia [this message]
2019-02-05 20:24   ` [PATCH 02/10] rockchip/vpu: Use pixel format helpers Ezequiel Garcia
2019-02-05 20:24   ` [PATCH 03/10] rockchip/vpu: Use v4l2_m2m_buf_copy_data Ezequiel Garcia
2019-02-05 20:24   ` [PATCH 04/10] rockchip/vpu: Cleanup macroblock alignment Ezequiel Garcia
2019-02-05 20:24   ` [PATCH 05/10] rockchip/vpu: Cleanup JPEG bounce buffer management Ezequiel Garcia
2019-02-05 20:24   ` [PATCH 06/10] rockchip/vpu: Open-code media controller register Ezequiel Garcia
2019-02-05 20:24   ` [PATCH 07/10] rockchip/vpu: Support the Request API Ezequiel Garcia
2019-02-05 20:24   ` [PATCH 08/10] rockchip/vpu: Add decoder boilerplate Ezequiel Garcia
2019-02-05 20:24   ` [PATCH 09/10] rockchip/vpu: Add support for non-standard controls Ezequiel Garcia
2019-02-05 20:24   ` [PATCH 10/10] rockchip/vpu: Add support for MPEG-2 decoding Ezequiel Garcia

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=d53c1a3c8ffdc0bbc4460e6eaa4810456c723304.camel@collabora.com \
    --to=ezequiel-zgy8ohtn/8qb+jhodadfcq@public.gmane.org \
    --cc=hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org \
    --cc=jonas-uIzNG4q0ceqzQB+pC5nmwQ@public.gmane.org \
    --cc=kernel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org \
    --cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=nicolas.dufresne-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org \
    --cc=sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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