From 9c772de270408c8a9b9e84b734d9fc0cee2d4265 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 29 Mar 2022 13:36:37 -0400 Subject: [PATCH] dri: Fold away some unused indirection in __DriverAPIRec The context-related API doesn't vary between dri2 and drisw. Reviewed-by: Emma Anholt Part-of: --- src/gallium/frontends/dri/dri2.c | 8 -------- src/gallium/frontends/dri/dri_util.c | 13 +++++++------ src/gallium/frontends/dri/dri_util.h | 19 ------------------- src/gallium/frontends/dri/drisw.c | 4 ---- 4 files changed, 7 insertions(+), 37 deletions(-) diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 8dd8aef..f1cfa74 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -2537,12 +2537,8 @@ dri2_create_buffer(__DRIscreen * sPriv, const struct __DriverAPIRec galliumdrm_driver_api = { .InitScreen = dri2_init_screen, .DestroyScreen = dri_destroy_screen, - .CreateContext = dri_create_context, - .DestroyContext = dri_destroy_context, .CreateBuffer = dri2_create_buffer, .DestroyBuffer = dri_destroy_buffer, - .MakeCurrent = dri_make_current, - .UnbindContext = dri_unbind_context, .AllocateBuffer = dri2_allocate_buffer, .ReleaseBuffer = dri2_release_buffer, @@ -2558,12 +2554,8 @@ const struct __DriverAPIRec galliumdrm_driver_api = { const struct __DriverAPIRec dri_kms_driver_api = { .InitScreen = dri_kms_init_screen, .DestroyScreen = dri_destroy_screen, - .CreateContext = dri_create_context, - .DestroyContext = dri_destroy_context, .CreateBuffer = dri2_create_buffer, .DestroyBuffer = dri_destroy_buffer, - .MakeCurrent = dri_make_current, - .UnbindContext = dri_unbind_context, .AllocateBuffer = dri2_allocate_buffer, .ReleaseBuffer = dri2_release_buffer, diff --git a/src/gallium/frontends/dri/dri_util.c b/src/gallium/frontends/dri/dri_util.c index dc105ea..6365e70 100644 --- a/src/gallium/frontends/dri/dri_util.c +++ b/src/gallium/frontends/dri/dri_util.c @@ -41,6 +41,7 @@ #include #include "dri_util.h" +#include "dri_context.h" #include "utils.h" #include "util/u_endian.h" #include "util/driconf.h" @@ -484,8 +485,8 @@ driCreateContextAttribs(__DRIscreen *screen, int api, context->driDrawablePriv = NULL; context->driReadablePriv = NULL; - if (!screen->driver->CreateContext(mesa_api, modes, context, - &ctx_config, error, shareCtx)) { + if (!dri_create_context(mesa_api, modes, context, &ctx_config, error, + shareCtx)) { free(context); return NULL; } @@ -524,7 +525,7 @@ static void driDestroyContext(__DRIcontext *pcp) { if (pcp) { - pcp->driScreenPriv->driver->DestroyContext(pcp); + dri_destroy_context(pcp); free(pcp); } } @@ -577,7 +578,7 @@ static int driBindContext(__DRIcontext *pcp, dri_get_drawable(prp); } - return pcp->driScreenPriv->driver->MakeCurrent(pcp, pdp, prp); + return dri_make_current(pcp, pdp, prp); } /** @@ -610,10 +611,10 @@ static int driUnbindContext(__DRIcontext *pcp) return GL_FALSE; /* - ** Call driUnbindContext before checking for valid drawables + ** Call dri_unbind_context before checking for valid drawables ** to handle surfaceless contexts properly. */ - pcp->driScreenPriv->driver->UnbindContext(pcp); + dri_unbind_context(pcp); pdp = pcp->driDrawablePriv; prp = pcp->driReadablePriv; diff --git a/src/gallium/frontends/dri/dri_util.h b/src/gallium/frontends/dri/dri_util.h index be91c49..c43f269 100644 --- a/src/gallium/frontends/dri/dri_util.h +++ b/src/gallium/frontends/dri/dri_util.h @@ -116,25 +116,12 @@ struct __DriverContextConfig { * * Each DRI driver must have one of these structures with all the pointers set * to appropriate functions within the driver. - * - * When glXCreateContext() is called, for example, it'll call a helper function - * dri_util.c which in turn will jump through the \a CreateContext pointer in - * this structure. */ struct __DriverAPIRec { const __DRIconfig **(*InitScreen) (__DRIscreen * priv); void (*DestroyScreen)(__DRIscreen *driScrnPriv); - GLboolean (*CreateContext)(gl_api api, - const struct gl_config *glVis, - __DRIcontext *driContextPriv, - const struct __DriverContextConfig *ctx_config, - unsigned *error, - void *sharedContextPrivate); - - void (*DestroyContext)(__DRIcontext *driContextPriv); - GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, const struct gl_config *glVis, @@ -144,12 +131,6 @@ struct __DriverAPIRec { void (*SwapBuffers)(__DRIdrawable *driDrawPriv); - GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv, - __DRIdrawable *driDrawPriv, - __DRIdrawable *driReadPriv); - - GLboolean (*UnbindContext)(__DRIcontext *driContextPriv); - __DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate, unsigned int attachment, unsigned int format, diff --git a/src/gallium/frontends/dri/drisw.c b/src/gallium/frontends/dri/drisw.c index 49b8d73..b879529 100644 --- a/src/gallium/frontends/dri/drisw.c +++ b/src/gallium/frontends/dri/drisw.c @@ -603,13 +603,9 @@ drisw_create_buffer(__DRIscreen * sPriv, const struct __DriverAPIRec galliumsw_driver_api = { .InitScreen = drisw_init_screen, .DestroyScreen = dri_destroy_screen, - .CreateContext = dri_create_context, - .DestroyContext = dri_destroy_context, .CreateBuffer = drisw_create_buffer, .DestroyBuffer = dri_destroy_buffer, .SwapBuffers = drisw_swap_buffers, - .MakeCurrent = dri_make_current, - .UnbindContext = dri_unbind_context, .CopySubBuffer = drisw_copy_sub_buffer, }; -- 2.7.4