[PATCH] drm/amdgpu: adjust get preferred domain policy
Yifan Zhang
yifan1.zhang at amd.com
Fri Aug 27 08:45:49 UTC 2021
current preferred domain policy is static, which makes vram > 256M
APU never get a chance to allocate system S/G framebuffer. Change
this policy to take vram memory pressure into accout. If system
support both vram/system memory, return the preferred domain based
on vram usage.
Signed-off-by: Yifan Zhang <yifan1.zhang at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 65a9b23f0a46..ea3b084e3c3f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -1530,7 +1530,9 @@ uint32_t amdgpu_bo_get_preferred_domain(struct amdgpu_device *adev,
{
if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
domain = AMDGPU_GEM_DOMAIN_VRAM;
- if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
+ if (adev->gmc.real_vram_size -
+ atomic64_read(&adev->mman.vram_mgr.vis_usage) <=
+ AMDGPU_SG_THRESHOLD)
domain = AMDGPU_GEM_DOMAIN_GTT;
}
return domain;
--
2.25.1
More information about the amd-gfx
mailing list