From 7a6643fb4cace23c8aef260fed7f28685d236fd0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 5 Dec 2017 20:04:11 +0100 Subject: [PATCH] radeonsi: use a separate allocator for fine fences MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Tested-by: Dieter Nützel Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeon/r600_pipe_common.c | 7 +++++++ src/gallium/drivers/radeon/r600_pipe_common.h | 1 + src/gallium/drivers/radeonsi/si_fence.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index d85f9f03110..9090e65aaa8 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -454,6 +454,11 @@ bool si_common_context_init(struct r600_common_context *rctx, if (!rctx->b.const_uploader) return false; + rctx->cached_gtt_allocator = u_upload_create(&rctx->b, 16 * 1024, + 0, PIPE_USAGE_STAGING, 0); + if (!rctx->cached_gtt_allocator) + return false; + rctx->ctx = rctx->ws->ctx_create(rctx->ws); if (!rctx->ctx) return false; @@ -498,6 +503,8 @@ void si_common_context_cleanup(struct r600_common_context *rctx) u_upload_destroy(rctx->b.stream_uploader); if (rctx->b.const_uploader) u_upload_destroy(rctx->b.const_uploader); + if (rctx->cached_gtt_allocator) + u_upload_destroy(rctx->cached_gtt_allocator); slab_destroy_child(&rctx->pool_transfers); slab_destroy_child(&rctx->pool_transfers_unsync); diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index d1fdea074e9..a8e632cf4ca 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -395,6 +395,7 @@ struct r600_common_context { struct pipe_fence_handle *last_gfx_fence; struct pipe_fence_handle *last_sdma_fence; struct r600_resource *eop_bug_scratch; + struct u_upload_mgr *cached_gtt_allocator; unsigned num_gfx_cs_flushes; unsigned initial_gfx_cs_size; unsigned gpu_reset_counter; diff --git a/src/gallium/drivers/radeonsi/si_fence.c b/src/gallium/drivers/radeonsi/si_fence.c index 0d165a14b54..3c4d75462af 100644 --- a/src/gallium/drivers/radeonsi/si_fence.c +++ b/src/gallium/drivers/radeonsi/si_fence.c @@ -151,7 +151,7 @@ static void si_fine_fence_set(struct si_context *ctx, assert(util_bitcount(flags & (PIPE_FLUSH_TOP_OF_PIPE | PIPE_FLUSH_BOTTOM_OF_PIPE)) == 1); /* Use uncached system memory for the fence. */ - u_upload_alloc(ctx->b.b.stream_uploader, 0, 4, 4, + u_upload_alloc(ctx->b.cached_gtt_allocator, 0, 4, 4, &fine->offset, (struct pipe_resource **)&fine->buf, (void **)&fence_ptr); if (!fine->buf) return; -- 2.30.2