From: Roger He <Hongbo.He-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Roger He <Hongbo.He-5C7GfCeVMHo@public.gmane.org>,
Christian.Koenig-5C7GfCeVMHo@public.gmane.org
Subject: [PATCH] drm/amd/amdgpu: set gtt size according to system memory size only
Date: Tue, 28 Nov 2017 17:40:59 +0800 [thread overview]
Message-ID: <1511862059-14173-1-git-send-email-Hongbo.He@amd.com> (raw)
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
next reply other threads:[~2017-11-28 9:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 9:40 Roger He [this message]
[not found] ` <1511862059-14173-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-11-28 10:00 ` [PATCH] drm/amd/amdgpu: set gtt size according to system memory size only Christian König
[not found] ` <7029b2bb-03be-6d74-578d-63fc48982b6e-5C7GfCeVMHo@public.gmane.org>
2017-11-29 2:40 ` He, Roger
-- strict thread matches above, loose matches on Subject: below --
2017-11-29 9:12 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1511862059-14173-1-git-send-email-Hongbo.He@amd.com \
--to=hongbo.he-5c7gfcevmho@public.gmane.org \
--cc=Christian.Koenig-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox