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