From: Nicolai Hähnle Date: Wed, 22 Jun 2016 09:22:33 +0000 (+0200) Subject: winsys/amdgpu: add guard pages when R600_DEBUG=check_vm is enabled X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=49c0b4a0db2178a1a4e0c39076070cb45a4f09c7;p=mesa.git 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 --- 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;