From: Emil Velikov <emil.veli...@collabora.com>

Will allow us to reuse the function for optional extensions and fold a
bit of code.

Cc: Rob Clark <robdcl...@gmail.com>
Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
---
Rob, you were thinking about a similar thing on the GBM front, correct ?

Low hanging fruit for anyone: move this, amongst others, to loader_dri.c
and reuse it in gbm and glx.
---
 src/egl/drivers/dri2/egl_dri2.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 344a7f3..f41f9a9 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -354,6 +354,7 @@ struct dri2_extension_match {
    const char *name;
    int version;
    int offset;
+   bool optional;
 };
 
 static struct dri2_extension_match dri3_driver_extensions[] = {
@@ -410,9 +411,14 @@ dri2_bind_extensions(struct dri2_egl_display *dri2_dpy,
    for (j = 0; matches[j].name; j++) {
       field = ((char *) dri2_dpy + matches[j].offset);
       if (*(const __DRIextension **) field == NULL) {
-         _eglLog(_EGL_WARNING, "did not find extension %s version %d",
-                 matches[j].name, matches[j].version);
-         ret = EGL_FALSE;
+         if (matches[j].optional) {
+            _eglLog(_EGL_DEBUG, "did not find optional extension %s version 
%d",
+                    matches[j].name, matches[j].version);
+         } else {
+            _eglLog(_EGL_WARNING, "did not find extension %s version %d",
+                    matches[j].name, matches[j].version);
+            ret = EGL_FALSE;
+         }
       }
    }
 
-- 
2.9.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to