dri: Remove the globalDriverAPI hacks

We now know that we always have access to the appropriate driver
extensions, so we can get the right __DriverAPIRec from the vtable.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15649>
This commit is contained in:
Adam Jackson
2022-03-30 10:19:56 -04:00
parent b6f7a4836a
commit 97554218f4
3 changed files with 5 additions and 35 deletions
+5 -29
View File
@@ -91,23 +91,6 @@ setupLoaderExtensions(__DRIscreen *psp,
}
}
/**
* This pointer determines which driver API we'll use in the case of the
* loader not passing us an explicit driver extensions list (that would,
* itself, contain a pointer to a driver API.)
*
* A driver's driDriverGetExtensions_drivername() can update this pointer to
* what it's returning, and a loader that is ignorant of createNewScreen2()
* will get the correct driver screen created, as long as no other
* driDriverGetExtensions() happened in between the first one and the
* createNewScreen().
*
* This allows the X Server to not require the significant dri_interface.h
* updates for doing createNewScreen2(), which would discourage backporting of
* the X Server patches to support the new loader interface.
*/
const struct __DriverAPIRec *globalDriverAPI = &driDriverAPI;
/**
* This is the first entrypoint in the driver called by the DRI driver loader
* after dlopen()ing it.
@@ -128,18 +111,11 @@ driCreateNewScreen2(int scrn, int fd,
if (!psp)
return NULL;
/* By default, use the global driDriverAPI symbol (non-megadrivers). */
psp->driver = globalDriverAPI;
/* If the driver exposes its vtable through its extensions list
* (megadrivers), use that instead.
*/
if (driver_extensions) {
for (int i = 0; driver_extensions[i]; i++) {
if (strcmp(driver_extensions[i]->name, __DRI_DRIVER_VTABLE) == 0) {
psp->driver =
((__DRIDriverVtableExtension *)driver_extensions[i])->vtable;
}
assert(driver_extensions);
for (int i = 0; driver_extensions[i]; i++) {
if (strcmp(driver_extensions[i]->name, __DRI_DRIVER_VTABLE) == 0) {
psp->driver =
((__DRIDriverVtableExtension *)driver_extensions[i])->vtable;
}
}
-3
View File
@@ -143,9 +143,6 @@ struct __DriverAPIRec {
int w, int h);
};
extern const struct __DriverAPIRec driDriverAPI;
extern const struct __DriverAPIRec *globalDriverAPI;
/**
* Per-screen private driver information.
*/
-3
View File
@@ -7,7 +7,6 @@
const __DRIextension **__driDriverGetExtensions_##drivername(void); \
PUBLIC const __DRIextension **__driDriverGetExtensions_##drivername(void) \
{ \
globalDriverAPI = &galliumdrm_driver_api; \
return galliumdrm_driver_extensions; \
}
@@ -17,7 +16,6 @@ const __DRIextension **__driDriverGetExtensions_swrast(void);
PUBLIC const __DRIextension **__driDriverGetExtensions_swrast(void)
{
globalDriverAPI = &galliumsw_driver_api;
return galliumsw_driver_extensions;
}
@@ -27,7 +25,6 @@ const __DRIextension **__driDriverGetExtensions_kms_swrast(void);
PUBLIC const __DRIextension **__driDriverGetExtensions_kms_swrast(void)
{
globalDriverAPI = &dri_kms_driver_api;
return dri_kms_driver_extensions;
}