util/format: 8-bit interleaved YUV formats are UNORM
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Thu, 10 Aug 2023 22:05:07 +0000 (17:05 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 14 Aug 2023 23:44:19 +0000 (23:44 +0000)
Without this, gallivm doesn't know what to do with the result data of a
texture fetch.  We have a bunch of gallivm code to handle these but, as
far as I can tell, none of it works properly without channel types.  The
YUYV texturing helpers all consume a 32-bit packed value, unpack it,
shuffle things as needed, and then re-pack into a 32-bit RGBA value,
trusting later code to unpack that as 8-bit UNORM.  For the raw formats,
this unpacking never happens.

What saves us is that I also don't think any of this code is ever used.
LLVMpipe supports the actual YUYV formats and we don't use the gallium
lowering pass which lowers to the raw formats.

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>

src/util/format/u_format.csv

index fca8110..c47ec0c 100644 (file)
@@ -186,12 +186,12 @@ PIPE_FORMAT_AYUV                    , other, 4, 4, 1, un8 ,     ,     ,     , xy
 PIPE_FORMAT_XYUV                    , other, 4, 4, 1, un8 ,     ,     ,     , xyz1, yuv
 
 # same subsampling but with rgb channels
-PIPE_FORMAT_R8G8_B8G8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , xyz1, rgb
-PIPE_FORMAT_G8R8_G8B8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , xyz1, rgb
-PIPE_FORMAT_G8R8_B8R8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , zyx1, rgb
-PIPE_FORMAT_R8G8_R8B8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , zyx1, rgb
-PIPE_FORMAT_B8R8_G8R8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , yxz1, rgb
-PIPE_FORMAT_R8B8_R8G8_UNORM         , subsampled, 2, 1, 1, x32 ,     ,     ,     , yxz1, rgb
+PIPE_FORMAT_R8G8_B8G8_UNORM         , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, rgb
+PIPE_FORMAT_G8R8_G8B8_UNORM         , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , xyz1, rgb
+PIPE_FORMAT_G8R8_B8R8_UNORM         , subsampled, 2, 1, 1, un8 , un8 , un8 , un8 , zyx1, rgb
+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
 
 # some special formats not fitting anywhere else
 PIPE_FORMAT_R11G11B10_FLOAT         , other,     1, 1, 1, f11 , f11 , f10 ,     , xyz1, rgb