From 616e36674a1079dcfa131b3c9155cc473441b3de Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Tue, 27 Sep 2016 18:59:56 +0200 Subject: [PATCH] r300: use the new parent/child pools for transfers (v2) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit v2: slab_alloc_st -> slab_alloc Reviewed-by: Marek Olšák --- 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 3e5f1d69fd4..b914cdb919b 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 592479a05a9..264ace530a2 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 f6949ce191b..4d416933319 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 5cd5a4005c3..4b783af959d 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 4747058286e..95ada570e66 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 = -- 2.30.2