drm/amd/display: Set the domain as GTT when VRAM size <= 32 MB
Subsystems (3)
PATCH 1/1 drm/amd/display: Set the domain as GTT when VRAM size <= 32 MB
[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.
--- 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -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 */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9 -1
@@ -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 ;
Signature · 1 line
2.25.1
Deucher, Alexander
maintainer[Public]
I think this may have already been fixed with this patch:
https://gitlab.freedesktop.org/agd5f/linux/-/commit/2a7b9a8437130fd328001f4edfac8eec98dfe298
Alex
________________________________
From: Mahapatra, Rajib <[email protected]>
Sent: Thursday, August 26, 2021 2:07 PM
To: Wentland, Harry <[email protected]>; Kazlauskas, Nicholas <[email protected]>; Deucher, Alexander <[email protected]>; Wu, Hersen <[email protected]>
Cc: [email protected] <[email protected]>; Mahapatra, Rajib <[email protected]>
Subject: [PATCH] drm/amd/display: Set the domain as GTT when VRAM size <= 32 MB
[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.
--- 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -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 */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9 -1
@@ -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
[Public]
Thanks Alex for your reply.
The patch is not fixing our issue.
Thanks
-Rajib
From: Deucher, Alexander <[email protected]>
Sent: Thursday, August 26, 2021 11:48 PM
To: Mahapatra, Rajib <[email protected]>; Wentland, Harry <[email protected]>; Kazlauskas, Nicholas <[email protected]>; Wu, Hersen <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amd/display: Set the domain as GTT when VRAM size <= 32 MB
[Public]
I think this may have already been fixed with this patch:
https://gitlab.freedesktop.org/agd5f/linux/-/commit/2a7b9a8437130fd328001f4edfac8eec98dfe298
Alex
________________________________
From: Mahapatra, Rajib <[email protected]<mailto:[email protected]>>
Sent: Thursday, August 26, 2021 2:07 PM
To: Wentland, Harry <[email protected]<mailto:[email protected]>>; Kazlauskas, Nicholas <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Wu, Hersen <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>; Mahapatra, Rajib <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amd/display: Set the domain as GTT when VRAM size <= 32 MB
[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.
--- 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -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 */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9 -1
@@ -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
Quoted 9 lines · Rajib
[Public]
Thanks Alex for your reply.
The patch is not fixing our issue.
What exactly is going wrong? I don't see what this patch fixes. amdgpu_display_supported_domains() already sets domain to AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT if the asic can support display from system memory and the buffer is suitable for display. If amdgpu_display_supported_domains() only returns AMDGPU_GEM_DOMAIN_VRAM, then you shouldn't be adding AMDGPU_GEM_DOMAIN_GTT because the buffer is not suitable for display for some reason. If you force AMDGPU_GEM_DOMAIN_GTT in this case, you will get hangs on most chips.
Alex
Quoted 93 lines
Thanks
-Rajib
From: Deucher, Alexander <[email protected]>
Sent: Thursday, August 26, 2021 11:48 PM
To: Mahapatra, Rajib <[email protected]>; Wentland, Harry <[email protected]>; Kazlauskas, Nicholas <[email protected]>; Wu, Hersen <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amd/display: Set the domain as GTT when VRAM size <= 32 MB[Public]
I think this may have already been fixed with this patch:
https://gitlab.freedesktop.org/agd5f/linux/-/commit/2a7b9a8437130fd328001f4edfac8eec98dfe298
Alex
________________________________
From: Mahapatra, Rajib <[email protected]>
Sent: Thursday, August 26, 2021 2:07 PM
To: Wentland, Harry <[email protected]>; Kazlauskas, Nicholas <[email protected]>; Deucher, Alexander <[email protected]>; Wu, Hersen <[email protected]>
Cc: [email protected] <[email protected]>; Mahapatra, Rajib <[email protected]>
Subject: [PATCH] drm/amd/display: Set the domain as GTT when VRAM size <= 32 MB[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:
00000000d721431cpin 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 <[email protected]>--- 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(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -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 */ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9
-2@@ -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