st: Turn st_api::make_current to be direct accessed function st_api_make_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 01:02:42 +08:00
committed by Marge Bot
parent 26b77dfeb2
commit 562adc385d
7 changed files with 27 additions and 31 deletions
+3 -5
View File
@@ -264,10 +264,8 @@ GLboolean
dri_unbind_context(__DRIcontext * cPriv)
{
/* dri_util.c ensures cPriv is not null */
struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
struct dri_context *ctx = dri_context(cPriv);
struct st_context_iface *st = ctx->st;
struct st_api *stapi = screen->st_api;
if (st == st_api_get_current()) {
if (st->thread_finish)
@@ -277,7 +275,7 @@ dri_unbind_context(__DRIcontext * cPriv)
if (ctx->hud)
hud_record_only(ctx->hud, st->pipe);
stapi->make_current(stapi, NULL, NULL, NULL);
st_api_make_current(NULL, NULL, NULL);
}
ctx->dPriv = NULL;
ctx->rPriv = NULL;
@@ -302,7 +300,7 @@ dri_make_current(__DRIcontext * cPriv,
ctx->st->thread_finish(ctx->st);
if (!draw && !read)
return ctx->stapi->make_current(ctx->stapi, ctx->st, NULL, NULL);
return st_api_make_current(ctx->st, NULL, NULL);
else if (!draw || !read)
return GL_FALSE;
@@ -315,7 +313,7 @@ dri_make_current(__DRIcontext * cPriv,
read->texture_stamp = driReadPriv->lastStamp - 1;
}
ctx->stapi->make_current(ctx->stapi, ctx->st, &draw->base, &read->base);
st_api_make_current(ctx->st, &draw->base, &read->base);
/* This is ok to call here. If they are already init, it's a no-op. */
if (ctx->pp && draw->textures[ST_ATTACHMENT_BACK_LEFT])
+2 -2
View File
@@ -1298,7 +1298,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
c->xm_buffer = drawBuffer;
c->xm_read_buffer = readBuffer;
stapi->make_current(stapi, c->st,
st_api_make_current(c->st,
drawBuffer ? drawBuffer->stfb : NULL,
readBuffer ? readBuffer->stfb : NULL);
@@ -1308,7 +1308,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
}
else {
/* Detach */
stapi->make_current(stapi, NULL, NULL, NULL);
st_api_make_current(NULL, NULL, NULL);
}
return GL_TRUE;
+2 -3
View File
@@ -755,11 +755,10 @@ GLAPI GLboolean GLAPIENTRY
OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type,
GLsizei width, GLsizei height)
{
struct st_api *stapi = get_st_api();
enum pipe_format color_format;
if (!osmesa && !buffer) {
stapi->make_current(stapi, NULL, NULL, NULL);
st_api_make_current(NULL, NULL, NULL);
return GL_TRUE;
}
@@ -798,7 +797,7 @@ OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type,
osmesa->type = type;
stapi->make_current(stapi, osmesa->stctx, osbuffer->stfb, osbuffer->stfb);
st_api_make_current(osmesa->stctx, osbuffer->stfb, osbuffer->stfb);
/* XXX: We should probably load the current color value into the buffer here
* to match classic swrast behavior (context's fb starts with the contents of
+5 -5
View File
@@ -322,7 +322,7 @@ DrvDeleteContext(DHGLRC dhglrc)
/* Unbind current if deleting current context. */
if (curctx == ctx)
stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
st_api_make_current(NULL, NULL, NULL);
stw_destroy_context(ctx);
ret = TRUE;
@@ -487,9 +487,9 @@ stw_make_current(struct stw_framebuffer *fb, struct stw_framebuffer *fbRead, str
ctx->current_framebuffer = fb;
ctx->current_read_framebuffer = fbRead;
ret = stw_dev->stapi->make_current(stw_dev->stapi, ctx->st,
fb ? fb->stfb : NULL,
fbRead ? fbRead->stfb : NULL);
ret = st_api_make_current(ctx->st,
fb ? fb->stfb : NULL,
fbRead ? fbRead->stfb : NULL);
/* Release the old framebuffers from this context. */
release_old_framebuffers(old_fb, old_fbRead, ctx);
@@ -508,7 +508,7 @@ fail:
stw_make_current(NULL, NULL, NULL);
}
} else {
ret = stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
ret = st_api_make_current(NULL, NULL, NULL);
}
/* Unreference the previous framebuffer if any. It must be done after
+11 -11
View File
@@ -531,19 +531,19 @@ struct st_api
const struct st_context_attribs *attribs,
enum st_context_error *error,
struct st_context_iface *stsharei);
/**
* Bind the context to the calling thread with draw and read as drawables.
*
* The framebuffers might be NULL, or might have different visuals than the
* context does.
*/
bool (*make_current)(struct st_api *stapi,
struct st_context_iface *stctxi,
struct st_framebuffer_iface *stdrawi,
struct st_framebuffer_iface *streadi);
};
/**
* Bind the context to the calling thread with draw and read as drawables.
*
* The framebuffers might be NULL, or might have different visuals than the
* context does.
*/
bool
st_api_make_current(struct st_context_iface *stctxi,
struct st_framebuffer_iface *stdrawi,
struct st_framebuffer_iface *streadi);
/**
* Get the currently bound context in the calling thread.
*/
@@ -301,7 +301,7 @@ GalliumContext::SetCurrentContext(bool set, context_id contextID)
}
if (!set) {
fDisplay->api->make_current(fDisplay->api, NULL, NULL, NULL);
st_api_make_current(NULL, NULL, NULL);
Unlock();
return B_OK;
}
@@ -315,7 +315,7 @@ GalliumContext::SetCurrentContext(bool set, context_id contextID)
}
// We need to lock and unlock framebuffers before accessing them
fDisplay->api->make_current(fDisplay->api, context->st, context->buffer->stfbi,
st_api_make_current(context->st, context->buffer->stfbi,
context->buffer->stfbi);
Unlock();
+2 -3
View File
@@ -1207,8 +1207,8 @@ st_framebuffer_reuse_or_create(struct st_context *st,
}
static bool
st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
bool
st_api_make_current(struct st_context_iface *stctxi,
struct st_framebuffer_iface *stdrawi,
struct st_framebuffer_iface *streadi)
{
@@ -1453,7 +1453,6 @@ static const struct st_api st_gl_api = {
.name = "Mesa " PACKAGE_VERSION,
.query_versions = st_api_query_versions,
.create_context = st_api_create_context,
.make_current = st_api_make_current,
};