gallium/dri: Move the backendVtable InitScreen func into __DRI_MESA.
Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>
This commit is contained in:
@@ -35,6 +35,8 @@ typedef struct __DRImesaCoreExtensionRec __DRImesaCoreExtension;
|
||||
#define __DRI_MESA "DRI_Mesa"
|
||||
#define __DRI_MESA_VERSION 1
|
||||
|
||||
struct dri_screen;
|
||||
|
||||
/** Core struct that appears alongside __DRI_CORE for Mesa-internal usage.
|
||||
* Implemented in the top-level dri/drisw/kopper extension list.
|
||||
*/
|
||||
@@ -54,6 +56,9 @@ struct __DRImesaCoreExtensionRec {
|
||||
* be -1.
|
||||
*/
|
||||
__DRIcreateNewScreen2Func createNewScreen;
|
||||
|
||||
/* driver function for finishing initialization inside createNewScreen(). */
|
||||
const __DRIconfig **(*initScreen)(struct dri_screen *screen);
|
||||
};
|
||||
|
||||
#endif /* MESA_INTERFACE_H */
|
||||
|
@@ -2397,20 +2397,11 @@ release_pipe:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* DRI driver virtual function table.
|
||||
*
|
||||
* DRI versions differ in their implementation of init_screen and swap_buffers.
|
||||
*/
|
||||
static const struct __DRIBackendVtableExtensionRec galliumdrm_vtable = {
|
||||
.base = { __DRI_BACKEND_VTABLE, 1 },
|
||||
.InitScreen = dri2_init_screen,
|
||||
};
|
||||
|
||||
static const struct __DRImesaCoreExtensionRec mesaCoreExtension = {
|
||||
.base = { __DRI_MESA, 1 },
|
||||
.version_string = MESA_INTERFACE_VERSION_STRING,
|
||||
.createNewScreen = driCreateNewScreen2,
|
||||
.initScreen = dri2_init_screen,
|
||||
};
|
||||
|
||||
/* This is the table of extensions that the loader will dlsym() for. */
|
||||
@@ -2420,29 +2411,22 @@ const __DRIextension *galliumdrm_driver_extensions[] = {
|
||||
&driImageDriverExtension.base,
|
||||
&driDRI2Extension.base,
|
||||
&gallium_config_options.base,
|
||||
&galliumdrm_vtable.base,
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
* DRI driver virtual function table.
|
||||
*
|
||||
* KMS/DRM version of the DriverAPI above sporting a different InitScreen
|
||||
* hook. The latter is used to explicitly initialise the kms_swrast driver
|
||||
* rather than selecting the approapriate driver as suggested by the loader.
|
||||
*/
|
||||
static const struct __DRIBackendVtableExtensionRec dri_swrast_kms_vtable = {
|
||||
.base = { __DRI_BACKEND_VTABLE, 1 },
|
||||
.InitScreen = dri_swrast_kms_init_screen,
|
||||
static const struct __DRImesaCoreExtensionRec swkmsMesaCoreExtension = {
|
||||
.base = { __DRI_MESA, 1 },
|
||||
.version_string = MESA_INTERFACE_VERSION_STRING,
|
||||
.createNewScreen = driCreateNewScreen2,
|
||||
.initScreen = dri_swrast_kms_init_screen,
|
||||
};
|
||||
|
||||
const __DRIextension *dri_swrast_kms_driver_extensions[] = {
|
||||
&driCoreExtension.base,
|
||||
&mesaCoreExtension.base,
|
||||
&swkmsMesaCoreExtension.base,
|
||||
&driImageDriverExtension.base,
|
||||
&swkmsDRI2Extension.base,
|
||||
&gallium_config_options.base,
|
||||
&dri_swrast_kms_vtable.base,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@@ -52,6 +52,7 @@
|
||||
#include "main/debug_output.h"
|
||||
#include "main/errors.h"
|
||||
#include "loader/loader.h"
|
||||
#include "GL/internal/mesa_interface.h"
|
||||
|
||||
driOptionDescription __dri2ConfigOptions[] = {
|
||||
DRI_CONF_SECTION_DEBUG
|
||||
@@ -102,7 +103,7 @@ driCreateNewScreen2(int scrn, int fd,
|
||||
{
|
||||
static const __DRIextension *emptyExtensionList[] = { NULL };
|
||||
struct dri_screen *screen;
|
||||
const struct __DRIBackendVtableExtensionRec *backend = NULL;
|
||||
const __DRImesaCoreExtension *mesa = NULL;
|
||||
|
||||
screen = CALLOC_STRUCT(dri_screen);
|
||||
if (!screen)
|
||||
@@ -110,8 +111,8 @@ driCreateNewScreen2(int scrn, int fd,
|
||||
|
||||
assert(driver_extensions);
|
||||
for (int i = 0; driver_extensions[i]; i++) {
|
||||
if (strcmp(driver_extensions[i]->name, __DRI_BACKEND_VTABLE) == 0) {
|
||||
backend = (__DRIBackendVtableExtension *)driver_extensions[i];
|
||||
if (strcmp(driver_extensions[i]->name, __DRI_MESA) == 0) {
|
||||
mesa = (__DRImesaCoreExtension *)driver_extensions[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ driCreateNewScreen2(int scrn, int fd,
|
||||
|
||||
screen->loaderPrivate = data;
|
||||
|
||||
/* This will be filled in by backend->InitScreen(). */
|
||||
/* This will be filled in by mesa->initScreen(). */
|
||||
screen->extensions = emptyExtensionList;
|
||||
screen->fd = fd;
|
||||
screen->myNum = scrn;
|
||||
@@ -135,7 +136,7 @@ driCreateNewScreen2(int scrn, int fd,
|
||||
driParseConfigFiles(&screen->optionCache, &screen->optionInfo, screen->myNum,
|
||||
"dri2", NULL, NULL, NULL, 0, NULL, 0);
|
||||
|
||||
*driver_configs = backend->InitScreen(screen);
|
||||
*driver_configs = mesa->initScreen(screen);
|
||||
if (*driver_configs == NULL) {
|
||||
free(screen);
|
||||
return NULL;
|
||||
|
@@ -47,11 +47,6 @@ struct dri_screen;
|
||||
|
||||
#define __DRI_BACKEND_VTABLE "DRI_DriverVtable"
|
||||
|
||||
typedef struct __DRIBackendVtableExtensionRec {
|
||||
__DRIextension base;
|
||||
const __DRIconfig **(*InitScreen)(struct dri_screen *screen);
|
||||
} __DRIBackendVtableExtension;
|
||||
|
||||
struct __DRIconfigRec {
|
||||
struct gl_config modes;
|
||||
};
|
||||
|
@@ -605,16 +605,6 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* DRI driver virtual function table.
|
||||
*
|
||||
* DRI versions differ in their implementation of init_screen and swap_buffers.
|
||||
*/
|
||||
static const struct __DRIBackendVtableExtensionRec galliumsw_vtable = {
|
||||
.base = { __DRI_BACKEND_VTABLE, 1 },
|
||||
.InitScreen = drisw_init_screen,
|
||||
};
|
||||
|
||||
/* swrast copy sub buffer entrypoint. */
|
||||
static void driswCopySubBuffer(__DRIdrawable *pdp, int x, int y,
|
||||
int w, int h)
|
||||
@@ -637,6 +627,7 @@ static const struct __DRImesaCoreExtensionRec mesaCoreExtension = {
|
||||
.base = { __DRI_MESA, 1 },
|
||||
.version_string = MESA_INTERFACE_VERSION_STRING,
|
||||
.createNewScreen = driCreateNewScreen2,
|
||||
.initScreen = drisw_init_screen,
|
||||
};
|
||||
|
||||
/* This is the table of extensions that the loader will dlsym() for. */
|
||||
@@ -646,7 +637,6 @@ const __DRIextension *galliumsw_driver_extensions[] = {
|
||||
&driSWRastExtension.base,
|
||||
&driSWCopySubBufferExtension.base,
|
||||
&gallium_config_options.base,
|
||||
&galliumsw_vtable.base,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@@ -951,15 +951,11 @@ const __DRIkopperExtension driKopperExtension = {
|
||||
.queryBufferAge = kopperQueryBufferAge,
|
||||
};
|
||||
|
||||
static const struct __DRIBackendVtableExtensionRec galliumvk_vtable = {
|
||||
.base = { __DRI_BACKEND_VTABLE, 1 },
|
||||
.InitScreen = kopper_init_screen,
|
||||
};
|
||||
|
||||
static const struct __DRImesaCoreExtensionRec mesaCoreExtension = {
|
||||
.base = { __DRI_MESA, 1 },
|
||||
.version_string = MESA_INTERFACE_VERSION_STRING,
|
||||
.createNewScreen = driCreateNewScreen2,
|
||||
.initScreen = kopper_init_screen,
|
||||
};
|
||||
|
||||
const __DRIextension *galliumvk_driver_extensions[] = {
|
||||
@@ -970,7 +966,6 @@ const __DRIextension *galliumvk_driver_extensions[] = {
|
||||
&driImageDriverExtension.base,
|
||||
&driKopperExtension.base,
|
||||
&gallium_config_options.base,
|
||||
&galliumvk_vtable.base,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user