mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-21 01:10:44 +02:00
frontend/dri: inline __DriverAPIRec
the vtable indirection was unnecessary Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19741>
This commit is contained in:
parent
e061affa7f
commit
d57284d673
5 changed files with 44 additions and 69 deletions
|
|
@ -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[] = {
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue