diff options
author | Marek Vasut <[email protected]> | 2019-06-04 00:22:49 +0200 |
---|---|---|
committer | Lucas Stach <[email protected]> | 2019-08-14 10:36:36 +0200 |
commit | 8f97262cddc9950df6c5a8eddaff5135b2c78b9a (patch) | |
tree | 1610f3b5d6f509480f117b792ea6e05271f74dba /src/gallium/drivers/etnaviv/etnaviv_context.c | |
parent | 6bb4b6d07816eb116dd07884b4f593916e3daf88 (diff) |
etnaviv: Use reentrant screen lock around flush
The flush callback may be called on the same pipe context, and thus
the same stream, from two different threads of execution. However,
etna_cmd_stream_flush{,2}() must not be called on the same stream
from two different threads of execution as that would mess up the
etna_bo refcounting and likely have other ugly side effects.
Fix this by using a reentrant screen lock around the flush callback.
Signed-off-by: Marek Vasut <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Reviewed-by: Lucas Stach <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_context.c')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_context.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c index 47eeeecfc74..e49aaacf8fc 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_context.c +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c @@ -310,8 +310,11 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence, enum pipe_flush_flags flags) { struct etna_context *ctx = etna_context(pctx); + struct etna_screen *screen = ctx->screen; int out_fence_fd = -1; + mtx_lock(&screen->lock); + list_for_each_entry(struct etna_hw_query, hq, &ctx->active_hw_queries, node) etna_hw_query_suspend(hq, ctx); @@ -324,6 +327,8 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence, if (fence) *fence = etna_fence_create(pctx, out_fence_fd); + + mtx_unlock(&screen->lock); } static void |