[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260128143120.GA3201622@killaraus>
Date: Wed, 28 Jan 2026 16:31:20 +0200
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
Cc: Vishal Sagar <vishal.sagar@....com>,
Anatoliy Klymenko <anatoliy.klymenko@....com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Michal Simek <michal.simek@....com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>,
Pekka Paalanen <ppaalanen@...il.com>,
Dmitry Baryshkov <lumag@...nel.org>
Subject: Re: [PATCH v7 02/11] drm/fourcc: Add DRM_FORMAT_XV15/XV20
On Wed, Jan 28, 2026 at 03:53:21PM +0200, Tomi Valkeinen wrote:
> On 28/01/2026 14:21, Laurent Pinchart wrote:
> > On Mon, Dec 01, 2025 at 02:18:44PM +0200, Tomi Valkeinen wrote:
> >> Add two new pixel formats:
> >>
> >> DRM_FORMAT_XV15 ("XV15")
> >> DRM_FORMAT_XV20 ("XV20")
> >>
> >> The formats are 2 plane 10 bit per component YCbCr, with the XV15 2x2
> >> subsampled whereas XV20 is 2x1 subsampled.
> >>
> >> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> >> Reviewed-by: Vishal Sagar <vishal.sagar@....com>
> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
> >> ---
> >> drivers/gpu/drm/drm_fourcc.c | 6 ++++++
> >> include/uapi/drm/drm_fourcc.h | 8 ++++++++
> >> 2 files changed, 14 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> >> index e662aea9d105..b22ef86428a1 100644
> >> --- a/drivers/gpu/drm/drm_fourcc.c
> >> +++ b/drivers/gpu/drm/drm_fourcc.c
> >> @@ -381,6 +381,12 @@ const struct drm_format_info *__drm_format_info(u32 format)
> >> { .format = DRM_FORMAT_S416, .depth = 0, .num_planes = 3,
> >> .char_per_block = { 2, 2, 2 }, .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 },
> >> .hsub = 1, .vsub = 1, .is_yuv = true},
> >> + { .format = DRM_FORMAT_XV15, .depth = 0, .num_planes = 2,
> >> + .char_per_block = { 4, 8, 0 }, .block_w = { 3, 3, 0 }, .block_h = { 1, 1, 0 },
> >> + .hsub = 2, .vsub = 2, .is_yuv = true },
> >
> > Given the horizontal subsampling, don't we have 6 pixels in 8 bytes ?
>
> No, the hsub is applied first.
>
> If you look at framebuffer_check() and the called functions, the
> calculations for the min_pitch for a 1920 wide XV15 buffer for the
> second plane is:
>
> width = frame_width / hsub
> min_pitch = width * char_per_block[plane] / block_w[plane]
>
> So:
>
> width = 1920 / 2 = 960
> min_pitch = 960 * 8 / 3 = 2560
Indeed. I was looking at drm_format_info_min_pitch() and missed that it
was supposed to be called with the subsampled with. The argument is
documented as
* @buffer_width: buffer width in pixels
which is quite ambiguous. The char_per_block documentation also does not
mention subsampling, adding to the confusion. This should be fixed, but
as far as this patch is concerned,
Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists