<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I think this may have already been fixed with this patch:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://gitlab.freedesktop.org/agd5f/linux/-/commit/2a7b9a8437130fd328001f4edfac8eec98dfe298" id="LPlnk">https://gitlab.freedesktop.org/agd5f/linux/-/commit/2a7b9a8437130fd328001f4edfac8eec98dfe298</a></div>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1"></div>
<br>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Mahapatra, Rajib <Rajib.Mahapatra@amd.com><br>
<b>Sent:</b> Thursday, August 26, 2021 2:07 PM<br>
<b>To:</b> Wentland, Harry <Harry.Wentland@amd.com>; Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Wu, Hersen <hersenxs.wu@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Mahapatra, Rajib <Rajib.Mahapatra@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/display: Set the domain as GTT when VRAM size <= 32 MB</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">[Why]<br>
In lower carve out (<= 32 MB) devices, it was unable to pin framebuffer in<br>
VRAM domain for some BO allocations. The device shows below error logs and<br>
sometimes it reboots too.<br>
<br>
amdgpu 0000:02:00.0: amdgpu: 00000000d721431c pin failed<br>
[drm:dm_plane_helper_prepare_fb] *ERROR* Failed to pin framebuffer with error -12<br>
<br>
[How]<br>
Place the domain as GTT when VRAM size <= 32 MB.<br>
<br>
Signed-off-by: Rajib Mahapatra <rajib.mahapatra@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu.h               |  1 +<br>
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++-<br>
 2 files changed, 10 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
index dc3c6b3a00e5..d719be448eec 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
@@ -236,6 +236,7 @@ extern int amdgpu_num_kcq;<br>
 <br>
 #define AMDGPU_VM_MAX_NUM_CTX                   4096<br>
 #define AMDGPU_SG_THRESHOLD                     (256*1024*1024)<br>
+#define AMDGPU_VRAM_MIN_THRESHOLD              (32*1024*1024)<br>
 #define AMDGPU_DEFAULT_GTT_SIZE_MB              3072ULL /* 3GB by default */<br>
 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS          3000<br>
 #define AMDGPU_MAX_USEC_TIMEOUT                 100000  /* 100 ms */<br>
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
index e1e57e7465a7..f71391599be1 100644<br>
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
@@ -7106,8 +7106,16 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,<br>
                 return r;<br>
         }<br>
 <br>
-       if (plane->type != DRM_PLANE_TYPE_CURSOR)<br>
+       if (plane->type != DRM_PLANE_TYPE_CURSOR) {<br>
                 domain = amdgpu_display_supported_domains(adev, rbo->flags);<br>
+               /*<br>
+                * Handle devices with lower carve out.<br>
+                */<br>
+               if (adev->gmc.real_vram_size <= AMDGPU_VRAM_MIN_THRESHOLD) {<br>
+                       domain |= (domain & AMDGPU_GEM_DOMAIN_GTT) ? domain :<br>
+                                  AMDGPU_GEM_DOMAIN_GTT;<br>
+               }<br>
+       }<br>
         else<br>
                 domain = AMDGPU_GEM_DOMAIN_VRAM;<br>
 <br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>