From bc4b7ebbfd1cab4a88f9349289dc7480b48b8291 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Wed, 22 Jun 2016 11:22:33 +0200 Subject: [PATCH] winsys/radeon: add guard pages when R600_DEBUG=check_vm is enabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This should help flush out GPU VM faults. Reviewed-by: Marek Olšák --- src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 4 +++- src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 4 +++- src/gallium/winsys/radeon/drm/radeon_drm_winsys.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index 2c10e2eb622..58b52a402c7 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -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; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index f5f9d420722..11c4ef77172 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -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); diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h index c429aba9305..fdbaebe67b5 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h @@ -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; -- 2.30.2