On 25/03/17 01:33 AM, Marek Olšák wrote: > Hi, > > I'm sharing this idea here, because it's something that has been > decreasing our performance a lot recently, for example: > http://openbenchmarking.org/prospect/1703011-RI-RADEONDIR06/7b7668cfc109d1c3dc27e871c8aea71ca13f23fa
The attached proof-of-concept patch (on top of Christian's "CPU mapping of split VRAM buffers" series, ported from radeon) results in 145.05 fps on my Tonga. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 7f9710502bcc..0bb9c0059497 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -205,6 +205,29 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, case TTM_PL_VRAM: if (adev->mman.buffer_funcs_ring->ready == false) { amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_CPU); + } else if (adev->mc.visible_vram_size < adev->mc.real_vram_size && + bo->mem.start < (adev->mc.visible_vram_size >> PAGE_SHIFT)) { + unsigned fpfn = adev->mc.visible_vram_size >> PAGE_SHIFT; + int i; + + /* Try evicting to the CPU inaccessible part of VRAM + * first, but only set GTT as busy placement, so this + * BO will be evicted to GTT rather than causing other + * BOs to be evicted from VRAM + */ + amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM | + AMDGPU_GEM_DOMAIN_GTT); + abo->placement.num_busy_placement = 0; + for (i = 0; i < abo->placement.num_placement; i++) { + if (abo->placements[i].flags & TTM_PL_FLAG_VRAM) { + if (abo->placements[i].fpfn < fpfn) + abo->placements[i].fpfn = fpfn; + } else { + abo->placement.busy_placement = + &abo->placements[i]; + abo->placement.num_busy_placement = 1; + } + } } else { amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_GTT); for (i = 0; i < abo->placement.num_placement; ++i) {
_______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx