gallium/radeon: use the new parent/child pools for transfers
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 27 Sep 2016 16:53:45 +0000 (18:53 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 5 Oct 2016 13:42:07 +0000 (15:42 +0200)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97894
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeon/r600_buffer_common.c
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/radeon/r600_pipe_common.h

index 228674a02adaa52914cdc28aedc74b8b8b780e1d..74bec2626030c13b2ec7dd5a68b83b0521f7f406 100644 (file)
@@ -283,7 +283,7 @@ static void *r600_buffer_get_transfer(struct pipe_context *ctx,
                                      unsigned offset)
 {
        struct r600_common_context *rctx = (struct r600_common_context*)ctx;
-       struct r600_transfer *transfer = slab_alloc_st(&rctx->pool_transfers);
+       struct r600_transfer *transfer = slab_alloc(&rctx->pool_transfers);
 
        transfer->transfer.resource = resource;
        transfer->transfer.level = level;
@@ -468,7 +468,7 @@ static void r600_buffer_transfer_unmap(struct pipe_context *ctx,
        if (rtransfer->staging)
                r600_resource_reference(&rtransfer->staging, NULL);
 
-       slab_free_st(&rctx->pool_transfers, transfer);
+       slab_free(&rctx->pool_transfers, transfer);
 }
 
 void r600_buffer_subdata(struct pipe_context *ctx,
index 9e03aaa771bac9001e37b5be3114e5e68d13b067..3a5a854a9aafa137b0e4665a9a4199ee6ccb7202 100644 (file)
@@ -488,8 +488,7 @@ bool r600_common_context_init(struct r600_common_context *rctx,
                              struct r600_common_screen *rscreen,
                              unsigned context_flags)
 {
-       slab_create(&rctx->pool_transfers,
-                        sizeof(struct r600_transfer), 64);
+       slab_create_child(&rctx->pool_transfers, &rscreen->pool_transfers);
 
        rctx->screen = rscreen;
        rctx->ws = rscreen->ws;
@@ -590,7 +589,7 @@ void r600_common_context_cleanup(struct r600_common_context *rctx)
                u_upload_destroy(rctx->uploader);
        }
 
-       slab_destroy(&rctx->pool_transfers);
+       slab_destroy_child(&rctx->pool_transfers);
 
        if (rctx->allocator_zeroed_memory) {
                u_suballocator_destroy(rctx->allocator_zeroed_memory);
@@ -1183,6 +1182,8 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
        rscreen->chip_class = rscreen->info.chip_class;
        rscreen->debug_flags = debug_get_flags_option("R600_DEBUG", common_debug_options, 0);
 
+       slab_create_parent(&rscreen->pool_transfers, sizeof(struct r600_transfer), 64);
+
        rscreen->force_aniso = MIN2(16, debug_get_num_option("R600_TEX_ANISO", -1));
        if (rscreen->force_aniso >= 0) {
                printf("radeon: Forcing anisotropy filter to %ix\n",
@@ -1242,6 +1243,8 @@ void r600_destroy_common_screen(struct r600_common_screen *rscreen)
        pipe_mutex_destroy(rscreen->aux_context_lock);
        rscreen->aux_context->destroy(rscreen->aux_context);
 
+       slab_destroy_parent(&rscreen->pool_transfers);
+
        rscreen->ws->destroy(rscreen->ws);
        FREE(rscreen);
 }
index 6d03db6e1c705dfa528dea27c679c929e3dce4f7..4ee7daaa38c5696f2fdcce572fbda42a2ce0736e 100644 (file)
@@ -370,6 +370,8 @@ struct r600_common_screen {
        bool                            has_cp_dma;
        bool                            has_streamout;
 
+       struct slab_parent_pool         pool_transfers;
+
        /* Texture filter settings. */
        int                             force_aniso; /* -1 = disabled */
 
@@ -542,7 +544,7 @@ struct r600_common_context {
 
        struct u_upload_mgr             *uploader;
        struct u_suballocator           *allocator_zeroed_memory;
-       struct slab_mempool     pool_transfers;
+       struct slab_child_pool          pool_transfers;
 
        /* Current unaccounted memory usage. */
        uint64_t                        vram;