diff options
author | Marek Olšák <[email protected]> | 2016-08-06 16:41:42 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-08-10 01:11:10 +0200 |
commit | 54272e18a682c8b82d4a86b2c07b51c303d8cead (patch) | |
tree | c9c0ac7ad2fb4144ebeb9c7851eaa19a8103973c /src/gallium/drivers | |
parent | c6043e7d54fc48771856a50235f9141b711151f3 (diff) |
gallium: add a pipe_context parameter to fence_finish
required by glClientWaitSync (GL 4.5 Core spec) that can optionally flush
the context
Reviewed-by: Rob Clark <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
27 files changed, 40 insertions, 20 deletions
diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c index 7abcf877a3b..3124d0552d0 100644 --- a/src/gallium/drivers/ddebug/dd_draw.c +++ b/src/gallium/drivers/ddebug/dd_draw.c @@ -548,7 +548,7 @@ dd_flush_and_check_hang(struct dd_context *dctx, if (!fence) return false; - idle = screen->fence_finish(screen, fence, timeout_ms * 1000000); + idle = screen->fence_finish(screen, NULL, fence, timeout_ms * 1000000); screen->fence_reference(screen, &fence, NULL); if (!idle) fprintf(stderr, "dd: GPU hang detected!\n"); diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c index 412ea365ce2..3deba0a6e27 100644 --- a/src/gallium/drivers/ddebug/dd_screen.c +++ b/src/gallium/drivers/ddebug/dd_screen.c @@ -263,12 +263,14 @@ dd_screen_fence_reference(struct pipe_screen *_screen, static boolean dd_screen_fence_finish(struct pipe_screen *_screen, + struct pipe_context *_ctx, struct pipe_fence_handle *fence, uint64_t timeout) { struct pipe_screen *screen = dd_screen(_screen)->screen; + struct pipe_context *ctx = _ctx ? dd_context(_ctx)->pipe : NULL; - return screen->fence_finish(screen, fence, timeout); + return screen->fence_finish(screen, ctx, fence, timeout); } diff --git a/src/gallium/drivers/freedreno/freedreno_fence.c b/src/gallium/drivers/freedreno/freedreno_fence.c index 5125f091860..df4cf4dd560 100644 --- a/src/gallium/drivers/freedreno/freedreno_fence.c +++ b/src/gallium/drivers/freedreno/freedreno_fence.c @@ -51,6 +51,7 @@ fd_screen_fence_ref(struct pipe_screen *pscreen, } boolean fd_screen_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence, uint64_t timeout) { diff --git a/src/gallium/drivers/freedreno/freedreno_fence.h b/src/gallium/drivers/freedreno/freedreno_fence.h index 06c314a6116..df7664bf8cd 100644 --- a/src/gallium/drivers/freedreno/freedreno_fence.h +++ b/src/gallium/drivers/freedreno/freedreno_fence.h @@ -35,6 +35,7 @@ void fd_screen_fence_ref(struct pipe_screen *pscreen, struct pipe_fence_handle **ptr, struct pipe_fence_handle *pfence); boolean fd_screen_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *pfence, uint64_t timeout); struct pipe_fence_handle * fd_fence_create(struct pipe_context *pctx, diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 6b5218bc467..ab3d4a6b277 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -500,6 +500,7 @@ i915_fence_reference(struct pipe_screen *screen, static boolean i915_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence, uint64_t timeout) { diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index 448f512d7d1..e98b6f20c39 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -696,6 +696,7 @@ ilo_screen_fence_reference(struct pipe_screen *screen, static boolean ilo_screen_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence, uint64_t timeout) { diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index 241c2ccafb7..452753f8810 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -82,7 +82,8 @@ llvmpipe_finish( struct pipe_context *pipe, struct pipe_fence_handle *fence = NULL; llvmpipe_flush(pipe, &fence, reason); if (fence) { - pipe->screen->fence_finish(pipe->screen, fence, PIPE_TIMEOUT_INFINITE); + pipe->screen->fence_finish(pipe->screen, NULL, fence, + PIPE_TIMEOUT_INFINITE); pipe->screen->fence_reference(pipe->screen, &fence, NULL); } } diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 61c3fb7a410..1c00aa91034 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -572,6 +572,7 @@ llvmpipe_fence_reference(struct pipe_screen *screen, */ static boolean llvmpipe_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence_handle, uint64_t timeout) { diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 2c421cc748c..f59e101cafb 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -70,6 +70,7 @@ nouveau_screen_fence_ref(struct pipe_screen *pscreen, static boolean nouveau_screen_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *pfence, uint64_t timeout) { diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 7d2ea4a4767..b69e5246ef0 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -698,6 +698,7 @@ static void r300_fence_reference(struct pipe_screen *screen, } static boolean r300_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence, uint64_t timeout) { diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 2d05e16fc15..4dd2b3b7575 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -954,6 +954,7 @@ static void r600_fence_reference(struct pipe_screen *screen, } static boolean r600_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence, uint64_t timeout) { diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index 87352032ad7..592cec1c2c0 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -215,7 +215,7 @@ static bool r600_query_sw_get_result(struct r600_common_context *rctx, return true; case PIPE_QUERY_GPU_FINISHED: { struct pipe_screen *screen = rctx->b.screen; - result->b = screen->fence_finish(screen, query->fence, + result->b = screen->fence_finish(screen, NULL, query->fence, wait ? PIPE_TIMEOUT_INFINITE : 0); return result->b; } diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c index c2950e4a703..8d216691fdb 100644 --- a/src/gallium/drivers/rbug/rbug_screen.c +++ b/src/gallium/drivers/rbug/rbug_screen.c @@ -229,15 +229,15 @@ rbug_screen_fence_reference(struct pipe_screen *_screen, static boolean rbug_screen_fence_finish(struct pipe_screen *_screen, + struct pipe_context *_ctx, struct pipe_fence_handle *fence, uint64_t timeout) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; + struct pipe_context *ctx = _ctx ? rbug_context(_ctx)->pipe : NULL; - return screen->fence_finish(screen, - fence, - timeout); + return screen->fence_finish(screen, ctx, fence, timeout); } boolean diff --git a/src/gallium/drivers/softpipe/sp_fence.c b/src/gallium/drivers/softpipe/sp_fence.c index 6168236ec96..1861b0da07e 100644 --- a/src/gallium/drivers/softpipe/sp_fence.c +++ b/src/gallium/drivers/softpipe/sp_fence.c @@ -42,6 +42,7 @@ softpipe_fence_reference(struct pipe_screen *screen, static boolean softpipe_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence, uint64_t timeout) { diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index 29fcf7f1628..656d8a3257a 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -153,7 +153,7 @@ softpipe_flush_resource(struct pipe_context *pipe, * This is for illustrative purposes only, as softpipe does not * have fences. */ - pipe->screen->fence_finish(pipe->screen, fence, + pipe->screen->fence_finish(pipe->screen, NULL, fence, PIPE_TIMEOUT_INFINITE); pipe->screen->fence_reference(pipe->screen, &fence, NULL); } diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c index c7f4aae246d..f623caf9401 100644 --- a/src/gallium/drivers/svga/svga_context.c +++ b/src/gallium/drivers/svga/svga_context.c @@ -348,7 +348,7 @@ void svga_context_flush( struct svga_context *svga, if (SVGA_DEBUG & DEBUG_SYNC) { if (fence) - svga->pipe.screen->fence_finish( svga->pipe.screen, fence, + svga->pipe.screen->fence_finish( svga->pipe.screen, NULL, fence, PIPE_TIMEOUT_INFINITE); } @@ -369,7 +369,7 @@ svga_context_finish(struct svga_context *svga) struct pipe_fence_handle *fence = NULL; svga_context_flush(svga, &fence); - screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE); + screen->fence_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE); screen->fence_reference(screen, &fence, NULL); } diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 13253aca43f..7c4e305f504 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -804,6 +804,7 @@ svga_fence_reference(struct pipe_screen *screen, static boolean svga_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence, uint64_t timeout) { diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp index 1083c9de194..835c35393f0 100644 --- a/src/gallium/drivers/swr/swr_context.cpp +++ b/src/gallium/drivers/swr/swr_context.cpp @@ -128,7 +128,7 @@ swr_transfer_map(struct pipe_context *pipe, if (!swr_is_fence_pending(screen->flush_fence)) swr_fence_submit(swr_context(pipe), screen->flush_fence); - swr_fence_finish(pipe->screen, screen->flush_fence, 0); + swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0); swr_resource_unused(resource); } } @@ -205,7 +205,7 @@ swr_resource_copy(struct pipe_context *pipe, swr_store_dirty_resource(pipe, src, SWR_TILE_RESOLVED); swr_store_dirty_resource(pipe, dst, SWR_TILE_RESOLVED); - swr_fence_finish(pipe->screen, screen->flush_fence, 0); + swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0); swr_resource_unused(src); swr_resource_unused(dst); diff --git a/src/gallium/drivers/swr/swr_draw.cpp b/src/gallium/drivers/swr/swr_draw.cpp index ab8d2750623..0f6a8c6d88c 100644 --- a/src/gallium/drivers/swr/swr_draw.cpp +++ b/src/gallium/drivers/swr/swr_draw.cpp @@ -239,7 +239,7 @@ swr_finish(struct pipe_context *pipe) struct pipe_fence_handle *fence = nullptr; swr_flush(pipe, &fence, 0); - swr_fence_finish(pipe->screen, fence, 0); + swr_fence_finish(pipe->screen, NULL, fence, 0); swr_fence_reference(pipe->screen, &fence, NULL); } diff --git a/src/gallium/drivers/swr/swr_fence.cpp b/src/gallium/drivers/swr/swr_fence.cpp index 8a8e864397d..7fe24700bfa 100644 --- a/src/gallium/drivers/swr/swr_fence.cpp +++ b/src/gallium/drivers/swr/swr_fence.cpp @@ -111,6 +111,7 @@ swr_fence_reference(struct pipe_screen *screen, */ boolean swr_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence_handle, uint64_t timeout) { diff --git a/src/gallium/drivers/swr/swr_fence.h b/src/gallium/drivers/swr/swr_fence.h index 47f4d2e7c9f..80a4345af87 100644 --- a/src/gallium/drivers/swr/swr_fence.h +++ b/src/gallium/drivers/swr/swr_fence.h @@ -69,6 +69,7 @@ void swr_fence_reference(struct pipe_screen *screen, struct pipe_fence_handle *f); boolean swr_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence_handle, uint64_t timeout); diff --git a/src/gallium/drivers/swr/swr_query.cpp b/src/gallium/drivers/swr/swr_query.cpp index 7867db3fc12..5b8f059cdae 100644 --- a/src/gallium/drivers/swr/swr_query.cpp +++ b/src/gallium/drivers/swr/swr_query.cpp @@ -63,7 +63,7 @@ swr_destroy_query(struct pipe_context *pipe, struct pipe_query *q) if (pq->fence) { if (swr_is_fence_pending(pq->fence)) - swr_fence_finish(pipe->screen, pq->fence, 0); + swr_fence_finish(pipe->screen, NULL, pq->fence, 0); swr_fence_reference(pipe->screen, &pq->fence, NULL); } @@ -128,7 +128,7 @@ swr_get_query_result(struct pipe_context *pipe, if (!wait && !swr_is_fence_done(pq->fence)) return FALSE; - swr_fence_finish(pipe->screen, pq->fence, 0); + swr_fence_finish(pipe->screen, NULL, pq->fence, 0); swr_fence_reference(pipe->screen, &pq->fence, NULL); } diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index e0e59fa674c..df44967feee 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -657,7 +657,7 @@ swr_resource_destroy(struct pipe_screen *p_screen, struct pipe_resource *pt) if (!swr_is_fence_pending(screen->flush_fence)) swr_fence_submit(swr_context(pipe), screen->flush_fence); - swr_fence_finish(p_screen, screen->flush_fence, 0); + swr_fence_finish(p_screen, NULL, screen->flush_fence, 0); swr_resource_unused(pt); } @@ -692,7 +692,7 @@ swr_flush_frontbuffer(struct pipe_screen *p_screen, struct pipe_context *pipe = screen->pipe; if (pipe) { - swr_fence_finish(p_screen, screen->flush_fence, 0); + swr_fence_finish(p_screen, NULL, screen->flush_fence, 0); swr_resource_unused(resource); SwrEndFrame(swr_context(pipe)->swrContext); } @@ -712,7 +712,7 @@ swr_destroy_screen(struct pipe_screen *p_screen) fprintf(stderr, "SWR destroy screen!\n"); - swr_fence_finish(p_screen, screen->flush_fence, 0); + swr_fence_finish(p_screen, NULL, screen->flush_fence, 0); swr_fence_reference(p_screen, &screen->flush_fence, NULL); JitDestroyContext(screen->hJitMgr); diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index dac95ce42e7..2df79855358 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -1390,7 +1390,7 @@ swr_update_derived(struct pipe_context *pipe, /* Ensure that any in-progress attachment change StoreTiles finish */ if (swr_is_fence_pending(screen->flush_fence)) - swr_fence_finish(pipe->screen, screen->flush_fence, 0); + swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0); /* Finally, update the in-use status of all resources involved in draw */ swr_update_resource_status(pipe, p_draw_info); diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 260f1df5ce7..67241ca2ba1 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -402,20 +402,23 @@ trace_screen_fence_reference(struct pipe_screen *_screen, static boolean trace_screen_fence_finish(struct pipe_screen *_screen, + struct pipe_context *_ctx, struct pipe_fence_handle *fence, uint64_t timeout) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; + struct pipe_context *ctx = _ctx ? trace_context(_ctx)->pipe : NULL; int result; trace_dump_call_begin("pipe_screen", "fence_finish"); trace_dump_arg(ptr, screen); + trace_dump_arg(ptr, ctx); trace_dump_arg(ptr, fence); trace_dump_arg(uint, timeout); - result = screen->fence_finish(screen, fence, timeout); + result = screen->fence_finish(screen, ctx, fence, timeout); trace_dump_ret(bool, result); diff --git a/src/gallium/drivers/vc4/vc4_fence.c b/src/gallium/drivers/vc4/vc4_fence.c index b6fb2a8a460..f61e7c6a5e8 100644 --- a/src/gallium/drivers/vc4/vc4_fence.c +++ b/src/gallium/drivers/vc4/vc4_fence.c @@ -61,6 +61,7 @@ vc4_fence_reference(struct pipe_screen *pscreen, static boolean vc4_fence_finish(struct pipe_screen *pscreen, + struct pipe_context *ctx, struct pipe_fence_handle *pf, uint64_t timeout_ns) { diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index fd3d35dc745..e01b5b405af 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -524,6 +524,7 @@ static void virgl_fence_reference(struct pipe_screen *screen, } static boolean virgl_fence_finish(struct pipe_screen *screen, + struct pipe_context *ctx, struct pipe_fence_handle *fence, uint64_t timeout) { |