From 0334ba150f429b7d6b0bdc003c4301e0ad5fa21d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Tue, 27 Sep 2016 19:06:13 +0200 Subject: [PATCH] freedreno: use the new parent/child pools for transfers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- 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 f8604f132ad..0b12409bac4 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 e1b7b237ad3..c4c08a682be 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 1874271c86b..addfc405695 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 598a81126e8..bc54539c676 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 03ee90a5513..db9050e71be 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 */ -- 2.30.2