diff --git a/src/gallium/frontends/dri/dri_context.c b/src/gallium/frontends/dri/dri_context.c index c304c807680..843ecfe225e 100644 --- a/src/gallium/frontends/dri/dri_context.c +++ b/src/gallium/frontends/dri/dri_context.c @@ -269,7 +269,7 @@ dri_unbind_context(__DRIcontext * cPriv) struct st_context_iface *st = ctx->st; struct st_api *stapi = screen->st_api; - if (st == stapi->get_current(stapi)) { + if (st == st_api_get_current()) { if (st->thread_finish) st->thread_finish(st); @@ -328,11 +328,7 @@ dri_make_current(__DRIcontext * cPriv, struct dri_context * dri_get_current(__DRIscreen *sPriv) { - struct dri_screen *screen = dri_screen(sPriv); - struct st_api *stapi = screen->st_api; - struct st_context_iface *st; - - st = stapi->get_current(stapi); + struct st_context_iface *st = st_api_get_current(); return (struct dri_context *) st ? st->st_manager_private : NULL; } diff --git a/src/gallium/frontends/glx/xlib/xm_api.c b/src/gallium/frontends/glx/xlib/xm_api.c index f98d4c9c039..30f47fafb7c 100644 --- a/src/gallium/frontends/glx/xlib/xm_api.c +++ b/src/gallium/frontends/glx/xlib/xm_api.c @@ -1327,7 +1327,7 @@ GLboolean XMesaUnbindContext( XMesaContext c ) XMesaContext XMesaGetCurrentContext( void ) { - struct st_context_iface *st = stapi->get_current(stapi); + struct st_context_iface *st = st_api_get_current(); return (XMesaContext) (st) ? st->st_manager_private : NULL; } @@ -1470,7 +1470,7 @@ PUBLIC void XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer, const int *attrib_list) { - struct st_context_iface *st = stapi->get_current(stapi); + struct st_context_iface *st = st_api_get_current(); struct st_framebuffer_iface* stfbi = drawable->stfb; struct pipe_resource *res; int x, y, w, h; diff --git a/src/gallium/frontends/osmesa/osmesa.c b/src/gallium/frontends/osmesa/osmesa.c index 67adef517de..11644ef0be8 100644 --- a/src/gallium/frontends/osmesa/osmesa.c +++ b/src/gallium/frontends/osmesa/osmesa.c @@ -837,8 +837,7 @@ OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type, GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext(void) { - struct st_api *stapi = get_st_api(); - struct st_context_iface *st = stapi->get_current(stapi); + struct st_context_iface *st = st_api_get_current(); return st ? (OSMesaContext) st->st_manager_private : NULL; } diff --git a/src/gallium/frontends/wgl/stw_context.c b/src/gallium/frontends/wgl/stw_context.c index b0fe3216d3f..5bbb36627cf 100644 --- a/src/gallium/frontends/wgl/stw_context.c +++ b/src/gallium/frontends/wgl/stw_context.c @@ -54,7 +54,7 @@ stw_current_context(void) { struct st_context_iface *st; - st = (stw_dev) ? stw_dev->stapi->get_current(stw_dev->stapi) : NULL; + st = (stw_dev) ? st_api_get_current() : NULL; return (struct stw_context *) ((st) ? st->st_manager_private : NULL); } diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h index c872648a159..16b884e6d96 100644 --- a/src/gallium/include/frontend/api.h +++ b/src/gallium/include/frontend/api.h @@ -542,13 +542,14 @@ struct st_api struct st_context_iface *stctxi, struct st_framebuffer_iface *stdrawi, struct st_framebuffer_iface *streadi); - - /** - * Get the currently bound context in the calling thread. - */ - struct st_context_iface *(*get_current)(struct st_api *stapi); }; +/** + * Get the currently bound context in the calling thread. + */ +struct st_context_iface * +st_api_get_current(void); + /** * Notify the st manager the framebuffer interface object * is no longer valid. diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp index 760381a24fd..205952745a6 100644 --- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp +++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp @@ -173,7 +173,7 @@ GalliumContext::CreateContext(HGLWinsysContext *wsContext) struct st_context_iface* shared = NULL; if (fOptions & BGL_SHARE_CONTEXT) { - shared = fDisplay->api->get_current(fDisplay->api); + shared = st_api_get_current(); TRACE("shared context: %p\n", shared); } diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 64649dd2804..f7dd14d80f4 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -1153,8 +1153,8 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, } -static struct st_context_iface * -st_api_get_current(struct st_api *stapi) +struct st_context_iface * +st_api_get_current(void) { GET_CURRENT_CONTEXT(ctx); struct st_context *st = ctx ? ctx->st : NULL; @@ -1454,7 +1454,6 @@ static const struct st_api st_gl_api = { .query_versions = st_api_query_versions, .create_context = st_api_create_context, .make_current = st_api_make_current, - .get_current = st_api_get_current, };