util/format: Add new 10-bit P010 RGB/planar formats

Introduce three 10-bit formats: X6R10_UNORM, X6R10X6G10_UNORM, and X6G10_X6B10X6R10_420_UNORM.
These formats allocate 10 bits for each color channel with 6 bits of padding to align with Vulkan's P010
and related planar formats.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30821>
This commit is contained in:
Valentine Burley
2024-08-23 08:16:57 +00:00
committed by Marge Bot
parent ad13268c72
commit 1134ad8799
3 changed files with 29 additions and 4 deletions
+24 -4
View File
@@ -1902,8 +1902,8 @@
swizzles: [X, 0, 0, 1]
# RGB version of NV12 and YV12 for hardware that supports sampling from
# multiplane textures but needs color-space conversion in the shader.
# RGB versions of NV12, YV12, and P010 for hardware that supports sampling
# from multiplane textures but needs color-space conversion in the shader.
- name: R8_G8B8_420_UNORM
layout: planar2
colorspace: RGB
@@ -1946,9 +1946,15 @@
block: {width: 1, height: 1, depth: 1}
channels: [UN8]
swizzles: [X, Y, Z, W]
- name: X6G10_X6B10X6R10_420_UNORM
layout: planar2
colorspace: RGB
block: {width: 1, height: 1, depth: 1}
channels: [X6, UN10]
swizzles: [X, Y, Z, W]
# While most of Mesa uses R8 for Y, U, and V planes, freedreno requires distinguishing
# between tiled Y8 data and tiled R8 data.
# While most of Mesa uses R8 for Y, U, and V planes, freedreno requires
# distinguishing between tiled Y8 data and tiled R8 data.
- name: Y8_UNORM
layout: other
colorspace: YUV
@@ -1956,6 +1962,20 @@
channels: [UN8]
swizzles: [X, 0, 0, 1]
# Formats for plane 0/plane 1 of P010
- name: X6R10_UNORM
layout: plain
colorspace: RGB
block: {width: 1, height: 1, depth: 1}
channels: [X6, UN10]
swizzles: [Y, 0, 0, 1]
- name: X6R10X6G10_UNORM
layout: plain
colorspace: RGB
block: {width: 1, height: 1, depth: 1}
channels: [X6, UN10, X6, UN10]
swizzles: [Y, W, 0, 1]
- name: Y8_U8_V8_422_UNORM
layout: planar3
colorspace: YUV
+1
View File
@@ -105,6 +105,7 @@ def has_access(format):
'g8r8_g8b8_unorm',
'g8b8_g8r8_unorm',
'b8g8_r8g8_unorm',
'x6g10_x6b10x6r10_420_unorm',
'y8_400_unorm',
'y8_u8_v8_422_unorm',
'y8_u8v8_422_unorm',
+4
View File
@@ -237,6 +237,10 @@ enum pipe_format {
PIPE_FORMAT_R8G8_B8G8_UNORM,
PIPE_FORMAT_G8R8_G8B8_UNORM,
PIPE_FORMAT_X6G10_X6B10X6R10_420_UNORM,
PIPE_FORMAT_X6R10_UNORM,
PIPE_FORMAT_X6R10X6G10_UNORM,
/* mixed formats */
PIPE_FORMAT_R8SG8SB8UX8U_NORM,