st: Turn st_api::get_current to be direct accessed function st_api_get_current
authorYonggang Luo <luoyonggang@gmail.com>
Fri, 21 Oct 2022 16:51:37 +0000 (00:51 +0800)
committerMarge Bot <emma+marge@anholt.net>
Mon, 24 Oct 2022 11:31:20 +0000 (11:31 +0000)
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>

src/gallium/frontends/dri/dri_context.c
src/gallium/frontends/glx/xlib/xm_api.c
src/gallium/frontends/osmesa/osmesa.c
src/gallium/frontends/wgl/stw_context.c
src/gallium/include/frontend/api.h
src/gallium/targets/haiku-softpipe/GalliumContext.cpp
src/mesa/state_tracker/st_manager.c

index c304c80..843ecfe 100644 (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;
 }
index f98d4c9..30f47fa 100644 (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;
index 67adef5..11644ef 100644 (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;
 }
 
index b0fe321..5bbb366 100644 (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);
 }
index c872648..16b884e 100644 (file)
@@ -542,14 +542,15 @@ 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.
  */
index 760381a..2059527 100644 (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);
        }
 
index 64649dd..f7dd14d 100644 (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,
 };