[Mesa-dev] [PATCH] winsys/amdgpu: Restrict allocation to GTT for small vram size
Agrawal, Akshu
Akshu.Agrawal at amd.com
Thu Apr 25 11:37:53 UTC 2019
To avoid evictions, use GTT only for allocation on devices with
small vram size.
Signed-off-by: Akshu Agrawal <akshu.agrawal at amd.com>
---
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
index 09cf9247755..aab801b6337 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
@@ -486,8 +486,15 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
* shared with the OS, allow VRAM placements too. The idea is not to use
* VRAM usefully, but to use it so that it's not unused and wasted.
*/
- if (!ws->info.has_dedicated_vram)
+ if (!ws->info.has_dedicated_vram) {
+ /* For devices having small VRAM size use GTT only to
+ * avoid evictions.
+ */
+ if (ws->info.vram_size <= 16777216)
+ request.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
+ else
request.preferred_heap |= AMDGPU_GEM_DOMAIN_GTT;
+ }
}
if (initial_domain & RADEON_DOMAIN_GTT)
--
2.19.1
More information about the mesa-dev
mailing list