r300: use the new parent/child pools for transfers (v2)
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 27 Sep 2016 16:59:56 +0000 (18:59 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 5 Oct 2016 13:42:13 +0000 (15:42 +0200)
v2: slab_alloc_st -> slab_alloc

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_screen.h
src/gallium/drivers/r300/r300_screen_buffer.c

index 3e5f1d69fd409a9cc18f40e656b62354d862c9a0..b914cdb919b3c58b17b3dd023bc6f55c4e9f457a 100644 (file)
@@ -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)
index 592479a05a969ea29aa48d208b6b7d33b1ce9332..264ace530a25b406750d92ef1fe1e76e6bb56c22 100644 (file)
@@ -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;
index f6949ce191b4b97d4269af87db7e4c79cbfbc8fb..4d416933319c77a77d92ffce91a2c703fd5c9e45 100644 (file)
@@ -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);
 
index 5cd5a4005c316265c4b76cf5a752602967b6b126..4b783af959d100602cb4a9e22ff90aac3016a533 100644 (file)
@@ -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;
index 4747058286e9ca58284288ea5e4fe7e0ac4e0cea..95ada570e66d9128195e953c0cadcd93357ae07f 100644 (file)
@@ -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 =