Mesa (master): r300: use the new parent/child pools for transfers (v2)

Nicolai Hähnle nh at kemper.freedesktop.org
Wed Oct 5 13:46:55 UTC 2016


Module: Mesa
Branch: master
Commit: 616e36674a1079dcfa131b3c9155cc473441b3de
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=616e36674a1079dcfa131b3c9155cc473441b3de

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Tue Sep 27 18:59:56 2016 +0200

r300: use the new parent/child pools for transfers (v2)

v2: slab_alloc_st -> slab_alloc

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/drivers/r300/r300_context.c       | 5 ++---
 src/gallium/drivers/r300/r300_context.h       | 2 +-
 src/gallium/drivers/r300/r300_screen.c        | 3 +++
 src/gallium/drivers/r300/r300_screen.h        | 2 ++
 src/gallium/drivers/r300/r300_screen_buffer.c | 6 +++---
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 3e5f1d6..b914cdb 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -100,7 +100,7 @@ static void r300_destroy_context(struct pipe_context* context)
     rc_destroy_regalloc_state(&r300->fs_regalloc_state);
 
     /* XXX: No way to tell if this was initialized or not? */
-    slab_destroy(&r300->pool_transfers);
+    slab_destroy_child(&r300->pool_transfers);
 
     /* Free the structs allocated in r300_setup_atoms() */
     if (r300->aa_state.state) {
@@ -385,8 +385,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 
     r300->context.destroy = r300_destroy_context;
 
-    slab_create(&r300->pool_transfers,
-                     sizeof(struct pipe_transfer), 64);
+    slab_create_child(&r300->pool_transfers, &r300screen->pool_transfers);
 
     r300->ctx = rws->ctx_create(rws);
     if (!r300->ctx)
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 592479a..264ace5 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -596,7 +596,7 @@ struct r300_context {
     unsigned nr_vertex_buffers;
     struct u_upload_mgr *uploader;
 
-    struct slab_mempool pool_transfers;
+    struct slab_child_pool pool_transfers;
 
     /* Stat counter. */
     uint64_t flush_counter;
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index f6949ce..4d41693 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -676,6 +676,7 @@ static void r300_destroy_screen(struct pipe_screen* pscreen)
       return;
 
     pipe_mutex_destroy(r300screen->cmask_mutex);
+    slab_destroy_parent(&r300screen->pool_transfers);
 
     if (rws)
       rws->destroy(rws);
@@ -738,6 +739,8 @@ struct pipe_screen* r300_screen_create(struct radeon_winsys *rws)
 
     r300_init_screen_resource_functions(r300screen);
 
+    slab_create_parent(&r300screen->pool_transfers, sizeof(struct pipe_transfer), 64);
+
     util_format_s3tc_init();
     pipe_mutex_init(r300screen->cmask_mutex);
 
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 5cd5a40..4b783af 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -44,6 +44,8 @@ struct r300_screen {
     /** Combination of DBG_xxx flags */
     unsigned debug;
 
+    struct slab_parent_pool pool_transfers;
+
     /* The MSAA texture with CMASK access; */
     struct pipe_resource *cmask_resource;
     pipe_mutex cmask_mutex;
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index 4747058..95ada57 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -77,7 +77,7 @@ r300_buffer_transfer_map( struct pipe_context *context,
     struct pipe_transfer *transfer;
     uint8_t *map;
 
-    transfer = slab_alloc_st(&r300->pool_transfers);
+    transfer = slab_alloc(&r300->pool_transfers);
     transfer->resource = resource;
     transfer->level = level;
     transfer->usage = usage;
@@ -129,7 +129,7 @@ r300_buffer_transfer_map( struct pipe_context *context,
     map = rws->buffer_map(rbuf->buf, r300->cs, usage);
 
     if (!map) {
-        slab_free_st(&r300->pool_transfers, transfer);
+        slab_free(&r300->pool_transfers, transfer);
         return NULL;
     }
 
@@ -142,7 +142,7 @@ static void r300_buffer_transfer_unmap( struct pipe_context *pipe,
 {
     struct r300_context *r300 = r300_context(pipe);
 
-    slab_free_st(&r300->pool_transfers, transfer);
+    slab_free(&r300->pool_transfers, transfer);
 }
 
 static const struct u_resource_vtbl r300_buffer_vtbl =




More information about the mesa-commit mailing list