gallium: Map _DRI_IMAGE_FORMAT_NONE to NULL

Many entries in the dri2_format_table have _DRI_IMAGE_FORMAT_NONE as the
dri_format. Make the result of dri2_get_mapping_by_format a tad more
well-defined by returning NULL when this format is passed into it.

Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8663>
This commit is contained in:
Nanley Chery 2021-01-21 12:21:16 -08:00 committed by Marge Bot
parent 6c9aca951c
commit 0a8cc88202
1 changed files with 3 additions and 0 deletions

View File

@ -560,6 +560,9 @@ dri2_get_mapping_by_fourcc(int fourcc)
const struct dri2_format_mapping *
dri2_get_mapping_by_format(int format)
{
if (format == __DRI_IMAGE_FORMAT_NONE)
return NULL;
for (unsigned i = 0; i < ARRAY_SIZE(dri2_format_table); i++) {
if (dri2_format_table[i].dri_format == format)
return &dri2_format_table[i];