dri: Fix BGR format exclusion

The check we had for BGR vs. RGB formats was testing completely the
wrong thing. Fix it so we can restore the previous set of configs we
expose to the frontend, which also fixes surfaceless platform on s390x.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: ad0edea53a ("st/dri: Check format properties from format helpers")
Closes: mesa/mesa#11360
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29837>
This commit is contained in:
Daniel Stone
2024-06-21 11:24:31 +01:00
committed by Marge Bot
parent 8f2533c356
commit 5ca85d75c0

View File

@@ -386,17 +386,21 @@ dri_fill_in_modes(struct dri_screen *screen)
uint8_t msaa_modes[MSAA_VISUAL_MAX_SAMPLES];
/* Expose only BGRA ordering if the loader doesn't support RGBA ordering. */
if (!allow_rgba_ordering &&
util_format_get_component_shift(pipe_formats[f],
UTIL_FORMAT_COLORSPACE_RGB, 0)
if (!allow_rgba_ordering) {
unsigned sh_ax = util_format_get_component_shift(pipe_formats[f], UTIL_FORMAT_COLORSPACE_RGB, 3);
unsigned sh_b = util_format_get_component_shift(pipe_formats[f], UTIL_FORMAT_COLORSPACE_RGB, 2);
#if UTIL_ARCH_BIG_ENDIAN
>
unsigned sz_b = util_format_get_component_bits(pipe_formats[f], UTIL_FORMAT_COLORSPACE_RGB, 2);
if (sz_b + sh_b == sh_ax)
continue;
#else
<
unsigned sz_ax = util_format_get_component_bits(pipe_formats[f], UTIL_FORMAT_COLORSPACE_RGB, 3);
if (sz_ax + sh_ax == sh_b)
continue;
#endif
util_format_get_component_shift(pipe_formats[f],
UTIL_FORMAT_COLORSPACE_RGB, 2))
continue;
}
if (!allow_rgb10 &&
util_format_get_component_bits(pipe_formats[f],