]>
Commit | Line | Data |
---|---|---|
f48ea26b AM |
1 | commit 339af2ae943d943f8ce986fc7bdcb8aa52b44922 |
2 | Author: Eric Anholt <eric@anholt.net> | |
3 | Date: Tue Oct 22 14:22:04 2013 -0700 | |
4 | ||
5 | glx: Add support for the new DRI loader entrypoint. | |
6 | ||
7 | This is going to be exposed (and not the old entrypoint) for some DRI | |
8 | drivers once the megadrivers series lands, and the plan is to | |
9 | eventually transition all drivers to that. Hopefully this is | |
10 | unobtrusive enough to merge to stable X servers so that they can be | |
11 | compatible with new Mesa versions. | |
12 | ||
13 | v2: typo fix in the comment | |
14 | ||
15 | Signed-off-by: Eric Anholt <eric@anholt.net> | |
16 | Reviewed-by: Adam Jackson <ajax@redhat.com> | |
17 | Signed-off-by: Keith Packard <keithp@keithp.com> | |
18 | ||
19 | diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c | |
20 | index c90f380..5686c5f 100644 | |
21 | --- a/glx/glxdricommon.c | |
22 | +++ b/glx/glxdricommon.c | |
23 | @@ -209,6 +209,14 @@ glxConvertConfigs(const __DRIcoreExtension * core, | |
24 | ||
25 | static const char dri_driver_path[] = DRI_DRIVER_PATH; | |
26 | ||
27 | +/* Temporary define to allow building without a dri_interface.h from | |
28 | + * updated Mesa. Some day when we don't care about Mesa that old any | |
29 | + * more this can be removed. | |
30 | + */ | |
31 | +#ifndef __DRI_DRIVER_GET_EXTENSIONS | |
32 | +#define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions" | |
33 | +#endif | |
34 | + | |
35 | void * | |
36 | glxProbeDriver(const char *driverName, | |
37 | void **coreExt, const char *coreName, int coreVersion, | |
38 | @@ -217,7 +225,8 @@ glxProbeDriver(const char *driverName, | |
39 | int i; | |
40 | void *driver; | |
41 | char filename[PATH_MAX]; | |
42 | - const __DRIextension **extensions; | |
43 | + char *get_extensions_name; | |
44 | + const __DRIextension **extensions = NULL; | |
45 | ||
46 | snprintf(filename, sizeof filename, "%s/%s_dri.so", | |
47 | dri_driver_path, driverName); | |
48 | @@ -229,7 +238,18 @@ glxProbeDriver(const char *driverName, | |
49 | goto cleanup_failure; | |
50 | } | |
51 | ||
52 | - extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS); | |
53 | + if (asprintf(&get_extensions_name, "%s_%s", | |
54 | + __DRI_DRIVER_GET_EXTENSIONS, driverName) != -1) { | |
55 | + const __DRIextension **(*get_extensions)(void); | |
56 | + | |
57 | + get_extensions = dlsym(driver, get_extensions_name); | |
58 | + if (get_extensions) | |
59 | + extensions = get_extensions(); | |
60 | + free(get_extensions_name); | |
61 | + } | |
62 | + | |
63 | + if (!extensions) | |
64 | + extensions = dlsym(driver, __DRI_DRIVER_EXTENSIONS); | |
65 | if (extensions == NULL) { | |
66 | LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n", | |
67 | driverName, dlerror()); |