r600: Report multi-plane formats as unsupported
authorAndres Calderon Jaramillo <andrescj@chromium.org>
Sat, 15 Apr 2023 06:34:14 +0000 (06:34 +0000)
committerMarge Bot <emma+marge@anholt.net>
Mon, 17 Apr 2023 09:43:14 +0000 (09:43 +0000)
This is the analogous of
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9490 but for
r600.

Discoloration of NV12 video frames was observed in Chrome/ChromeOS and
the problem was tracked down to the fact that Mesa was following the
PIPE_FORMAT_R8_G8B8_420_UNORM/lower_yuv_external() path. The symptom is
that (for an unknown reason) the YUV-to-RGB conversion is using the
value of Y as the value of Y, U, and V. So, for example, if the input
value is YUV = (50, 120, 130), then what actually gets converted to RGB
is YUV = (50, 50, 50).

Considering that PIPE_FORMAT_R8_G8B8_420_UNORM was introduced for
freedreno
(https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6693) and it
is already being reported as unsupported for radeonsi, it's reasonable
to assume that GPUs targeted by r600 don't support this path either.

Note: I tested this patch with an AMD Palm device which follows the
evergreen_is_format_supported() path. I did not have access to a device
to test the r600_is_format_supported() path.

v2: Changed >= 2 to > 1.

Fixes: 826a10255f5 ("st/mesa: Add NV12 lowering to PIPE_FORMAT_R8_G8B8_420_UNORM")
Tested-by: Andres Calderon Jaramillo <andrescj@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22511>

src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_state.c

index faa9339..0db74e0 100644 (file)
@@ -254,6 +254,9 @@ bool evergreen_is_format_supported(struct pipe_screen *screen,
                return false;
        }
 
+       if (util_format_get_num_planes(format) > 1)
+               return false;
+
        if (MAX2(1, sample_count) != MAX2(1, storage_sample_count))
                return false;
 
index edbc0d3..a9673dd 100644 (file)
@@ -173,6 +173,9 @@ bool r600_is_format_supported(struct pipe_screen *screen,
                return false;
        }
 
+       if (util_format_get_num_planes(format) > 1)
+               return false;
+
        if (MAX2(1, sample_count) != MAX2(1, storage_sample_count))
                return false;