diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 15c83066344..d6ba684e257 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -2432,30 +2432,9 @@ dri2_create_buffer(__DRIscreen * sPriv, * * DRI versions differ in their implementation of init_screen and swap_buffers. */ -const struct __DriverAPIRec galliumdrm_driver_api = { - .InitScreen = dri2_init_screen, - .DestroyScreen = dri_destroy_screen, - .CreateBuffer = dri2_create_buffer, - .DestroyBuffer = dri_destroy_buffer, - - .AllocateBuffer = dri2_allocate_buffer, - .ReleaseBuffer = dri2_release_buffer, -}; - static const struct __DRIDriverVtableExtensionRec galliumdrm_vtable = { .base = { __DRI_DRIVER_VTABLE, 1 }, - .vtable = &galliumdrm_driver_api, -}; - -/** - * 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. - */ -const struct __DriverAPIRec dri_swrast_kms_driver_api = { - .InitScreen = dri_swrast_kms_init_screen, + .InitScreen = dri2_init_screen, .DestroyScreen = dri_destroy_screen, .CreateBuffer = dri2_create_buffer, .DestroyBuffer = dri_destroy_buffer, @@ -2474,9 +2453,22 @@ const __DRIextension *galliumdrm_driver_extensions[] = { 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 __DRIDriverVtableExtensionRec dri_swrast_kms_vtable = { .base = { __DRI_DRIVER_VTABLE, 1 }, - .vtable = &dri_swrast_kms_driver_api, + .InitScreen = dri_swrast_kms_init_screen, + .DestroyScreen = dri_destroy_screen, + .CreateBuffer = dri2_create_buffer, + .DestroyBuffer = dri_destroy_buffer, + + .AllocateBuffer = dri2_allocate_buffer, + .ReleaseBuffer = dri2_release_buffer, }; const __DRIextension *dri_swrast_kms_driver_extensions[] = { diff --git a/src/gallium/frontends/dri/dri_util.c b/src/gallium/frontends/dri/dri_util.c index 0355afb0c0d..81328095e0e 100644 --- a/src/gallium/frontends/dri/dri_util.c +++ b/src/gallium/frontends/dri/dri_util.c @@ -117,7 +117,7 @@ driCreateNewScreen2(int scrn, int fd, 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; + (__DRIDriverVtableExtension *)driver_extensions[i]; } } diff --git a/src/gallium/frontends/dri/dri_util.h b/src/gallium/frontends/dri/dri_util.h index d1abc695eb0..9f0942b9194 100644 --- a/src/gallium/frontends/dri/dri_util.h +++ b/src/gallium/frontends/dri/dri_util.h @@ -66,7 +66,29 @@ typedef struct __DRIDriverVtableExtensionRec { __DRIextension base; - const struct __DriverAPIRec *vtable; + + const __DRIconfig **(*InitScreen) (__DRIscreen * priv); + + void (*DestroyScreen)(__DRIscreen *driScrnPriv); + + GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, + __DRIdrawable *driDrawPriv, + const struct gl_config *glVis, + GLboolean pixmapBuffer); + + void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); + + void (*SwapBuffers)(__DRIdrawable *driDrawPriv); + + __DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate, + unsigned int attachment, + unsigned int format, + int width, int height); + + void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer); + + void (*CopySubBuffer)(__DRIdrawable *driDrawPriv, int x, int y, + int w, int h); } __DRIDriverVtableExtension; struct __DRIconfigRec { @@ -125,37 +147,6 @@ struct __DriverContextConfig { #define __DRIVER_CONTEXT_ATTRIB_NO_ERROR (1 << 3) #define __DRIVER_CONTEXT_ATTRIB_PROTECTED (1 << 4) -/** - * Driver callback functions. - * - * Each DRI driver must have one of these structures with all the pointers set - * to appropriate functions within the driver. - */ -struct __DriverAPIRec { - const __DRIconfig **(*InitScreen) (__DRIscreen * priv); - - void (*DestroyScreen)(__DRIscreen *driScrnPriv); - - GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, - __DRIdrawable *driDrawPriv, - const struct gl_config *glVis, - GLboolean pixmapBuffer); - - void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); - - void (*SwapBuffers)(__DRIdrawable *driDrawPriv); - - __DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate, - unsigned int attachment, - unsigned int format, - int width, int height); - - void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer); - - void (*CopySubBuffer)(__DRIdrawable *driDrawPriv, int x, int y, - int w, int h); -}; - /** * Per-screen private driver information. */ @@ -164,7 +155,7 @@ struct __DRIscreenRec { * Driver-specific entrypoints provided by the driver's * __DRIDriverVtableExtensionRec. */ - const struct __DriverAPIRec *driver; + const struct __DRIDriverVtableExtensionRec *driver; /** * Current screen's number diff --git a/src/gallium/frontends/dri/drisw.c b/src/gallium/frontends/dri/drisw.c index c885d86b1bb..c839d856b49 100644 --- a/src/gallium/frontends/dri/drisw.c +++ b/src/gallium/frontends/dri/drisw.c @@ -640,7 +640,8 @@ drisw_create_buffer(__DRIscreen * sPriv, * * DRI versions differ in their implementation of init_screen and swap_buffers. */ -const struct __DriverAPIRec galliumsw_driver_api = { +static const struct __DRIDriverVtableExtensionRec galliumsw_vtable = { + .base = { __DRI_DRIVER_VTABLE, 1 }, .InitScreen = drisw_init_screen, .DestroyScreen = dri_destroy_screen, .CreateBuffer = drisw_create_buffer, @@ -649,11 +650,6 @@ const struct __DriverAPIRec galliumsw_driver_api = { .CopySubBuffer = drisw_copy_sub_buffer, }; -static const struct __DRIDriverVtableExtensionRec galliumsw_vtable = { - .base = { __DRI_DRIVER_VTABLE, 1 }, - .vtable = &galliumsw_driver_api, -}; - /* swrast copy sub buffer entrypoint. */ static void driswCopySubBuffer(__DRIdrawable *pdp, int x, int y, int w, int h) diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c index e89ad438f57..3e867577bc8 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -1043,7 +1043,8 @@ const __DRIkopperExtension driKopperExtension = { .queryBufferAge = kopperQueryBufferAge, }; -const struct __DriverAPIRec galliumvk_driver_api = { +static const struct __DRIDriverVtableExtensionRec galliumvk_vtable = { + .base = { __DRI_DRIVER_VTABLE, 1 }, .InitScreen = kopper_init_screen, .DestroyScreen = dri_destroy_screen, .CreateBuffer = kopper_create_buffer, @@ -1052,11 +1053,6 @@ const struct __DriverAPIRec galliumvk_driver_api = { .CopySubBuffer = NULL, }; -static const struct __DRIDriverVtableExtensionRec galliumvk_vtable = { - .base = { __DRI_DRIVER_VTABLE, 1 }, - .vtable = &galliumvk_driver_api, -}; - const __DRIextension *galliumvk_driver_extensions[] = { &driCoreExtension.base, &driSWRastExtension.base,