From 0a8cc882024c6c03c96e639ea827361e3be9c92e Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Thu, 21 Jan 2021 12:21:16 -0800 Subject: [PATCH] gallium: Map _DRI_IMAGE_FORMAT_NONE to NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- src/gallium/frontends/dri/dri_helpers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/frontends/dri/dri_helpers.c b/src/gallium/frontends/dri/dri_helpers.c index aea24208472..c73e442444c 100644 --- a/src/gallium/frontends/dri/dri_helpers.c +++ b/src/gallium/frontends/dri/dri_helpers.c @@ -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];