[PATCH 1/5] winsys/radeon: Use separate caching buffer managers for VRAM and GTT

Michel Dänzer michel at daenzer.net
Thu Jul 17 03:01:11 PDT 2014


From: Michel Dänzer <michel.daenzer at amd.com>

Should reduce overhead because the caching buffer manager doesn't need to
consider buffers of the wrong type.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/gallium/winsys/radeon/drm/radeon_drm_bo.c     | 10 +++++++---
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 16 +++++++++++-----
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.h |  3 ++-
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 0ebe196..d06bb34 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -800,10 +800,14 @@ radeon_winsys_bo_create(struct radeon_winsys *rws,
     desc.initial_domains = domain;
 
     /* Assign a buffer manager. */
-    if (use_reusable_pool)
-        provider = ws->cman;
-    else
+    if (use_reusable_pool) {
+        if (domain == RADEON_DOMAIN_VRAM)
+            provider = ws->cman_vram;
+        else
+            provider = ws->cman_gtt;
+    } else {
         provider = ws->kman;
+    }
 
     buffer = provider->create_buffer(provider, size, &desc.base);
     if (!buffer)
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index 576fea5..0834cbd 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -417,7 +417,8 @@ static void radeon_winsys_destroy(struct radeon_winsys *rws)
     pipe_mutex_destroy(ws->cmask_owner_mutex);
     pipe_mutex_destroy(ws->cs_stack_lock);
 
-    ws->cman->destroy(ws->cman);
+    ws->cman_vram->destroy(ws->cman_vram);
+    ws->cman_gtt->destroy(ws->cman_gtt);
     ws->kman->destroy(ws->kman);
     if (ws->gen >= DRV_R600) {
         radeon_surface_manager_free(ws->surf_man);
@@ -632,8 +633,11 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
     ws->kman = radeon_bomgr_create(ws);
     if (!ws->kman)
         goto fail;
-    ws->cman = pb_cache_manager_create(ws->kman, 1000000, 2.0f, 0);
-    if (!ws->cman)
+    ws->cman_vram = pb_cache_manager_create(ws->kman, 1000000, 2.0f, 0);
+    if (!ws->cman_vram)
+        goto fail;
+    ws->cman_gtt = pb_cache_manager_create(ws->kman, 1000000, 2.0f, 0);
+    if (!ws->cman_gtt)
         goto fail;
 
     if (ws->gen >= DRV_R600) {
@@ -689,8 +693,10 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
 
 fail:
     pipe_mutex_unlock(fd_tab_mutex);
-    if (ws->cman)
-        ws->cman->destroy(ws->cman);
+    if (ws->cman_gtt)
+        ws->cman_gtt->destroy(ws->cman_gtt);
+    if (ws->cman_vram)
+        ws->cman_vram->destroy(ws->cman_vram);
     if (ws->kman)
         ws->kman->destroy(ws->kman);
     if (ws->surf_man)
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
index 18fe0ae..fc6f53b 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
@@ -57,7 +57,8 @@ struct radeon_drm_winsys {
     uint32_t va_start;
 
     struct pb_manager *kman;
-    struct pb_manager *cman;
+    struct pb_manager *cman_vram;
+    struct pb_manager *cman_gtt;
     struct radeon_surface_manager *surf_man;
 
     uint32_t num_cpus;      /* Number of CPUs. */
-- 
2.0.0



More information about the dri-devel mailing list