From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
To: Rob Clark <robin.clark@oss.qualcomm.com>,
Dmitry Baryshkov <lumag@kernel.org>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jesszhan0024@gmail.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Bryan O'Donoghue <bod@kernel.org>,
Stanimir Varbanov <stanimir.varbanov@linaro.org>
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Jordan Crouse <jordan@cosmicpenguin.net>,
linux-media@vger.kernel.org,
Nicolas Dufresne <nicolas.dufresne@collabora.com>,
Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
Robert Mader <robert.mader@collabora.com>,
Neil Armstrong <neil.armstrong@linaro.org>
Subject: [PATCH 5/7] media: docs: pixfmt-reserved: describe the QC08C and QC10C layout
Date: Wed, 04 Nov 2026 18:36:09 +0200 [thread overview]
Message-ID: <20261104-ubwc-format-docs-v1-5-389044012b4e@oss.qualcomm.com> (raw)
In-Reply-To: <20261104-ubwc-format-docs-v1-0-389044012b4e@oss.qualcomm.com>
QC08C and QC10C are documented as opaque formats with four planes, or
eight for interlaced video. Neither is true for the drivers: Venus and
Iris use a single memory plane, nothing produces interlaced buffers, and
the display controller and the GPU import these buffers, so the layout
is part of the contract between them.
Describe the sections of the buffer, their order, strides, line counts
and alignment. The compressed contents stay opaque, they depend on the
UBWC configuration of the platform.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
.../userspace-api/media/v4l/pixfmt-reserved.rst | 63 ++++++++++++++++++----
1 file changed, 54 insertions(+), 9 deletions(-)
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
index 1cf6c59f4bc4..3ff6499970e1 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
@@ -245,20 +245,65 @@ please make a proposal on the linux-media mailing list.
- ``V4L2_PIX_FMT_QC08C``
- 'QC08C'
- Compressed Macro-tile 8-Bit YUV420 format used by Qualcomm platforms.
- It is an opaque intermediate format. The used compression is lossless
- and it is used by various multimedia hardware blocks like GPU, display
- controllers, ISP and video accelerators.
- It contains four planes for progressive video and eight planes for
- interlaced video.
+ This is NV12 compressed with Universal Bandwidth Compression (UBWC),
+ a lossless compression used by the video accelerators, GPU, display
+ controller and camera. The compressed contents depend on the UBWC
+ version and memory configuration of the platform and are only meant
+ to be accessed by the hardware; the layout of the buffer is defined
+ below.
+
+ The format uses a single memory plane that holds four sections in
+ this order: Y metadata, Y data, CbCr metadata and CbCr data. Each
+ section starts at the beginning of the previous section plus its
+ size, which is rounded up to a multiple of 4096 bytes. The metadata
+ holds one byte for each tile of the data. ``bytesperline`` is the
+ stride of the Y and CbCr data. For a ``width`` x ``height`` buffer,
+ with the CbCr plane being ``DIV_ROUND_UP(width, 2)`` x
+ ``DIV_ROUND_UP(height, 2)`` samples:
+
+ - Y data: stride ``ALIGN(width, 128)`` bytes,
+ ``ALIGN(height, 32)`` lines.
+ - CbCr data: stride ``ALIGN(width, 128)`` bytes,
+ ``ALIGN(DIV_ROUND_UP(height, 2), 32)`` lines.
+ - Y metadata: 32x8 pixel tiles, stride
+ ``ALIGN(DIV_ROUND_UP(width, 32), 64)`` bytes,
+ ``ALIGN(DIV_ROUND_UP(height, 8), 16)`` lines.
+ - CbCr metadata: 16x8 sample tiles, stride
+ ``ALIGN(DIV_ROUND_UP(DIV_ROUND_UP(width, 2), 16), 64)`` bytes,
+ ``ALIGN(DIV_ROUND_UP(DIV_ROUND_UP(height, 2), 8), 16)`` lines.
+
+ ``sizeimage`` may be larger than the sum of the sections.
+ The same layout is described by ``DRM_FORMAT_NV12`` with the
+ ``DRM_FORMAT_MOD_QCOM_COMPRESSED`` modifier, with both DRM planes
+ referring to the same buffer and the Y metadata at ``offsets[0]``.
* .. _V4L2-PIX-FMT-QC10C:
- ``V4L2_PIX_FMT_QC10C``
- 'QC10C'
- Compressed Macro-tile 10-Bit YUV420 format used by Qualcomm platforms.
- It is an opaque intermediate format. The used compression is lossless
- and it is used by various multimedia hardware blocks like GPU, display
- controllers, ISP and video accelerators.
- It contains four planes for progressive video.
+ This is the TP10 format, YUV420 with three 10-bit samples tightly
+ packed in each 32-bit word, in both the Y plane and the interleaved
+ CbCr plane, compressed with UBWC as described for
+ ``V4L2_PIX_FMT_QC08C``. Each 192 samples of a line take 256 bytes.
+
+ The format uses a single memory plane with the same four sections as
+ ``V4L2_PIX_FMT_QC08C``. ``bytesperline`` is the stride of the Y and
+ CbCr data. For a ``width`` x ``height`` buffer:
+
+ - Y data: stride ``DIV_ROUND_UP(width, 192) * 256`` bytes,
+ ``ALIGN(height, 16)`` lines.
+ - CbCr data: stride ``DIV_ROUND_UP(width, 192) * 256`` bytes,
+ ``ALIGN(DIV_ROUND_UP(height, 2), 16)`` lines.
+ - Y metadata: 48x4 pixel tiles, stride
+ ``ALIGN(DIV_ROUND_UP(width, 48), 64)`` bytes,
+ ``ALIGN(DIV_ROUND_UP(height, 4), 16)`` lines.
+ - CbCr metadata: 24x4 sample tiles, stride
+ ``ALIGN(DIV_ROUND_UP(DIV_ROUND_UP(width, 2), 24), 64)`` bytes,
+ ``ALIGN(DIV_ROUND_UP(DIV_ROUND_UP(height, 2), 4), 16)`` lines.
+
+ ``sizeimage`` may be larger than the sum of the sections. There is
+ no DRM equivalent: ``DRM_FORMAT_P010`` with the
+ ``DRM_FORMAT_MOD_QCOM_COMPRESSED`` modifier stores 16-bit samples.
* .. _V4L2-PIX-FMT-AJPG:
- ``V4L2_PIX_FMT_AJPG``
--
2.47.3
next prev parent reply other threads:[~2026-11-04 16:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 16:36 [PATCH 0/7] drm/msm, media: define the UBWC buffer layout Dmitry Baryshkov
2026-11-04 16:36 ` [PATCH 1/7] drm/msm/dpu: fix the comment on the RGB UBWC plane count Dmitry Baryshkov
2026-11-04 16:36 ` [PATCH 2/7] drm/msm: move the UBWC plane size calculation out of DPU Dmitry Baryshkov
2026-11-04 16:36 ` [PATCH 3/7] drm/msm: check UBWC framebuffers against their layout Dmitry Baryshkov
2026-11-04 16:36 ` [PATCH 4/7] drm/fourcc: describe the Qualcomm UBWC layout Dmitry Baryshkov
2026-11-04 16:36 ` Dmitry Baryshkov [this message]
2026-11-04 16:36 ` [PATCH 6/7] media: venus: report the QC10C data stride Dmitry Baryshkov
2026-11-04 16:36 ` [PATCH 7/7] media: qcom: iris: describe QC10C as TP10 Dmitry Baryshkov
2026-11-04 18:59 ` Robert Mader
2026-11-04 22:11 ` Rob Clark
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=20261104-ubwc-format-docs-v1-5-389044012b4e@oss.qualcomm.com \
--to=dmitry.baryshkov@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=bod@kernel.org \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=jordan@cosmicpenguin.net \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marijn.suijten@somainline.org \
--cc=mchehab@kernel.org \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=nicolas.dufresne@collabora.com \
--cc=robert.mader@collabora.com \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
--cc=stanimir.varbanov@linaro.org \
--cc=tzimmermann@suse.de \
--cc=vikash.garodia@oss.qualcomm.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
all inboxes | Powered by JetHome®