winsys/radeon: add guard pages when R600_DEBUG=check_vm is enabled
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 22 Jun 2016 09:22:33 +0000 (11:22 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 24 Jun 2016 10:36:03 +0000 (12:36 +0200)
This should help flush out GPU VM faults.

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 2c10e2eb6226b308422c2038f7a2d3e5ed218629..58b52a402c73d0e6aa0a1d9c7288e2071c5c172d 100644 (file)
@@ -555,8 +555,10 @@ static struct radeon_bo *radeon_create_bo(struct radeon_drm_winsys *rws,
 
     if (rws->info.has_virtual_memory) {
         struct drm_radeon_gem_va va;
+        unsigned va_gap_size;
 
-        bo->va = radeon_bomgr_find_va(rws, size, alignment);
+        va_gap_size = rws->check_vm ? MAX2(4 * alignment, 64 * 1024) : 0;
+        bo->va = radeon_bomgr_find_va(rws, size + va_gap_size, alignment);
 
         va.handle = bo->handle;
         va.vm_id = 0;
index f5f9d420722ebb88a7a5e921eb6a09d5755b0a12..11c4ef771726e093be941bebff63a8d53ab7bd9b 100644 (file)
@@ -527,6 +527,8 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
                                     (ws->info.family == CHIP_HAWAII &&
                                      ws->accel_working2 < 3);
 
+    ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL;
+
     return TRUE;
 }
 
@@ -742,7 +744,7 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
     if (!do_winsys_init(ws))
         goto fail1;
 
-    pb_cache_init(&ws->bo_cache, 500000, 2.0f, 0,
+    pb_cache_init(&ws->bo_cache, 500000, ws->check_vm ? 1.0f : 2.0f, 0,
                   MIN2(ws->info.vram_size, ws->info.gart_size),
                   radeon_bo_destroy,
                   radeon_bo_can_reclaim);
index c429aba93055cd1f2afcaba043932fb31b949cc4..fdbaebe67b5dd1ecf3b50a1dc690f2786f3ea00d 100644 (file)
@@ -91,6 +91,7 @@ struct radeon_drm_winsys {
 
     uint64_t va_offset;
     struct list_head va_holes;
+    bool check_vm;
 
     struct radeon_surface_manager *surf_man;