[Mesa-dev] [PATCH 23/30] egl/dri2: add support for optional extensions in dri2_bind_extensions()

Emil Velikov emil.l.velikov at gmail.com
Thu Aug 25 16:18:45 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

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

Cc: Rob Clark <robdclark at gmail.com>
Signed-off-by: Emil Velikov <emil.velikov at 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



More information about the mesa-dev mailing list