All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: Set the domain as GTT when VRAM size <= 32 MB
@ 2021-08-26 18:07 Rajib Mahapatra
  2021-08-26 18:18 ` Deucher, Alexander
  0 siblings, 1 reply; 4+ messages in thread
From: Rajib Mahapatra @ 2021-08-26 18:07 UTC (permalink / raw)
  To: Harry Wentland, Nicholas Kazlauskas, Alex Deucher, hersenxs.wu
  Cc: amd-gfx, Rajib Mahapatra

[Why]
In lower carve out (<= 32 MB) devices, it was unable to pin framebuffer in
VRAM domain for some BO allocations. The device shows below error logs and
sometimes it reboots too.

amdgpu 0000:02:00.0: amdgpu: 00000000d721431c pin failed
[drm:dm_plane_helper_prepare_fb] *ERROR* Failed to pin framebuffer with error -12

[How]
Place the domain as GTT when VRAM size <= 32 MB.

Signed-off-by: Rajib Mahapatra <rajib.mahapatra@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h               |  1 +
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index dc3c6b3a00e5..d719be448eec 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -236,6 +236,7 @@ extern int amdgpu_num_kcq;
 
 #define AMDGPU_VM_MAX_NUM_CTX			4096
 #define AMDGPU_SG_THRESHOLD			(256*1024*1024)
+#define AMDGPU_VRAM_MIN_THRESHOLD		(32*1024*1024)
 #define AMDGPU_DEFAULT_GTT_SIZE_MB		3072ULL /* 3GB by default */
 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS	        3000
 #define AMDGPU_MAX_USEC_TIMEOUT			100000	/* 100 ms */
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e1e57e7465a7..f71391599be1 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7106,8 +7106,16 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,
 		return r;
 	}
 
-	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+	if (plane->type != DRM_PLANE_TYPE_CURSOR) {
 		domain = amdgpu_display_supported_domains(adev, rbo->flags);
+		/*
+		 * Handle devices with lower carve out.
+		 */
+		if (adev->gmc.real_vram_size <= AMDGPU_VRAM_MIN_THRESHOLD) {
+			domain |= (domain & AMDGPU_GEM_DOMAIN_GTT) ? domain :
+				   AMDGPU_GEM_DOMAIN_GTT;
+		}
+	}
 	else
 		domain = AMDGPU_GEM_DOMAIN_VRAM;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-27  4:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 18:07 [PATCH] drm/amd/display: Set the domain as GTT when VRAM size <= 32 MB Rajib Mahapatra
2021-08-26 18:18 ` Deucher, Alexander
2021-08-27  4:37   ` Mahapatra, Rajib
2021-08-27  4:57     ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.