glx: Move the driver extension-loading to a helper function.
authorEric Anholt <eric@anholt.net>
Fri, 27 Sep 2013 22:36:59 +0000 (15:36 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 24 Oct 2013 21:04:20 +0000 (14:04 -0700)
I'm planning on doing driver extension parsing from 3 places, and making
the extension loading step a bit longer.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
src/glx/dri2_glx.c
src/glx/dri_common.c
src/glx/dri_common.h

index 07138fb11f8eb1379731b11a3f4530879d59afc1..123c87cbac9be6a1f7917812b21f9fb270ae586b 100644 (file)
@@ -1183,11 +1183,9 @@ dri2CreateScreen(int screen, struct glx_display * priv)
       goto handle_error;
    }
 
-   extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
-   if (extensions == NULL) {
-      ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
+   extensions = driGetDriverExtensions(psc->driver);
+   if (extensions == NULL)
       goto handle_error;
-   }
 
    for (i = 0; extensions[i]; i++) {
       if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
index 5f199e9fde49461bab37877ec8a07a2ce7ce5935..f1d1164571ec80b3d5c658f28bc5dd076208da1c 100644 (file)
@@ -187,6 +187,20 @@ driOpenDriver(const char *driverName)
    return handle;
 }
 
+_X_HIDDEN const __DRIextension **
+driGetDriverExtensions(void *handle)
+{
+   const __DRIextension **extensions = NULL;
+
+   extensions = dlsym(handle, __DRI_DRIVER_EXTENSIONS);
+   if (extensions == NULL) {
+      ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
+      return NULL;
+   }
+
+   return extensions;
+}
+
 static GLboolean
 __driGetMSCRate(__DRIdrawable *draw,
                int32_t * numerator, int32_t * denominator,
index 2bbffa9ffbea4b97e5c986a62d1f06f33b28212a..2ebcb812732f929b02ecb98b561f23b36a2c18d5 100644 (file)
@@ -69,6 +69,8 @@ extern void CriticalErrorMessageF(const char *f, ...);
 
 extern void *driOpenDriver(const char *driverName);
 
+extern const __DRIextension **driGetDriverExtensions(void *handle);
+
 extern bool
 dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
                          unsigned *major_ver, unsigned *minor_ver,