summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-10-22 14:22:04 -0700
committerMatt Dew <marcoz@osource.org>2013-11-06 19:52:01 -0700
commit339af2ae943d943f8ce986fc7bdcb8aa52b44922 (patch)
tree461cf9c9583558aacaf18dcb35e87cab5f0cc841
parent833639d2653a869c2ec8692640213e2ffa16fbb4 (diff)
glx: Add support for the new DRI loader entrypoint.
This is going to be exposed (and not the old entrypoint) for some DRI drivers once the megadrivers series lands, and the plan is to eventually transition all drivers to that. Hopefully this is unobtrusive enough to merge to stable X servers so that they can be compatible with new Mesa versions. v2: typo fix in the comment Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--glx/glxdricommon.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index c90f38098..5686c5f64 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -209,6 +209,14 @@ glxConvertConfigs(const __DRIcoreExtension * core,
209 209
210static const char dri_driver_path[] = DRI_DRIVER_PATH; 210static const char dri_driver_path[] = DRI_DRIVER_PATH;
211 211
212/* Temporary define to allow building without a dri_interface.h from
213 * updated Mesa. Some day when we don't care about Mesa that old any
214 * more this can be removed.
215 */
216#ifndef __DRI_DRIVER_GET_EXTENSIONS
217#define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions"
218#endif
219
212void * 220void *
213glxProbeDriver(const char *driverName, 221glxProbeDriver(const char *driverName,
214 void **coreExt, const char *coreName, int coreVersion, 222 void **coreExt, const char *coreName, int coreVersion,
@@ -217,7 +225,8 @@ glxProbeDriver(const char *driverName,
217 int i; 225 int i;
218 void *driver; 226 void *driver;
219 char filename[PATH_MAX]; 227 char filename[PATH_MAX];
220 const __DRIextension **extensions; 228 char *get_extensions_name;
229 const __DRIextension **extensions = NULL;
221 230
222 snprintf(filename, sizeof filename, "%s/%s_dri.so", 231 snprintf(filename, sizeof filename, "%s/%s_dri.so",
223 dri_driver_path, driverName); 232 dri_driver_path, driverName);
@@ -229,7 +238,18 @@ glxProbeDriver(const char *driverName,
229 goto cleanup_failure; 238 goto cleanup_failure;
230 } 239 }
231 240
232 extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS); 241 if (asprintf(&get_extensions_name, "%s_%s",
242 __DRI_DRIVER_GET_EXTENSIONS, driverName) != -1) {
243 const __DRIextension **(*get_extensions)(void);
244
245 get_extensions = dlsym(driver, get_extensions_name);
246 if (get_extensions)
247 extensions = get_extensions();
248 free(get_extensions_name);
249 }
250
251 if (!extensions)
252 extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS);
233 if (extensions == NULL) { 253 if (extensions == NULL) {
234 LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n", 254 LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
235 driverName, dlerror()); 255 driverName, dlerror());