Mesa (main): crocus: add unsync transfer pool

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 6 04:40:57 UTC 2021


Module: Mesa
Branch: main
Commit: 86368a5fa2ed15cd07cdeced724d1ce3bfbc9b80
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=86368a5fa2ed15cd07cdeced724d1ce3bfbc9b80

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Jul  5 15:59:42 2021 +1000

crocus: add unsync transfer pool

Reviewed-by: Zoltán Böszörményi <zboszor at pr.hu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11710>

---

 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)



More information about the mesa-commit mailing list