diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-10-22 17:39:03 +0200 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-11-06 11:12:48 +0100 |
commit | 7fadbc83c4c9d8203cee63972d8b9a9682c0d0e1 (patch) | |
tree | c722f6be8be46158c09a0d2964f28aa35bfd3b9a | |
parent | 6369557a7b5c4fafa878fcabd1233fb57e365a83 (diff) |
st/mesa: use asynchronous flushes (TODO)
TODO: It looks like si_fence_server_sync still isn't strict enough
for unflushed fences.
-rw-r--r-- | src/mesa/state_tracker/st_cb_flush.c | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_syncobj.c | 26 |
2 files changed, 26 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index c8452d0e6f..5f4e2ac3cc 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -63,7 +63,7 @@ void st_finish( struct st_context *st ) { struct pipe_fence_handle *fence = NULL; - st_flush(st, &fence, 0); + st_flush(st, &fence, PIPE_FLUSH_ASYNC | PIPE_FLUSH_HINT_FINISH); if(fence) { st->pipe->screen->fence_finish(st->pipe->screen, NULL, fence, @@ -88,7 +88,7 @@ static void st_glFlush(struct gl_context *ctx) * synchronization issues. Calling finish() here will just hide * problems that need to be fixed elsewhere. */ - st_flush(st, NULL, 0); + st_flush(st, NULL, PIPE_FLUSH_ASYNC); st_manager_flush_frontbuffer(st); } diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c index 637fbe3b73..44323b4750 100644 --- a/src/mesa/state_tracker/st_cb_syncobj.c +++ b/src/mesa/state_tracker/st_cb_syncobj.c @@ -130,8 +130,30 @@ 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. */ + struct pipe_context *pipe = st_context(ctx)->pipe; + struct pipe_screen *screen = pipe->screen; + struct st_sync_object *so = (struct st_sync_object*)obj; + struct pipe_fence_handle *fence = NULL; + + /* Nothing needs to be done here if the driver does not support async + * flushes. */ + if (!pipe->fence_server_sync) + return; + + /* If the fence doesn't exist, assume it's signalled. */ + mtx_lock(&so->mutex); + if (!so->fence) { + mtx_unlock(&so->mutex); + so->b.StatusFlag = GL_TRUE; + return; + } + + /* We need a local copy of the fence pointer. */ + screen->fence_reference(screen, &fence, so->fence); + mtx_unlock(&so->mutex); + + pipe->fence_server_sync(pipe, fence); + screen->fence_reference(screen, &fence, NULL); } void st_init_syncobj_functions(struct dd_function_table *functions) |