From: Emma Anholt Date: Tue, 29 Nov 2022 19:34:34 +0000 (-0800) Subject: gallium/dri: Move the backendVtable InitScreen func into __DRI_MESA. X-Git-Tag: upstream/23.3.3~15957 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cdc7475f72a329860a80a22faf5c71b805eb00ba;p=platform%2Fupstream%2Fmesa.git gallium/dri: Move the backendVtable InitScreen func into __DRI_MESA. Reviewed-by: Adam Jackson Part-of: --- diff --git a/include/GL/internal/mesa_interface.h b/include/GL/internal/mesa_interface.h index bfe4a55..2f7f8e4 100644 --- a/include/GL/internal/mesa_interface.h +++ b/include/GL/internal/mesa_interface.h @@ -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 */ diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index ddca70c..cc4e289 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -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 }; diff --git a/src/gallium/frontends/dri/dri_util.c b/src/gallium/frontends/dri/dri_util.c index 664955f..f1a1859 100644 --- a/src/gallium/frontends/dri/dri_util.c +++ b/src/gallium/frontends/dri/dri_util.c @@ -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; diff --git a/src/gallium/frontends/dri/dri_util.h b/src/gallium/frontends/dri/dri_util.h index 3da8b59..693fceb 100644 --- a/src/gallium/frontends/dri/dri_util.h +++ b/src/gallium/frontends/dri/dri_util.h @@ -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; }; diff --git a/src/gallium/frontends/dri/drisw.c b/src/gallium/frontends/dri/drisw.c index 271d76a..63bcf7a 100644 --- a/src/gallium/frontends/dri/drisw.c +++ b/src/gallium/frontends/dri/drisw.c @@ -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 }; diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c index fb42ac4..d19509a 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -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 };