freedreno: use the new parent/child pools for transfers
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 27 Sep 2016 17:06:13 +0000 (19:06 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 5 Oct 2016 13:42:17 +0000 (15:42 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/freedreno/freedreno_context.c
src/gallium/drivers/freedreno/freedreno_context.h
src/gallium/drivers/freedreno/freedreno_resource.c
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/freedreno/freedreno_screen.h

index f8604f132ad056e0d3685d12a2eb4267144a43d1..0b12409bac4db7902b9d4bc4260a1467710f7f98 100644 (file)
@@ -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);
index e1b7b237ad3858f95ed3d55c2fe154a2960c72f5..c4c08a682beb6a92417ea2e5eae3b40f003e57d2 100644 (file)
@@ -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;
index 1874271c86b618f71e8463722491095e45bef118..addfc405695f6fc2a32173759d1e707b8a6a6a8c 100644 (file)
@@ -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;
 
index 598a81126e895d9184875cd1c22edb577220411c..bc54539c676da2ab212225aa6555537fdfde11cb 100644 (file)
@@ -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;
index 03ee90a55132bc83c2c167d736f5c3d45bbd89a9..db9050e71be96b6c5451be81952895e3be8add64 100644 (file)
@@ -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 */