st: Turn st_api::get_current to be direct accessed function st_api_get_current

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19197>
This commit is contained in:
Yonggang Luo
2022-10-22 00:51:37 +08:00
committed by Marge Bot
parent 40e11ee509
commit 26b77dfeb2
7 changed files with 15 additions and 20 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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.

View File

@@ -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);
}

View File

@@ -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,
};