summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-09-27 18:59:56 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-10-05 15:42:13 +0200
commit616e36674a1079dcfa131b3c9155cc473441b3de (patch)
tree329382b2958e2fbb03e296906f6c7498082ae1a9
parente56e1f8119f28eebbe6fbe7040c80a6dd884f5fd (diff)
r300: use the new parent/child pools for transfers (v2)
v2: slab_alloc_st -> slab_alloc Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/gallium/drivers/r300/r300_context.c5
-rw-r--r--src/gallium/drivers/r300/r300_context.h2
-rw-r--r--src/gallium/drivers/r300/r300_screen.c3
-rw-r--r--src/gallium/drivers/r300/r300_screen.h2
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c6
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 3e5f1d69fd..b914cdb919 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 592479a05a..264ace530a 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 f6949ce191..4d41693331 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 5cd5a4005c..4b783af959 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 4747058286..95ada570e6 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 =