[Mesa-dev] [PATCH 1/2] st/mesa: unduplicate st_check_sync code
Marek Olšák
maraeo at gmail.com
Tue Oct 25 11:18:43 UTC 2016
From: Marek Olšák <marek.olsak at amd.com>
It's the same as st_client_wait_sync. Discovered by Michel.
This is needed to make the following fix simpler.
Cc: 12.0 13.0 <mesa-stable at lists.freedesktop.org>
---
src/mesa/state_tracker/st_cb_syncobj.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c
index 123925a..749c124 100644
--- a/src/mesa/state_tracker/st_cb_syncobj.c
+++ b/src/mesa/state_tracker/st_cb_syncobj.c
@@ -69,38 +69,20 @@ static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_sync_object *so = (struct st_sync_object*)obj;
assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0);
assert(so->fence == NULL);
pipe->flush(pipe, &so->fence, PIPE_FLUSH_DEFERRED);
}
-static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
-{
- struct pipe_context *pipe = st_context(ctx)->pipe;
- struct pipe_screen *screen = pipe->screen;
- struct st_sync_object *so = (struct st_sync_object*)obj;
-
- /* If the fence doesn't exist, assume it's signalled. */
- if (!so->fence) {
- so->b.StatusFlag = GL_TRUE;
- return;
- }
-
- if (screen->fence_finish(screen, pipe, so->fence, 0)) {
- screen->fence_reference(screen, &so->fence, NULL);
- so->b.StatusFlag = GL_TRUE;
- }
-}
-
static 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 = pipe->screen;
struct st_sync_object *so = (struct st_sync_object*)obj;
/* If the fence doesn't exist, assume it's signalled. */
if (!so->fence) {
@@ -113,27 +95,31 @@ static void st_client_wait_sync(struct gl_context *ctx,
* - the SYNC_FLUSH_COMMANDS_BIT bit is set in flags,
* - sync is unsignaled when ClientWaitSync is called,
* - and the calls to ClientWaitSync and FenceSync were issued from
* the same context,
* then the GL will behave as if the equivalent of Flush were inserted
* immediately after the creation of sync.
*
* Assume GL_SYNC_FLUSH_COMMANDS_BIT is always set, because applications
* forget to set it.
*/
- if (so->fence &&
- screen->fence_finish(screen, pipe, so->fence, timeout)) {
+ if (screen->fence_finish(screen, pipe, so->fence, timeout)) {
screen->fence_reference(screen, &so->fence, NULL);
so->b.StatusFlag = GL_TRUE;
}
}
+static 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)
{
/* NO-OP.
* Neither Gallium nor DRM interfaces support blocking on the GPU. */
}
void st_init_syncobj_functions(struct dd_function_table *functions)
{
--
2.7.4
More information about the mesa-dev
mailing list