public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: eric.smith@collabora.com
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: kernel@collabora.com, "Eric R. Smith" <eric.smith@collabora.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm: add modifiers for MediaTek tiled formats
Date: Fri, 13 Dec 2024 14:47:05 -0400	[thread overview]
Message-ID: <20241213184705.317138-1-eric.smith@collabora.com> (raw)

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.

Signed-off-by: Eric R. Smith <eric.smith@collabora.com>
---
 include/uapi/drm/drm_fourcc.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 70f3b00b0681..22a27cdd6484 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,36 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
  */
 #define AMLOGIC_FBC_OPTION_MEM_SAVING		(1ULL << 0)
 
+/* MediaTek layouts */
+
+/*
+ * MediaTek Tiled Modifier
+ * This is a tiled layout using tiles of 16x32 pixels in a row-major layout.
+ * For chroma planes this becomes 16x16 tiles.
+ */
+#define DRM_FORMAT_MOD_MTK_16L_32S_TILE  fourcc_mod_code(MTK, (1ULL << 0))
+
+/*
+ * MediaTek Compressed Modifier
+ * Indicates the planes are compressed.
+ * Implementation may be platform and base-format specific.
+ */
+#define DRM_FORMAT_MOD_MTK_COMPRESSED  fourcc_mod_code(MTK, (1ULL << 1))
+
+/*
+ * MediaTek 10-bit Modifier
+ * Indicates that the 2 LSBs of the 10 bit pixels are stored
+ * separately and tiled.
+ */
+#define DRM_FORMAT_MOD_MTK_LSBTILED    fourcc_mod_code(MTK, (1ULL << 2))
+
+/*
+ * MediaTek 10-bit Modifier
+ * Indicates that the 2 LSBs of 10 bit pixels are stored
+ * separately in raster order.
+ */
+#define DRM_FORMAT_MOD_MTK_LSBRASTER   fourcc_mod_code(MTK, (1ULL << 3))
+
 /*
  * AMD modifiers
  *

base-commit: 3a8e60188b55f7aff76c1d3707ebcbf98e68cc13
-- 
2.39.5


             reply	other threads:[~2024-12-13 18:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13 18:47 eric.smith [this message]
2024-12-18 14:33 ` [PATCH] drm: add modifiers for MediaTek tiled formats Daniel Stone
2024-12-19  0:20   ` Eric Smith
2024-12-19  9:18     ` Daniel Stone

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=20241213184705.317138-1-eric.smith@collabora.com \
    --to=eric.smith@collabora.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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