From e47b4ba62981f070e47be3869e0ac486df4b9498 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Fri, 1 Oct 2021 14:14:00 -0700 Subject: [PATCH] util/format: Add an RGB planar format for YV12, like we have for NV12. Turnip will use this for mapping the to the corresponding hardware format, and we could also extend mesa/st to avoid adding extra samplers for external image sampling of YV12 on freedreno. Reviewed-by: Rob Clark Part-of: --- src/gallium/include/pipe/p_format.h | 1 + src/util/format/u_format.csv | 3 ++- src/util/format/u_format_table.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 1f300a018da..a697cd5edc1 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -504,6 +504,7 @@ enum pipe_format { PIPE_FORMAT_XYUV, PIPE_FORMAT_R8_G8B8_420_UNORM, + PIPE_FORMAT_R8_G8_B8_420_UNORM, PIPE_FORMAT_B8G8R8X8_SNORM, PIPE_FORMAT_B8G8R8X8_UINT, diff --git a/src/util/format/u_format.csv b/src/util/format/u_format.csv index 58d56a63ca9..8468f33bef2 100644 --- a/src/util/format/u_format.csv +++ b/src/util/format/u_format.csv @@ -397,9 +397,10 @@ PIPE_FORMAT_IYUV , planar3, 1, 1, 1, , , , , xy PIPE_FORMAT_NV12 , planar2, 1, 1, 1, , , , , xyzw, yuv PIPE_FORMAT_NV21 , planar2, 1, 1, 1, , , , , xyzw, yuv -# RGB version of NV12 for hardware that supports sampling from +# RGB version of NV12 and YV12 for hardware that supports sampling from # multiplane textures but needs color-space conversion in the shader. PIPE_FORMAT_R8_G8B8_420_UNORM , planar2, 1, 1, 1, un8, , , , xyzw, rgb +PIPE_FORMAT_R8_G8_B8_420_UNORM , planar3, 1, 1, 1, un8, , , , xyzw, rgb PIPE_FORMAT_Y8_U8_V8_422_UNORM , planar3, 1, 1, 1, , , , , xyzw, yuv PIPE_FORMAT_Y8_U8V8_422_UNORM , planar2, 1, 1, 1, , , , , xyzw, yuv diff --git a/src/util/format/u_format_table.py b/src/util/format/u_format_table.py index 10659d5c4b1..8e7691d0675 100644 --- a/src/util/format/u_format_table.py +++ b/src/util/format/u_format_table.py @@ -109,6 +109,7 @@ def has_access(format): 'y16_u16v16_422_unorm', 'y16_u16_v16_444_unorm', 'r8_g8b8_420_unorm', + 'r8_g8_b8_420_unorm', ] if format.short_name() in noaccess_formats: return False