summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-06-22 11:22:33 +0200
committerNicolai Hähnle <[email protected]>2016-06-24 12:36:03 +0200
commit49c0b4a0db2178a1a4e0c39076070cb45a4f09c7 (patch)
treea3e8081e7df87db29c137ec799748717acd43671
parentdbac88a8397fefa3be840f006c09ca995b0008bb (diff)
winsys/amdgpu: add guard pages when R600_DEBUG=check_vm is enabled
This should help flush out GPU VM faults. Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_bo.c4
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c4
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index 2555d57603e..aa415c47e57 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -294,6 +294,7 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
uint64_t va = 0;
struct amdgpu_winsys_bo *bo;
amdgpu_va_handle va_handle;
+ unsigned va_gap_size;
int r;
assert(initial_domain & RADEON_DOMAIN_VRAM_GTT);
@@ -327,8 +328,9 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
goto error_bo_alloc;
}
+ va_gap_size = ws->check_vm ? MAX2(4 * alignment, 64 * 1024) : 0;
r = amdgpu_va_range_alloc(ws->dev, amdgpu_gpu_va_range_general,
- size, alignment, 0, &va, &va_handle, 0);
+ size + va_gap_size, alignment, 0, &va, &va_handle, 0);
if (r)
goto error_va_alloc;
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index 2a0b66d8dda..54b30bf6959 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -294,6 +294,8 @@ static boolean do_winsys_init(struct amdgpu_winsys *ws, int fd)
ws->info.gart_page_size = alignment_info.size_remote;
+ ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL;
+
return TRUE;
fail:
@@ -469,7 +471,7 @@ amdgpu_winsys_create(int fd, radeon_screen_create_t screen_create)
goto fail;
/* Create managers. */
- 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,
(ws->info.vram_size + ws->info.gart_size) / 8,
amdgpu_bo_destroy, amdgpu_bo_can_reclaim);
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
index b13a17e119c..848953048d1 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
@@ -66,6 +66,8 @@ struct amdgpu_winsys {
uint32_t rev_id;
unsigned family;
+ bool check_vm;
+
/* List of all allocated buffers */
pipe_mutex global_bo_list_lock;
struct list_head global_bo_list;