diff options
author | Eric Anholt <[email protected]> | 2013-10-11 17:38:18 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2013-10-24 14:04:20 -0700 |
commit | 67caf36489e29c93ed1a25541944b191ed50df52 (patch) | |
tree | 6352160e6db051d43833976590d6df0c2217fac1 /src/gbm | |
parent | a64bb7553a9eb2f8ff57198b346475e9d652fda7 (diff) |
gbm: Add support for the new __driDriverGetExtensions interface.
v2: Fix uninitialized variable use in the old-ABI case.
Reviewed-by: Chad Versace <[email protected]> (v1)
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gbm')
-rw-r--r-- | src/gbm/backends/dri/gbm_dri.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index ba148ec73d4..ee05ed87256 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -169,8 +169,9 @@ dri_bind_extensions(struct gbm_dri_device *dri, static int dri_load_driver(struct gbm_dri_device *dri) { - const __DRIextension **extensions; + const __DRIextension **extensions = NULL; char path[PATH_MAX], *search_paths, *p, *next, *end; + char *get_extensions_name; search_paths = NULL; if (geteuid() == getuid()) { @@ -209,7 +210,19 @@ dri_load_driver(struct gbm_dri_device *dri) return -1; } - extensions = dlsym(dri->driver, __DRI_DRIVER_EXTENSIONS); + if (asprintf(&get_extensions_name, "%s_%s", + __DRI_DRIVER_GET_EXTENSIONS, dri->base.driver_name) != -1) { + const __DRIextension **(*get_extensions)(void); + + get_extensions = dlsym(dri->driver, get_extensions_name); + free(get_extensions_name); + + if (get_extensions) + extensions = get_extensions(); + } + + if (!extensions) + extensions = dlsym(dri->driver, __DRI_DRIVER_EXTENSIONS); if (extensions == NULL) { fprintf(stderr, "gbm: driver exports no extensions (%s)", dlerror()); dlclose(dri->driver); |