winsys/radeon: Use separate caching buffer managers for VRAM and GTT
authorMichel Dänzer <michel.daenzer@amd.com>
Fri, 13 Jun 2014 08:48:57 +0000 (17:48 +0900)
committerMichel Dänzer <michel@daenzer.net>
Wed, 23 Jul 2014 06:43:04 +0000 (15:43 +0900)
Should reduce overhead because the caching buffer manager doesn't need to
consider buffers of the wrong type.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/winsys/radeon/drm/radeon_drm_bo.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.h

index 0ebe196d142164a9d3dcf47ea6f9dc9ce7db838a..d06bb344c736be0ac9ba8ddac4bfb57af8e2b112 100644 (file)
@@ -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)
index 7cda70a98d30c37be15827190c2ca3c71d5622b9..9e60de3ab778602bea96eba7f3870eeb0c8b1f30 100644 (file)
@@ -423,7 +423,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);
@@ -638,8 +639,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) {
@@ -695,8 +699,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)
index 18fe0aeab1076ea3759b36427cd488a07c8cb9ff..fc6f53b72318cb70f7aef91eea7a7b797e444b7e 100644 (file)
@@ -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. */