Mesa (master): vc4: 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: 2a83036fe29262c8761812c65d6e81c7198da54e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a83036fe29262c8761812c65d6e81c7198da54e

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

vc4: use the new parent/child pools for transfers

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

---

 src/gallium/drivers/vc4/vc4_context.c  | 5 ++---
 src/gallium/drivers/vc4/vc4_context.h  | 2 +-
 src/gallium/drivers/vc4/vc4_resource.c | 4 ++--
 src/gallium/drivers/vc4/vc4_screen.c   | 3 +++
 src/gallium/drivers/vc4/vc4_screen.h   | 3 +++
 5 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index 3863e44..b780b13 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -96,7 +96,7 @@ vc4_context_destroy(struct pipe_context *pctx)
         if (vc4->uploader)
                 u_upload_destroy(vc4->uploader);
 
-        slab_destroy(&vc4->transfer_pool);
+        slab_destroy_child(&vc4->transfer_pool);
 
         pipe_surface_reference(&vc4->framebuffer.cbufs[0], NULL);
         pipe_surface_reference(&vc4->framebuffer.zsbuf, NULL);
@@ -139,8 +139,7 @@ vc4_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
 
         vc4->fd = screen->fd;
 
-        slab_create(&vc4->transfer_pool, sizeof(struct vc4_transfer),
-                         16);
+        slab_create_child(&vc4->transfer_pool, &screen->transfer_pool);
         vc4->blitter = util_blitter_create(pctx);
         if (!vc4->blitter)
                 goto fail;
diff --git a/src/gallium/drivers/vc4/vc4_context.h b/src/gallium/drivers/vc4/vc4_context.h
index 87d8c79..0d6b8d0 100644
--- a/src/gallium/drivers/vc4/vc4_context.h
+++ b/src/gallium/drivers/vc4/vc4_context.h
@@ -297,7 +297,7 @@ struct vc4_context {
          */
         struct hash_table *write_jobs;
 
-        struct slab_mempool transfer_pool;
+        struct slab_child_pool transfer_pool;
         struct blitter_context *blitter;
 
         /** bitfield of VC4_DIRTY_* */
diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
index bfa8f40..9932bb3 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -120,7 +120,7 @@ vc4_resource_transfer_unmap(struct pipe_context *pctx,
         }
 
         pipe_resource_reference(&ptrans->resource, NULL);
-        slab_free_st(&vc4->transfer_pool, ptrans);
+        slab_free(&vc4->transfer_pool, ptrans);
 }
 
 static struct pipe_resource *
@@ -196,7 +196,7 @@ vc4_resource_transfer_map(struct pipe_context *pctx,
         if (usage & PIPE_TRANSFER_WRITE)
                 rsc->writes++;
 
-        trans = slab_alloc_st(&vc4->transfer_pool);
+        trans = slab_alloc(&vc4->transfer_pool);
         if (!trans)
                 return NULL;
 
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index 3dc85d5..64bff5d 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -98,6 +98,7 @@ vc4_screen_destroy(struct pipe_screen *pscreen)
 
         util_hash_table_destroy(screen->bo_handles);
         vc4_bufmgr_destroy(pscreen);
+        slab_destroy_parent(&screen->transfer_pool);
         close(screen->fd);
         ralloc_free(pscreen);
 }
@@ -614,6 +615,8 @@ vc4_screen_create(int fd)
         if (!vc4_get_chip_info(screen))
                 goto fail;
 
+        slab_create_parent(&screen->transfer_pool, sizeof(struct vc4_transfer), 16);
+
         vc4_fence_init(screen);
 
         vc4_debug = debug_get_option_vc4_debug();
diff --git a/src/gallium/drivers/vc4/vc4_screen.h b/src/gallium/drivers/vc4/vc4_screen.h
index 36fe1c7..16003cf 100644
--- a/src/gallium/drivers/vc4/vc4_screen.h
+++ b/src/gallium/drivers/vc4/vc4_screen.h
@@ -28,6 +28,7 @@
 #include "os/os_thread.h"
 #include "state_tracker/drm_driver.h"
 #include "util/list.h"
+#include "util/slab.h"
 
 struct vc4_bo;
 
@@ -64,6 +65,8 @@ struct vc4_screen {
          */
         uint64_t finished_seqno;
 
+        struct slab_parent_pool transfer_pool;
+
         struct vc4_bo_cache {
                 /** List of struct vc4_bo freed, by age. */
                 struct list_head time_list;




More information about the mesa-commit mailing list