Mesa (master): gallium: Map _DRI_IMAGE_FORMAT_NONE to NULL

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 26 22:21:40 UTC 2021


Module: Mesa
Branch: master
Commit: 0a8cc882024c6c03c96e639ea827361e3be9c92e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a8cc882024c6c03c96e639ea827361e3be9c92e

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Thu Jan 21 12:21:16 2021 -0800

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 at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8663>

---

 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];



More information about the mesa-commit mailing list