From 86368a5fa2ed15cd07cdeced724d1ce3bfbc9b80 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 5 Jul 2021 15:59:42 +1000 Subject: [PATCH] crocus: add unsync transfer pool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Zoltán Böszörményi Part-of: --- src/gallium/drivers/crocus/crocus_context.c | 2 ++ src/gallium/drivers/crocus/crocus_context.h | 4 ++++ src/gallium/drivers/crocus/crocus_resource.c | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/crocus/crocus_context.c b/src/gallium/drivers/crocus/crocus_context.c index c417c2f3c9e..d0758dc1a2a 100644 --- a/src/gallium/drivers/crocus/crocus_context.c +++ b/src/gallium/drivers/crocus/crocus_context.c @@ -200,6 +200,7 @@ crocus_destroy_context(struct pipe_context *ctx) crocus_bo_unreference(ice->workaround_bo); slab_destroy_child(&ice->transfer_pool); + slab_destroy_child(&ice->transfer_pool_unsync); crocus_batch_free(&ice->batches[CROCUS_BATCH_RENDER]); if (ice->batches[CROCUS_BATCH_COMPUTE].ice) @@ -280,6 +281,7 @@ crocus_create_context(struct pipe_screen *pscreen, void *priv, unsigned flags) crocus_init_program_cache(ice); slab_create_child(&ice->transfer_pool, &screen->transfer_pool); + slab_create_child(&ice->transfer_pool_unsync, &screen->transfer_pool); ice->query_buffer_uploader = u_upload_create(ctx, 4096, PIPE_BIND_CUSTOM, PIPE_USAGE_STAGING, diff --git a/src/gallium/drivers/crocus/crocus_context.h b/src/gallium/drivers/crocus/crocus_context.h index fc2cea03d7f..9aab10655a7 100644 --- a/src/gallium/drivers/crocus/crocus_context.h +++ b/src/gallium/drivers/crocus/crocus_context.h @@ -26,6 +26,7 @@ #include "pipe/p_context.h" #include "pipe/p_state.h" #include "util/u_debug.h" +#include "util/u_threaded_context.h" #include "intel/blorp/blorp.h" #include "intel/dev/intel_debug.h" #include "intel/compiler/brw_compiler.h" @@ -451,6 +452,9 @@ struct crocus_context { /** Slab allocator for crocus_transfer_map objects. */ struct slab_child_pool transfer_pool; + /** Slab allocator for threaded_context's crocus_transfer_map objects */ + struct slab_child_pool transfer_pool_unsync; + struct blorp_context blorp; int batch_count; diff --git a/src/gallium/drivers/crocus/crocus_resource.c b/src/gallium/drivers/crocus/crocus_resource.c index eae2a0873af..7a7735b4aba 100644 --- a/src/gallium/drivers/crocus/crocus_resource.c +++ b/src/gallium/drivers/crocus/crocus_resource.c @@ -1580,7 +1580,12 @@ crocus_transfer_map(struct pipe_context *ctx, (usage & PIPE_MAP_DIRECTLY)) return NULL; - struct crocus_transfer *map = slab_alloc(&ice->transfer_pool); + struct crocus_transfer *map; + if (usage & TC_TRANSFER_MAP_THREADED_UNSYNC) + map = slab_alloc(&ice->transfer_pool_unsync); + else + map = slab_alloc(&ice->transfer_pool); + struct pipe_transfer *xfer = &map->base.b; if (!map)