Mesa (main): mesa/st: direct call sync object functions
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Dec 7 13:47:27 UTC 2021
Module: Mesa
Branch: main
Commit: 8fe4ff2fdac0c5e21cf56d3dc1567af73475226e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8fe4ff2fdac0c5e21cf56d3dc1567af73475226e
Author: Dave Airlie <airlied at redhat.com>
Date: Mon Dec 6 16:58:22 2021 +1000
mesa/st: direct call sync object functions
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14073>
---
src/mesa/main/dd.h | 15 ---------------
src/mesa/main/syncobj.c | 16 +++++++++-------
src/mesa/state_tracker/st_cb_syncobj.c | 33 ++++++++++++---------------------
src/mesa/state_tracker/st_cb_syncobj.h | 18 ++++++++++++------
src/mesa/state_tracker/st_context.c | 2 --
5 files changed, 33 insertions(+), 51 deletions(-)
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 0763042c334..afedf30b715 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -889,21 +889,6 @@ struct dd_function_table {
/**@}*/
- /**
- * \name GL_ARB_sync interfaces
- */
- /*@{*/
- struct gl_sync_object * (*NewSyncObject)(struct gl_context *);
- void (*FenceSync)(struct gl_context *, struct gl_sync_object *,
- GLenum, GLbitfield);
- void (*DeleteSyncObject)(struct gl_context *, struct gl_sync_object *);
- void (*CheckSync)(struct gl_context *, struct gl_sync_object *);
- void (*ClientWaitSync)(struct gl_context *, struct gl_sync_object *,
- GLbitfield, GLuint64);
- void (*ServerWaitSync)(struct gl_context *, struct gl_sync_object *,
- GLbitfield, GLuint64);
- /*@}*/
-
/**
* \name GL_OES_draw_texture interface
*/
diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c
index d2ddadb498d..cadaeb30797 100644
--- a/src/mesa/main/syncobj.c
+++ b/src/mesa/main/syncobj.c
@@ -68,6 +68,8 @@
#include "syncobj.h"
+#include "state_tracker/st_cb_syncobj.h"
+
/**
* Allocate/init the context state related to sync objects.
*/
@@ -134,7 +136,7 @@ _mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj,
_mesa_set_remove(ctx->Shared->SyncObjects, entry);
simple_mtx_unlock(&ctx->Shared->Mutex);
- ctx->Driver.DeleteSyncObject(ctx, syncObj);
+ st_delete_sync_object(ctx, syncObj);
} else {
simple_mtx_unlock(&ctx->Shared->Mutex);
}
@@ -204,7 +206,7 @@ fence_sync(struct gl_context *ctx, GLenum condition, GLbitfield flags)
{
struct gl_sync_object *syncObj;
- syncObj = ctx->Driver.NewSyncObject(ctx);
+ syncObj = st_new_sync_object(ctx);
if (syncObj != NULL) {
/* The name is not currently used, and it is never visible to
* applications. If sync support is extended to provide support for
@@ -218,7 +220,7 @@ fence_sync(struct gl_context *ctx, GLenum condition, GLbitfield flags)
syncObj->Flags = flags;
syncObj->StatusFlag = 0;
- ctx->Driver.FenceSync(ctx, syncObj, condition, flags);
+ st_fence_sync(ctx, syncObj, condition, flags);
simple_mtx_lock(&ctx->Shared->Mutex);
_mesa_set_add(ctx->Shared->SyncObjects, syncObj);
@@ -273,14 +275,14 @@ client_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj,
* ClientWaitSync was called. ALREADY_SIGNALED will always be returned
* if <sync> was signaled, even if the value of <timeout> is zero.
*/
- ctx->Driver.CheckSync(ctx, syncObj);
+ st_check_sync(ctx, syncObj);
if (syncObj->StatusFlag) {
ret = GL_ALREADY_SIGNALED;
} else {
if (timeout == 0) {
ret = GL_TIMEOUT_EXPIRED;
} else {
- ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout);
+ st_client_wait_sync(ctx, syncObj, flags, timeout);
ret = syncObj->StatusFlag
? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED;
@@ -330,7 +332,7 @@ static void
wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj,
GLbitfield flags, GLuint64 timeout)
{
- ctx->Driver.ServerWaitSync(ctx, syncObj, flags, timeout);
+ st_server_wait_sync(ctx, syncObj, flags, timeout);
_mesa_unref_sync_object(ctx, syncObj, 1);
}
@@ -405,7 +407,7 @@ _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length,
* this call won't block. It just updates state in the common object
* data from the current driver state.
*/
- ctx->Driver.CheckSync(ctx, syncObj);
+ st_check_sync(ctx, syncObj);
v[0] = (syncObj->StatusFlag) ? GL_SIGNALED : GL_UNSIGNALED;
size = 1;
diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c
index ccad4b626a5..2149289241b 100644
--- a/src/mesa/state_tracker/st_cb_syncobj.c
+++ b/src/mesa/state_tracker/st_cb_syncobj.c
@@ -46,7 +46,7 @@ struct st_sync_object {
};
-static struct gl_sync_object *st_new_sync_object(struct gl_context *ctx)
+struct gl_sync_object *st_new_sync_object(struct gl_context *ctx)
{
struct st_sync_object *so = CALLOC_STRUCT(st_sync_object);
@@ -54,8 +54,8 @@ static struct gl_sync_object *st_new_sync_object(struct gl_context *ctx)
return &so->b;
}
-static void st_delete_sync_object(struct gl_context *ctx,
- struct gl_sync_object *obj)
+void st_delete_sync_object(struct gl_context *ctx,
+ struct gl_sync_object *obj)
{
struct pipe_screen *screen = st_context(ctx)->screen;
struct st_sync_object *so = (struct st_sync_object*)obj;
@@ -66,8 +66,8 @@ static void st_delete_sync_object(struct gl_context *ctx,
free(so);
}
-static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
- GLenum condition, GLbitfield flags)
+void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
+ GLenum condition, GLbitfield flags)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_sync_object *so = (struct st_sync_object*)obj;
@@ -79,9 +79,9 @@ static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
pipe->flush(pipe, &so->fence, ctx->Shared->RefCount == 1 ? PIPE_FLUSH_DEFERRED : 0);
}
-static void st_client_wait_sync(struct gl_context *ctx,
- struct gl_sync_object *obj,
- GLbitfield flags, GLuint64 timeout)
+void st_client_wait_sync(struct gl_context *ctx,
+ struct gl_sync_object *obj,
+ GLbitfield flags, GLuint64 timeout)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct pipe_screen *screen = st_context(ctx)->screen;
@@ -123,14 +123,14 @@ static void st_client_wait_sync(struct gl_context *ctx,
screen->fence_reference(screen, &fence, NULL);
}
-static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
+void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
{
st_client_wait_sync(ctx, obj, 0, 0);
}
-static void st_server_wait_sync(struct gl_context *ctx,
- struct gl_sync_object *obj,
- GLbitfield flags, GLuint64 timeout)
+void st_server_wait_sync(struct gl_context *ctx,
+ struct gl_sync_object *obj,
+ GLbitfield flags, GLuint64 timeout)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct pipe_screen *screen = st_context(ctx)->screen;
@@ -158,12 +158,3 @@ static void st_server_wait_sync(struct gl_context *ctx,
screen->fence_reference(screen, &fence, NULL);
}
-void st_init_syncobj_functions(struct dd_function_table *functions)
-{
- functions->NewSyncObject = st_new_sync_object;
- functions->FenceSync = st_fence_sync;
- functions->DeleteSyncObject = st_delete_sync_object;
- functions->CheckSync = st_check_sync;
- functions->ClientWaitSync = st_client_wait_sync;
- functions->ServerWaitSync = st_server_wait_sync;
-}
diff --git a/src/mesa/state_tracker/st_cb_syncobj.h b/src/mesa/state_tracker/st_cb_syncobj.h
index c254684780c..b80541cd9b9 100644
--- a/src/mesa/state_tracker/st_cb_syncobj.h
+++ b/src/mesa/state_tracker/st_cb_syncobj.h
@@ -28,11 +28,17 @@
#ifndef ST_CB_SYNCOBJ_H
#define ST_CB_SYNCOBJ_H
+struct gl_sync_object *st_new_sync_object(struct gl_context *ctx);
+void st_delete_sync_object(struct gl_context *ctx,
+ struct gl_sync_object *obj);
+void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
+ GLenum condition, GLbitfield flags);
+void st_client_wait_sync(struct gl_context *ctx,
+ struct gl_sync_object *obj,
+ GLbitfield flags, GLuint64 timeout);
-struct dd_function_table;
-
-extern void
-st_init_syncobj_functions(struct dd_function_table *functions);
-
-
+void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj);
+void st_server_wait_sync(struct gl_context *ctx,
+ struct gl_sync_object *obj,
+ GLbitfield flags, GLuint64 timeout);
#endif /* ST_CB_SYNCOBJ_H */
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index b14c9fda536..dc0669341ef 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -66,7 +66,6 @@
#include "st_cb_texture.h"
#include "st_cb_xformfb.h"
#include "st_cb_flush.h"
-#include "st_cb_syncobj.h"
#include "st_cb_texturebarrier.h"
#include "st_cb_viewport.h"
#include "st_atom.h"
@@ -970,7 +969,6 @@ st_init_driver_functions(struct pipe_screen *screen,
st_init_compute_functions(functions);
st_init_xformfb_functions(functions);
- st_init_syncobj_functions(functions);
st_init_vdpau_functions(functions);
More information about the mesa-commit
mailing list