AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/amdgpu: set gtt size according to system memory size only
@ 2017-11-29  9:12 Roger He
       [not found] ` <1511946723-27200-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Roger He @ 2017-11-29  9:12 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Roger He, Christian.Koenig-5C7GfCeVMHo

Change-Id: Ib634375b90d875fe04a890fc82fb1e3b7112676a
Signed-off-by: Roger He <Hongbo.He@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 17bf0ce..d0661907 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1330,11 +1330,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 		struct sysinfo si;
 
 		si_meminfo(&si);
-		gtt_size = min(max((AMDGPU_DEFAULT_GTT_SIZE_MB << 20),
-			       adev->mc.mc_vram_size),
-			       ((uint64_t)si.totalram * si.mem_unit * 3/4));
-	}
-	else
+		gtt_size = max(AMDGPU_DEFAULT_GTT_SIZE_MB << 20,
+			(uint64_t)si.totalram * si.mem_unit * 3/4);
+	} else
 		gtt_size = (uint64_t)amdgpu_gtt_size << 20;
 	r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_TT, gtt_size >> PAGE_SHIFT);
 	if (r) {
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH] drm/amd/amdgpu: set gtt size according to system memory size only
@ 2017-11-28  9:40 Roger He
       [not found] ` <1511862059-14173-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Roger He @ 2017-11-28  9:40 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Roger He, Christian.Koenig-5C7GfCeVMHo

Change-Id: Ib634375b90d875fe04a890fc82fb1e3b7112676a
Signed-off-by: Roger He <Hongbo.He@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 17bf0ce..d773c5e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1328,13 +1328,19 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 
 	if (amdgpu_gtt_size == -1) {
 		struct sysinfo si;
+		uint64_t sys_mem_size;
 
 		si_meminfo(&si);
-		gtt_size = min(max((AMDGPU_DEFAULT_GTT_SIZE_MB << 20),
-			       adev->mc.mc_vram_size),
-			       ((uint64_t)si.totalram * si.mem_unit * 3/4));
-	}
-	else
+		sys_mem_size = (uint64_t)si.totalram * si.mem_unit;
+		gtt_size = AMDGPU_DEFAULT_GTT_SIZE_MB << 20;
+
+		/* leave 2GB for OS to work with */
+		if (sys_mem_size > (2ULL << 30)) {
+			gtt_size = max(gtt_size, sys_mem_size - (2ULL << 30));
+		} else
+			DRM_INFO("amdgpu: Too small system memory %llu MB\n",
+				sys_mem_size >> 20);
+	} else
 		gtt_size = (uint64_t)amdgpu_gtt_size << 20;
 	r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_TT, gtt_size >> PAGE_SHIFT);
 	if (r) {
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2018-01-03 16:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-29  9:12 [PATCH] drm/amd/amdgpu: set gtt size according to system memory size only Roger He
     [not found] ` <1511946723-27200-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-11-29  9:34   ` Christian König
2017-12-07 17:34   ` Michel Dänzer
     [not found]     ` <090b426c-0635-3c59-8a69-315c7f430b59-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-12-07 18:07       ` Christian König
     [not found]         ` <7b138de2-70eb-62ef-e61a-8933d77af124-5C7GfCeVMHo@public.gmane.org>
2017-12-08 17:26           ` Michel Dänzer
     [not found]             ` <915d1570-856e-09ae-63b1-5e3d2b937edc-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-12-11  2:49               ` He, Roger
     [not found]                 ` <MWHPR1201MB0127DE9F4391624C09F625F1FD370-3iK1xFAIwjq9imrIu4W8xGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-12-11 11:29                   ` Michel Dänzer
     [not found]                     ` <8c70faa2-ee3e-296b-5c61-ede3ac6396f0-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-12-25  8:45                       ` He, Roger
     [not found]                         ` <MWHPR1201MB0127C74D1BFACE3F93B79640FD010-3iK1xFAIwjq9imrIu4W8xGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-12-27  8:58                           ` Michel Dänzer
     [not found]                             ` <ad59f224-9b6f-c5e3-a932-39a00d3d783f-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-12-28  3:37                               ` He, Roger
2018-01-02  9:57                             ` He, Roger
     [not found]                               ` <MWHPR1201MB012748089054D11868168EC0FD190-3iK1xFAIwjq9imrIu4W8xGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2018-01-03 16:32                                 ` Michel Dänzer
2017-12-08  1:52       ` He, Roger
  -- strict thread matches above, loose matches on Subject: below --
2017-11-28  9:40 Roger He
     [not found] ` <1511862059-14173-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-11-28 10:00   ` Christian König
     [not found]     ` <7029b2bb-03be-6d74-578d-63fc48982b6e-5C7GfCeVMHo@public.gmane.org>
2017-11-29  2:40       ` He, Roger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox