The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
To: "Sven Püschel" <s.pueschel@pengutronix.de>
Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	tomm.merciai@gmail.com, linux-renesas-soc@vger.kernel.org,
	biju.das.jz@bp.renesas.com,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mehdi Djait <mehdi.djait@linux.intel.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Isaac Scott <isaac.scott@ideasonboard.com>,
	Paul Cercueil <paul@crapouillou.net>,
	Daniel Scally <dan.scally+renesas@ideasonboard.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/4] media: v4l2-common: Add v4l2_fill_pixfmt_aligned() helper
Date: Fri, 10 Jul 2026 15:45:56 +0200	[thread overview]
Message-ID: <alD3lCxdoKkYDCsa@tom-desktop> (raw)
In-Reply-To: <fc504e89-11cb-47f8-ba25-19577b0811c5@pengutronix.de>


Hi Jacopo, Sven,
Thanks for your comments:

On Fri, Jul 10, 2026 at 02:26:23PM +0200, Sven Püschel wrote:
> Hi Jacopo,
> 
> On 7/10/26 2:15 PM, Jacopo Mondi wrote:
> > Hi Sven
> > 
> > On Fri, Jul 10, 2026 at 01:54:06PM +0200, Sven Püschel wrote:
> > > Hi Jacopo,
> > > 
> > > On 7/10/26 11:38 AM, Jacopo Mondi wrote:
> > > > > This is due to the fact, that while we have a hdiv of 2 we also interleave
> > > > > the cb and cr parts in a single plane, which results in the stride being the
> > > > > same number of bytes as for the y plane (and vdiv isn't relevant for the
> > > > > stride).
> > > > > 
> > > > > Therefore the stride scaling also respects the bits per plane (bpp) value to
> > > > > determine the scaling.
> > > > > 
> > > > > @Tommaso : While the sentence looks ok, the NV12 example is misguided. The
> > > > I guess the usage of NV12 was as example of a "formats that store
> > > > multiple component planes in a single memory"
> > > > 
> > > > NV24/42 works the same, but being 444 it needs the chroma plane stride to
> > > > be a multiple of the fist plane stride and might prove as a better
> > > > example ?
> > > > 
> > > My potential concern is that NV as an example misguides the reader into one
> > > of the following:
> > > 
> > > - It's only for formats which interleave cb/cr into one plane (whereas
> > > YUV420 also gets scaled)
> > > - NV24 in the example being though of including the NV24M variant (whereas
> > > latter won't be affected)
> > M variants are not supported by the single-planar APIs
> > https://docs.kernel.org/userspace-api/media/v4l/pixfmt-yuv-planar.html
> > 
> > Some planar formats allow planes to be placed in independent memory
> > locations. They are identified by an ‘M’ suffix in their name (such as
> > in V4L2_PIX_FMT_NV12M). Those formats are intended to be used only in
> > drivers and applications that support the multi-planar API,
> > 
> > And here we're dealing with single-planar API only if I'm not mistaken
> 
> Oh, sorry. Assumed that the added description of both functions would be
> similar/identical, which isn't the case.
> 
> Given this, I'm fine with the wording and agree to just change the example
> to smth. else than NV12.

So if I'm not wrong we can then use YUV420 instead of NV12.
NV12 is an unlucky example where the alignment scaling factor is 1,
whereas YUV420 has a scaling factor of 2:

# NV12
(Y - luma)      bpp[0] = 1
(CbCr - chroma) bpp[1] = 2
                hdiv = 2

# YUV420
(Y - luma)    bpp[0] = 1
(Cb - chroma) bpp[1] = 1
              hdiv = 2

For plane = 0 (single memory-plane formats):

factor = DIV_ROUND_UP(hdiv * bpp[0], bpp[1])

	NV12:    factor = DIV_ROUND_UP(2 * 1, 2) = 1
	YUV420:  factor = DIV_ROUND_UP(2 * 1, 1) = 2

Then I will leave the wording as is and changing only parenthesis part
like Sven suggested:

	(e.g NV12) --> (e.g. YUV420)

Please correct me if I'm wrong.
If for you is ok I will fix this in v4.

Kind Regards,
Tommaso


> 
> Sincerely
>     Sven
> 
> 

  reply	other threads:[~2026-07-10 13:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 16:14 [PATCH v3 0/4] media: rzg2l-cru: Fix DMA stride alignment Tommaso Merciai
2026-07-08 16:14 ` [PATCH v3 1/4] media: v4l2-common: Convert v4l2_fill_pixfmt_mp() to static inline wrapper Tommaso Merciai
2026-07-09  9:24   ` Jacopo Mondi
2026-07-08 16:14 ` [PATCH v3 2/4] media: v4l2-common: Add v4l2_fill_pixfmt_aligned() helper Tommaso Merciai
2026-07-09  9:35   ` Jacopo Mondi
2026-07-09 15:09     ` Tommaso Merciai
2026-07-10  8:36     ` Sven Püschel
2026-07-10  9:38       ` Jacopo Mondi
2026-07-10 11:54         ` Sven Püschel
2026-07-10 12:15           ` Jacopo Mondi
2026-07-10 12:26             ` Sven Püschel
2026-07-10 13:45               ` Tommaso Merciai [this message]
2026-07-10 13:50                 ` Sven Püschel
2026-07-08 16:14 ` [PATCH v3 3/4] media: v4l2-common: Add kernel-doc for v4l2_fill_pixfmt_mp_aligned() Tommaso Merciai
2026-07-09  9:51   ` Jacopo Mondi
2026-07-10  8:57     ` Sven Püschel
2026-07-10  9:56       ` Jacopo Mondi
2026-07-08 16:14 ` [PATCH v3 4/4] media: rzg2l-cru: Align bytesperline to hardware DMA stride requirement Tommaso Merciai
2026-07-09  9:19   ` Jacopo Mondi
2026-07-09 10:16     ` Tommaso Merciai

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=alD3lCxdoKkYDCsa@tom-desktop \
    --to=tommaso.merciai.xr@bp.renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=dan.scally+renesas@ideasonboard.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=isaac.scott@ideasonboard.com \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=nicolas.dufresne@collabora.com \
    --cc=paul@crapouillou.net \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=s.pueschel@pengutronix.de \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomm.merciai@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox