summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-09-24 11:05:22 -0700
committerEric Anholt <[email protected]>2013-10-24 14:04:20 -0700
commita64bb7553a9eb2f8ff57198b346475e9d652fda7 (patch)
tree94c117dd56944f498e37c165bff24cde8c986cbb /src/egl/drivers
parentfcb57a8210e819cc14a39c79f23530eb22296da0 (diff)
egl: Add an optional function call for getting the DRI driver interface.
v2: Fix asprintf error checking. Reviewed-by: Matt Turner <[email protected]> (v1) Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/drivers')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index b29eb1c1cbf..c2576846380 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -367,8 +367,10 @@ static const __DRIextension **
dri2_open_driver(_EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy = disp->DriverData;
- const __DRIextension **extensions;
+ const __DRIextension **extensions = NULL;
char path[PATH_MAX], *search_paths, *p, *next, *end;
+ char *get_extensions_name;
+ const __DRIextension **(*get_extensions)(void);
search_paths = NULL;
if (geteuid() == getuid()) {
@@ -409,7 +411,21 @@ dri2_open_driver(_EGLDisplay *disp)
}
_eglLog(_EGL_DEBUG, "DRI2: dlopen(%s)", path);
- extensions = dlsym(dri2_dpy->driver, __DRI_DRIVER_EXTENSIONS);
+
+ if (asprintf(&get_extensions_name, "%s_%s",
+ __DRI_DRIVER_GET_EXTENSIONS, dri2_dpy->driver_name) != -1) {
+ get_extensions = dlsym(dri2_dpy->driver, get_extensions_name);
+ if (get_extensions) {
+ extensions = get_extensions();
+ } else {
+ _eglLog(_EGL_DEBUG, "driver does not expose %s(): %s\n",
+ get_extensions_name, dlerror());
+ }
+ free(get_extensions_name);
+ }
+
+ if (!extensions)
+ extensions = dlsym(dri2_dpy->driver, __DRI_DRIVER_EXTENSIONS);
if (extensions == NULL) {
_eglLog(_EGL_WARNING,
"DRI2: driver exports no extensions (%s)", dlerror());