util/format: Add G8B8_G8R8_422_UNORM and B8G8_R8G8_422_UNORM formats

These actually match the Vulkan format enums for single-plane YCbCr
formats, unlike the other PIPE_FORMAT_* enums which put luminance in the
red channel.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24619>
This commit is contained in:
Mohamed Ahmed 2023-08-10 19:37:01 +03:00 committed by Marge Bot
parent 9a6ec6cdd6
commit 0c03d44093
4 changed files with 20 additions and 0 deletions

View file

@ -192,6 +192,8 @@ PIPE_FORMAT_G8R8_B8R8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8
PIPE_FORMAT_R8G8_R8B8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , zyx1, rgb
PIPE_FORMAT_B8R8_G8R8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , yxz1, rgb
PIPE_FORMAT_R8B8_R8G8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , yxz1, rgb
PIPE_FORMAT_G8B8_G8R8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, rgb
PIPE_FORMAT_B8G8_R8G8_UNORM , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, rgb
# some special formats not fitting anywhere else
PIPE_FORMAT_R11G11B10_FLOAT , other, 1, 1, 1, f11 , f11 , f10 , , xyz1, rgb

Can't render this file because it contains an unexpected character in line 8 and column 3.

View file

@ -104,6 +104,8 @@ def has_access(format):
'g8r8_b8r8_unorm',
'b8r8_g8r8_unorm',
'g8r8_g8b8_unorm',
'g8b8_g8r8_unorm',
'b8g8_r8g8_unorm',
'y8_400_unorm',
'y8_u8_v8_422_unorm',
'y8_u8v8_422_unorm',

View file

@ -432,6 +432,20 @@ util_format_test_cases[] =
{PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_2x1(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0)},
{PIPE_FORMAT_G8R8_G8B8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
{PIPE_FORMAT_G8B8_G8R8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
{PIPE_FORMAT_G8B8_G8R8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
{PIPE_FORMAT_G8B8_G8R8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_2x1(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0)},
{PIPE_FORMAT_G8B8_G8R8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0)},
{PIPE_FORMAT_G8B8_G8R8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_2x1(1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0)},
{PIPE_FORMAT_G8B8_G8R8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
{PIPE_FORMAT_B8G8_R8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
{PIPE_FORMAT_B8G8_R8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_2x1(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0)},
{PIPE_FORMAT_B8G8_R8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_2x1(0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)},
{PIPE_FORMAT_B8G8_R8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_2x1(1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0)},
{PIPE_FORMAT_B8G8_R8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_2x1(0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0)},
{PIPE_FORMAT_B8G8_R8G8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_2x1(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)},
/*
* TODO: Exercise the UV channels as well.
*/

View file

@ -368,6 +368,8 @@ enum pipe_format {
PIPE_FORMAT_R8B8_R8G8_UNORM,
PIPE_FORMAT_G8R8_B8R8_UNORM,
PIPE_FORMAT_B8R8_G8R8_UNORM,
PIPE_FORMAT_G8B8_G8R8_UNORM,
PIPE_FORMAT_B8G8_R8G8_UNORM,
PIPE_FORMAT_R8G8B8X8_SNORM,
PIPE_FORMAT_R8G8B8X8_SRGB,