radeon/winsys: increase the IB size for VM
authorMarek Olšák <marek.olsak@amd.com>
Fri, 31 Jul 2015 09:45:13 +0000 (11:45 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 6 Aug 2015 18:44:35 +0000 (20:44 +0200)
Luckily, there is a kernel query, so use the size from that.
It currently returns 256KB. It can be increased in the kernel.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/winsys/radeon/drm/radeon_drm_cs.c
src/gallium/winsys/radeon/drm/radeon_drm_cs.h
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.h

index e363cc042ddd393642615c626fc495c76c196bfd..45eef294369d67d553a9bda56be70bbce971ef35 100644 (file)
@@ -85,17 +85,22 @@ static boolean radeon_init_cs_context(struct radeon_cs_context *csc,
 {
     int i;
 
+    csc->buf = MALLOC(ws->ib_max_size);
+    if (!csc->buf)
+        return FALSE;
     csc->fd = ws->fd;
     csc->nrelocs = 512;
     csc->relocs_bo = (struct radeon_bo**)
                      CALLOC(1, csc->nrelocs * sizeof(struct radeon_bo*));
     if (!csc->relocs_bo) {
+        FREE(csc->buf);
         return FALSE;
     }
 
     csc->relocs = (struct drm_radeon_cs_reloc*)
                   CALLOC(1, csc->nrelocs * sizeof(struct drm_radeon_cs_reloc));
     if (!csc->relocs) {
+        FREE(csc->buf);
         FREE(csc->relocs_bo);
         return FALSE;
     }
@@ -148,6 +153,7 @@ static void radeon_destroy_cs_context(struct radeon_cs_context *csc)
     radeon_cs_context_cleanup(csc);
     FREE(csc->relocs_bo);
     FREE(csc->relocs);
+    FREE(csc->buf);
 }
 
 
@@ -188,7 +194,7 @@ radeon_drm_cs_create(struct radeon_winsys *rws,
     cs->cst = &cs->csc2;
     cs->base.buf = cs->csc->buf;
     cs->base.ring_type = ring_type;
-    cs->base.max_dw = ARRAY_SIZE(cs->csc->buf);
+    cs->base.max_dw = ws->ib_max_size / 4;
 
     p_atomic_inc(&ws->num_cs);
     return &cs->base;
index 6ceb8e98ee71959de92378b87724f7fe653bea3a..ab154945880d0b55a1eb2a1e60a227ead833a09a 100644 (file)
@@ -30,7 +30,7 @@
 #include "radeon_drm_bo.h"
 
 struct radeon_cs_context {
-    uint32_t                    buf[16 * 1024];
+    uint32_t                    *buf;
 
     int                         fd;
     struct drm_radeon_cs        cs;
index f7784fb795e4794ca43fe3e950552bcd3f7acfe8..b70bbaa54a34dc223e3a9cc13d9a8bbbbc129706 100644 (file)
@@ -395,16 +395,20 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
         }
 
         ws->info.r600_virtual_address = FALSE;
-        if (ws->info.drm_minor >= 13) {
-            uint32_t ib_vm_max_size;
+        ws->ib_max_size = 64 * 1024;
 
+        if (ws->info.drm_minor >= 13) {
             ws->info.r600_virtual_address = TRUE;
             if (!radeon_get_drm_value(ws->fd, RADEON_INFO_VA_START, NULL,
                                       &ws->va_start))
                 ws->info.r600_virtual_address = FALSE;
-            if (!radeon_get_drm_value(ws->fd, RADEON_INFO_IB_VM_MAX_SIZE, NULL,
-                                      &ib_vm_max_size))
+
+            if (radeon_get_drm_value(ws->fd, RADEON_INFO_IB_VM_MAX_SIZE, NULL,
+                                     &ws->ib_max_size))
+                ws->ib_max_size *= 4; /* the kernel returns the size in dwords */
+            else
                 ws->info.r600_virtual_address = FALSE;
+
             radeon_get_drm_value(ws->fd, RADEON_INFO_VA_UNMAP_WORKING, NULL,
                                  &ws->va_unmap_working);
         }
index 308b5bd976d09da69e8d5896acfe53d3ecea63cb..c1a8d6ae5646d87b8c94d7a397c94fa019f2e64a 100644 (file)
@@ -73,6 +73,7 @@ struct radeon_drm_winsys {
 
     enum radeon_generation gen;
     struct radeon_info info;
+    uint32_t ib_max_size;
     uint32_t va_start;
     uint32_t va_unmap_working;
     uint32_t accel_working2;