include/uapi/drm/drm_fourcc.h | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
From: "Eric R. Smith" <eric.smith@collabora.com>
MediaTek (MTK) uses some unique tiled memory formats
for video decoding. Add these to the uapi drm_fourcc.h
so that we can use them in Mesa, GStreamer, and other
tools/libraries.
v2:
- Classify the modifier bits into categories and provide
room for expansion (Daniel S.)
Signed-off-by: Eric R. Smith <eric.smith@collabora.com>
---
include/uapi/drm/drm_fourcc.h | 41 +++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 70f3b00b0681..768053a44295 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -421,6 +421,7 @@ extern "C" {
#define DRM_FORMAT_MOD_VENDOR_ARM 0x08
#define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09
#define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a
+#define DRM_FORMAT_MOD_VENDOR_MTK 0x0b
/* add more to the end as needed */
@@ -1453,6 +1454,46 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
*/
#define AMLOGIC_FBC_OPTION_MEM_SAVING (1ULL << 0)
+/* MediaTek modifiers
+ * Bits Parameter Notes
+ * ----- ------------------------ ---------------------------------------------
+ * 7: 0 TILE LAYOUT Values are MTK_FMT_MOD_TILE_*
+ * 15: 8 COMPRESSION Values are MTK_FMT_MOD_COMPRESS_*
+ * 23:16 10 BIT LAYOUT Values are MTK_FMT_MOD_10BIT_LAYOUT_*
+ *
+ */
+
+#define DRM_FORMAT_MOD_MTK(__flags) fourcc_mod_code(MTK, __flags)
+
+/*
+ * MediaTek Tiled Modifier
+ * The lowest 8 bits of the modifier is used to specify the tiling
+ * layout. Only the 16L_32S tiling is used for now, but we define an
+ * "untiled" version and leave room for future expansion.
+ */
+#define MTK_FMT_MOD_TILE_MASK 0xf
+#define MTK_FMT_MOD_TILE_NONE 0x0
+#define MTK_FMT_MOD_TILE_16L32S 0x1
+
+/*
+ * Bits 8-15 specify compression options
+ */
+#define MTK_FMT_MOD_COMPRESS_MASK (0xf << 8)
+#define MTK_FMT_MOD_COMPRESS_NONE (0x0 << 8)
+#define MTK_FMT_MOD_COMPRESS_V1 (0x1 << 8)
+
+/*
+ * Bits 16-23 specify how the bits of 10 bit formats are
+ * stored out in memory
+ */
+#define MTK_FMT_MOD_10BIT_LAYOUT_MASK (0xf << 16)
+#define MTK_FMT_MOD_10BIT_LAYOUT_PACKED (0x0 << 16)
+#define MTK_FMT_MOD_10BIT_LAYOUT_LSBTILED (0x1 << 16)
+#define MTK_FMT_MOD_10BIT_LAYOUT_LSBRASTER (0x2 << 16)
+
+/* alias for the most common tiling format */
+#define DRM_FORMAT_MOD_MTK_16L_32S_TILE DRM_FORMAT_MOD_MTK(MTK_FMT_MOD_TILE_16L32S)
+
/*
* AMD modifiers
*
base-commit: 3a8e60188b55f7aff76c1d3707ebcbf98e68cc13
--
2.39.5
Hi Eric, On Thu, 19 Dec 2024 at 17:49, <eric.smith@collabora.com> wrote: > MediaTek (MTK) uses some unique tiled memory formats > for video decoding. Add these to the uapi drm_fourcc.h > so that we can use them in Mesa, GStreamer, and other > tools/libraries. Thanks, this is: Reviewed-by: Daniel Stone <daniels@collabora.com> I can push into drm-misc as well, but give me a bit to get dim set up again. Cheers, Daniel
On Thu, 2025-01-09 at 13:14 +0000, Daniel Stone wrote: > Hi Eric, > > On Thu, 19 Dec 2024 at 17:49, <eric.smith@collabora.com> wrote: > > MediaTek (MTK) uses some unique tiled memory formats > > for video decoding. Add these to the uapi drm_fourcc.h > > so that we can use them in Mesa, GStreamer, and other > > tools/libraries. > > Thanks, this is: > Reviewed-by: Daniel Stone <daniels@collabora.com> > > I can push into drm-misc as well, but give me a bit to get dim set up > again. > This is not yet in drm-misc, my understanding from back-channels is that we're waiting for some sort of ack from MTK. Do we have any timeline for this, so this can land at some point soonish?
Heya, On Fri, 24 Jan 2025 at 08:42, Erik Faye-Lund <erik.faye-lund@collabora.com> wrote: > On Thu, 2025-01-09 at 13:14 +0000, Daniel Stone wrote: > > Thanks, this is: > > Reviewed-by: Daniel Stone <daniels@collabora.com> > > > > I can push into drm-misc as well, but give me a bit to get dim set up > > again. > > This is not yet in drm-misc, my understanding from back-channels is > that we're waiting for some sort of ack from MTK. Do we have any > timeline for this, so this can land at some point soonish? Well, given that I said to you this morning that I should probably push it, before you told me you'd just sent an email to prod, now's probably the time. To gitlab.freedesktop.org:drm/misc/kernel.git 798047e63ac9..3ab334814dc7 drm-misc-next -> drm-misc-next Cheers, Daniel
© 2016 - 2025 Red Hat, Inc.