st/dri: Check format properties from format helpers

When populating DRI configs, driconf allows us to exclude
10bpc/RGBA/float configs. Rather than having a hardcoded set of formats
which satisfy those properties, just check the actual format
definitions.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27709>
This commit is contained in:
Daniel Stone 2023-07-28 14:37:47 +01:00 committed by Marge Bot
parent 4025845137
commit ad0edea53a

View file

@ -386,26 +386,27 @@ dri_fill_in_modes(struct dri_screen *screen)
/* Expose only BGRA ordering if the loader doesn't support RGBA ordering. */ /* Expose only BGRA ordering if the loader doesn't support RGBA ordering. */
if (!allow_rgba_ordering && if (!allow_rgba_ordering &&
(pipe_formats[f] == PIPE_FORMAT_RGBA8888_UNORM || util_format_get_component_shift(pipe_formats[f],
pipe_formats[f] == PIPE_FORMAT_RGBX8888_UNORM || UTIL_FORMAT_COLORSPACE_RGB, 0)
pipe_formats[f] == PIPE_FORMAT_RGBA8888_SRGB || #if UTIL_ARCH_BIG_ENDIAN
pipe_formats[f] == PIPE_FORMAT_RGBX8888_SRGB || >
pipe_formats[f] == PIPE_FORMAT_R5G5B5A1_UNORM || #else
pipe_formats[f] == PIPE_FORMAT_R5G5B5X1_UNORM || <
pipe_formats[f] == PIPE_FORMAT_R4G4B4A4_UNORM || #endif
pipe_formats[f] == PIPE_FORMAT_R4G4B4X4_UNORM)) util_format_get_component_shift(pipe_formats[f],
UTIL_FORMAT_COLORSPACE_RGB, 2))
continue; continue;
if (!allow_rgb10 && if (!allow_rgb10 &&
(pipe_formats[f] == PIPE_FORMAT_B10G10R10A2_UNORM || util_format_get_component_bits(pipe_formats[f],
pipe_formats[f] == PIPE_FORMAT_B10G10R10X2_UNORM || UTIL_FORMAT_COLORSPACE_RGB, 0) == 10 &&
pipe_formats[f] == PIPE_FORMAT_R10G10B10A2_UNORM || util_format_get_component_bits(pipe_formats[f],
pipe_formats[f] == PIPE_FORMAT_R10G10B10X2_UNORM)) UTIL_FORMAT_COLORSPACE_RGB, 1) == 10 &&
util_format_get_component_bits(pipe_formats[f],
UTIL_FORMAT_COLORSPACE_RGB, 2) == 10)
continue; continue;
if (!allow_fp16 && if (!allow_fp16 && util_format_is_float(pipe_formats[f]))
(pipe_formats[f] == PIPE_FORMAT_R16G16B16A16_FLOAT ||
pipe_formats[f] == PIPE_FORMAT_R16G16B16X16_FLOAT))
continue; continue;
if (!p_screen->is_format_supported(p_screen, pipe_formats[f], if (!p_screen->is_format_supported(p_screen, pipe_formats[f],