From 3a71eac783ea5a1c16772f8ec91c4a01ca32504d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 10 Nov 2017 19:08:50 +0100 Subject: [PATCH] st/dri: fix deadlock when waiting on android fences MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Android fences can't be deferred, because st/dri calls fence_finish with ctx = NULL, so the driver can't flush u_threaded_context. Reviewed-by: Nicolai Hähnle --- src/gallium/include/state_tracker/st_api.h | 3 +-- src/gallium/state_trackers/dri/dri_helpers.c | 3 +-- src/mesa/state_tracker/st_manager.c | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 6cdaefc902f..a407b980d94 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -147,8 +147,7 @@ enum st_attachment_type { #define ST_FLUSH_FRONT (1 << 0) #define ST_FLUSH_END_OF_FRAME (1 << 1) #define ST_FLUSH_WAIT (1 << 2) -#define ST_FLUSH_DEFERRED (1 << 3) -#define ST_FLUSH_FENCE_FD (1 << 4) +#define ST_FLUSH_FENCE_FD (1 << 3) /** * Value to st_manager->get_param function. diff --git a/src/gallium/state_trackers/dri/dri_helpers.c b/src/gallium/state_trackers/dri/dri_helpers.c index 4a61455b1f9..37ab2c2f404 100644 --- a/src/gallium/state_trackers/dri/dri_helpers.c +++ b/src/gallium/state_trackers/dri/dri_helpers.c @@ -116,8 +116,7 @@ dri2_create_fence_fd(__DRIcontext *_ctx, int fd) if (fd == -1) { /* exporting driver created fence, flush: */ - stapi->flush(stapi, ST_FLUSH_DEFERRED | ST_FLUSH_FENCE_FD, - &fence->pipe_fence); + stapi->flush(stapi, ST_FLUSH_FENCE_FD, &fence->pipe_fence); } else { /* importing a foreign fence fd: */ ctx->create_fence_fd(ctx, &fence->pipe_fence, fd); diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 43d5dfdced2..4a1998cae63 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -634,8 +634,6 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags, if (flags & ST_FLUSH_END_OF_FRAME) pipe_flags |= PIPE_FLUSH_END_OF_FRAME; - if (flags & ST_FLUSH_DEFERRED) - pipe_flags |= PIPE_FLUSH_DEFERRED; if (flags & ST_FLUSH_FENCE_FD) pipe_flags |= PIPE_FLUSH_FENCE_FD; -- 2.30.2