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

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


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

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Tue Sep 27 19:06:13 2016 +0200

freedreno: use the new parent/child pools for transfers

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

---

 src/gallium/drivers/freedreno/freedreno_context.c  | 5 ++---
 src/gallium/drivers/freedreno/freedreno_context.h  | 2 +-
 src/gallium/drivers/freedreno/freedreno_resource.c | 4 ++--
 src/gallium/drivers/freedreno/freedreno_screen.c   | 4 ++++
 src/gallium/drivers/freedreno/freedreno_screen.h   | 3 +++
 5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index f8604f1..0b12409 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -121,7 +121,7 @@ fd_context_destroy(struct pipe_context *pctx)
 	if (ctx->primconvert)
 		util_primconvert_destroy(ctx->primconvert);
 
-	slab_destroy(&ctx->transfer_pool);
+	slab_destroy_child(&ctx->transfer_pool);
 
 	for (i = 0; i < ARRAY_SIZE(ctx->pipe); i++) {
 		struct fd_vsc_pipe *pipe = &ctx->pipe[i];
@@ -265,8 +265,7 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
 		ctx->batch = fd_bc_alloc_batch(&screen->batch_cache, ctx);
 	}
 
-	slab_create(&ctx->transfer_pool, sizeof(struct fd_transfer),
-			16);
+	slab_create_child(&ctx->transfer_pool, &screen->transfer_pool);
 
 	fd_draw_init(pctx);
 	fd_resource_context_init(pctx);
diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h
index e1b7b23..c4c08a6 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.h
+++ b/src/gallium/drivers/freedreno/freedreno_context.h
@@ -121,7 +121,7 @@ struct fd_context {
 	struct primconvert_context *primconvert;
 
 	/* slab for pipe_transfer allocations: */
-	struct slab_mempool transfer_pool;
+	struct slab_child_pool transfer_pool;
 
 	/* slabs for fd_hw_sample and fd_hw_sample_period allocations: */
 	struct slab_mempool sample_pool;
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 1874271..addfc40 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -425,7 +425,7 @@ fd_resource_transfer_unmap(struct pipe_context *pctx,
 				   ptrans->box.x + ptrans->box.width);
 
 	pipe_resource_reference(&ptrans->resource, NULL);
-	slab_free_st(&ctx->transfer_pool, ptrans);
+	slab_free(&ctx->transfer_pool, ptrans);
 
 	free(trans->staging);
 }
@@ -451,7 +451,7 @@ fd_resource_transfer_map(struct pipe_context *pctx,
 	DBG("prsc=%p, level=%u, usage=%x, box=%dx%d+%d,%d", prsc, level, usage,
 		box->width, box->height, box->x, box->y);
 
-	ptrans = slab_alloc_st(&ctx->transfer_pool);
+	ptrans = slab_alloc(&ctx->transfer_pool);
 	if (!ptrans)
 		return NULL;
 
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 598a811..bc54539 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -138,6 +138,8 @@ fd_screen_destroy(struct pipe_screen *pscreen)
 
 	fd_bc_fini(&screen->batch_cache);
 
+	slab_destroy_parent(&screen->transfer_pool);
+
 	pipe_mutex_destroy(screen->lock);
 
 	free(screen);
@@ -696,6 +698,8 @@ fd_screen_create(struct fd_device *dev)
 	pscreen->fence_reference = fd_screen_fence_ref;
 	pscreen->fence_finish = fd_screen_fence_finish;
 
+	slab_create_parent(&screen->transfer_pool, sizeof(struct fd_transfer), 16);
+
 	util_format_s3tc_init();
 
 	return pscreen;
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h
index 03ee90a..db9050e 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.h
+++ b/src/gallium/drivers/freedreno/freedreno_screen.h
@@ -34,6 +34,7 @@
 
 #include "pipe/p_screen.h"
 #include "util/u_memory.h"
+#include "util/slab.h"
 #include "os/os_thread.h"
 
 #include "freedreno_batch_cache.h"
@@ -55,6 +56,8 @@ struct fd_screen {
 	/* place for winsys to stash it's own stuff: */
 	void *winsys_priv;
 
+	struct slab_parent_pool transfer_pool;
+
 	uint32_t gmemsize_bytes;
 	uint32_t device_id;
 	uint32_t gpu_id;         /* 220, 305, etc */




More information about the mesa-commit mailing list