[Mesa-dev] [PATCH v2 2/3] dri: make use of loader_get_extensions_name(..) helper

Christian Gmeiner christian.gmeiner at gmail.com
Wed Nov 9 14:50:06 UTC 2016


Changes since v1:
 - removed not needed includes

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 src/egl/drivers/dri2/egl_dri2.c | 7 +++----
 src/gbm/backends/dri/gbm_dri.c  | 7 ++-----
 src/glx/dri_common.c            | 5 ++---
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index d9e2ad7..a79a85b 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -44,8 +44,6 @@
 #include <xf86drm.h>
 #include <drm_fourcc.h>
 #endif
-#include <GL/gl.h>
-#include <GL/internal/dri_interface.h>
 #include "GL/mesa_glinterop.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -56,6 +54,7 @@
 #endif
 
 #include "egl_dri2.h"
+#include "loader/loader.h"
 #include "util/u_atomic.h"
 
 /* The kernel header drm_fourcc.h defines the DRM formats below.  We duplicate
@@ -514,8 +513,8 @@ dri2_open_driver(_EGLDisplay *disp)
 
    _eglLog(_EGL_DEBUG, "DRI2: dlopen(%s)", path);
 
-   if (asprintf(&get_extensions_name, "%s_%s",
-                __DRI_DRIVER_GET_EXTENSIONS, dri2_dpy->driver_name) != -1) {
+   get_extensions_name = loader_get_extensions_name(dri2_dpy->driver_name);
+   if (get_extensions_name) {
       get_extensions = dlsym(dri2_dpy->driver, get_extensions_name);
       if (get_extensions) {
          extensions = get_extensions();
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 5cd7318..a2a9335 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -39,9 +39,6 @@
 #include <dlfcn.h>
 #include <xf86drm.h>
 
-#include <GL/gl.h> /* dri_interface needs GL types */
-#include <GL/internal/dri_interface.h>
-
 #include "gbm_driint.h"
 
 #include "gbmint.h"
@@ -363,8 +360,8 @@ dri_open_driver(struct gbm_dri_device *dri)
       return NULL;
    }
 
-   if (asprintf(&get_extensions_name, "%s_%s",
-                __DRI_DRIVER_GET_EXTENSIONS, dri->base.driver_name) != -1) {
+   get_extensions_name = loader_get_extensions_name(dri->base.driver_name);
+   if (get_extensions_name) {
       const __DRIextension **(*get_extensions)(void);
 
       get_extensions = dlsym(dri->driver, get_extensions_name);
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 6728d38..854733a 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -161,10 +161,9 @@ driGetDriverExtensions(void *handle, const char *driver_name)
 {
    const __DRIextension **extensions = NULL;
    const __DRIextension **(*get_extensions)(void);
-   char *get_extensions_name;
+   char *get_extensions_name = loader_get_extensions_name(driver_name);
 
-   if (asprintf(&get_extensions_name, "%s_%s",
-                __DRI_DRIVER_GET_EXTENSIONS, driver_name) != -1) {
+   if (get_extensions_name) {
       get_extensions = dlsym(handle, get_extensions_name);
       if (get_extensions) {
          free(get_extensions_name);
-- 
2.7.4



More information about the mesa-dev mailing list