Re: [PATCH] drm: add modifiers for MediaTek tiled formats
From: Daniel Stone
Date: Wed Dec 18 2024 - 09:34:51 EST
Hi Eric,
On Fri, 13 Dec 2024 at 18:47, <eric.smith@xxxxxxxxxxxxx> 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 for pushing these upstream!
> +/* 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))
I think this probably wants to be something like the tiling mode
defined in AMD/Arm modifiers, i.e. reserve a few bits in the range to
select the tile size, rather than using a single bit here.
> +/*
> + * 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))
Ditto for compression.
> +/*
> + * 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))
Ditto for 10bpc packing.
So this would ultimately look something like:
mod = (DRM_FORMAT_MOD_MTK_TILE_SIZE(16L32S) |
DRM_FORMAT_MOD_MTK_COMPRESSION(V1) |
DRM_FORMAT_MOD_MTK_10BPC_PACK(RASTER))
Cheers,
Daniel