* [PATCH] drm/amdgpu: fix radv vulkan fps drop after s3 resume
@ 2021-08-17 18:26 Mohan Marimuthu, Yogesh
2021-08-18 8:58 ` Christian König
0 siblings, 1 reply; 3+ messages in thread
From: Mohan Marimuthu, Yogesh @ 2021-08-17 18:26 UTC (permalink / raw)
To: amd-gfx
[-- Attachment #1: Type: text/plain, Size: 2175 bytes --]
[Public]
[Why]
After s3, In radv there is huge fps drop in games. This is because
when memory is allocated using radv_amdgpu_winsys_bo_create()
with both AMDGPU_GEM_DOMAIN_VRAM and AMDGPU_GEM_DOMAIN_GTT domains
set, the kernel memory management after resume fails to move the data
back to VRAM. In kernel memory management, ttm_bo_mem_compat()
function returns true and hence data is not moved back to VRAM.
[How]
Implement the idea suggested by Christian Koenig. During suspend
move the data to system RAM instead of GTT. Due to this ttm_bo_mem_compat()
will return false and data will be moved back to VRAM.
Signed-off-by: Christian König christian.koenig@amd.com<mailto:christian.koenig@amd.com>
Signed-off-by: Yogesh mohan marimuthu yogesh.mohanmarimuthu@amd.com<mailto:yogesh.mohanmarimuthu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 446943e32..44ec59998 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -136,7 +136,13 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
return;
case TTM_PL_VRAM:
- if (!adev->mman.buffer_funcs_enabled) {
+ /* Move data to system memory for S3 so that while resume
+ * ttm_bo_mem_compat() will return false and data will be
+ * moved back to VRAM also in case of bo with both
+ * AMDGPU_GEM_DOMAIN_GTT and AMDGPU_GEM_DOMAIN_VRAM domain
+ * set in bo->preferred_domains.
+ */
+ if (!adev->mman.buffer_funcs_enabled || adev->in_s3) {
/* Move to system memory */
amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_CPU);
} else if (!amdgpu_gmc_vram_full_visible(&adev->gmc) &&
--
2.25.1
[-- Attachment #2: Type: text/html, Size: 7187 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: fix radv vulkan fps drop after s3 resume
2021-08-17 18:26 [PATCH] drm/amdgpu: fix radv vulkan fps drop after s3 resume Mohan Marimuthu, Yogesh
@ 2021-08-18 8:58 ` Christian König
2021-08-18 9:54 ` Mohan Marimuthu, Yogesh
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2021-08-18 8:58 UTC (permalink / raw)
To: Mohan Marimuthu, Yogesh, amd-gfx
[-- Attachment #1: Type: text/plain, Size: 2419 bytes --]
Am 17.08.21 um 20:26 schrieb Mohan Marimuthu, Yogesh:
>
> [Public]
>
>
> [Why]
>
> After s3, In radv there is huge fps drop in games. This is because
>
> when memory is allocated using radv_amdgpu_winsys_bo_create()
>
> with both AMDGPU_GEM_DOMAIN_VRAM and AMDGPU_GEM_DOMAIN_GTT domains
>
> set, the kernel memory management after resume fails to move the data
>
> back to VRAM. In kernel memory management, ttm_bo_mem_compat()
>
> function returns true and hence data is not moved back to VRAM.
>
> [How]
>
> Implement the idea suggested by Christian Koenig. During suspend
>
> move the data to system RAM instead of GTT. Due to this
> ttm_bo_mem_compat()
>
> will return false and data will be moved back to VRAM.
>
> Signed-off-by: Christian König christian.koenig@amd.com
> <mailto:christian.koenig@amd.com>
>
Suggested-by: would be better here since I wasn't involved in the coding.
> Signed-off-by: Yogesh mohan marimuthu yogesh.mohanmarimuthu@amd.com
> <mailto:yogesh.mohanmarimuthu@amd.com>
>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +++++++-
>
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>
> index 446943e32..44ec59998 100644
>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>
> @@ -136,7 +136,13 @@ static void amdgpu_evict_flags(struct
> ttm_buffer_object *bo,
>
> return;
>
> case TTM_PL_VRAM:
>
> - if (!adev->mman.buffer_funcs_enabled) {
>
> + /* Move data to system memory for S3 so
> that while resume
>
> + * ttm_bo_mem_compat() will return false
> and data will be
>
> + * moved back to VRAM also in case of bo
> with both
>
> + * AMDGPU_GEM_DOMAIN_GTT and
> AMDGPU_GEM_DOMAIN_VRAM domain
>
> + * set in bo->preferred_domains.
>
> + */
>
> + if (!adev->mman.buffer_funcs_enabled ||
> adev->in_s3) {
>
> /* Move to system memory */
>
> amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_CPU);
>
> } else if
> (!amdgpu_gmc_vram_full_visible(&adev->gmc) &&
>
> --
>
> 2.25.1
>
[-- Attachment #2: Type: text/html, Size: 6605 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: fix radv vulkan fps drop after s3 resume
2021-08-18 8:58 ` Christian König
@ 2021-08-18 9:54 ` Mohan Marimuthu, Yogesh
0 siblings, 0 replies; 3+ messages in thread
From: Mohan Marimuthu, Yogesh @ 2021-08-18 9:54 UTC (permalink / raw)
To: Christian König, amd-gfx
[Public]
[Why]
After s3, In radv there is huge fps drop in games. This is because
when memory is allocated using radv_amdgpu_winsys_bo_create()
with both AMDGPU_GEM_DOMAIN_VRAM and AMDGPU_GEM_DOMAIN_GTT domains
set, the kernel memory management after resume fails to move the data
back to VRAM. In kernel memory management, ttm_bo_mem_compat()
function returns true and hence data is not moved back to VRAM.
[How]
Implement the idea suggested by Christian Koenig. During suspend
move the data to system RAM instead of GTT. Due to this ttm_bo_mem_compat()
will return false and data will be moved back to VRAM.
Suggested-by: Christian König mailto:christian.koenig@amd.com
Signed-off-by: Yogesh mohan marimuthu mailto:yogesh.mohanmarimuthu@amd.com
Reviewed-by: Christian König mailto:christian.koenig@amd.com
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 446943e32..44ec59998 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -136,7 +136,13 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
return;
case TTM_PL_VRAM:
- if (!adev->mman.buffer_funcs_enabled) {
+ /* Move data to system memory for S3 so that while resume
+ * ttm_bo_mem_compat() will return false and data will be
+ * moved back to VRAM also in case of bo with both
+ * AMDGPU_GEM_DOMAIN_GTT and AMDGPU_GEM_DOMAIN_VRAM domain
+ * set in bo->preferred_domains.
+ */
+ if (!adev->mman.buffer_funcs_enabled || adev->in_s3) {
/* Move to system memory */
amdgpu_bo_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_CPU);
} else if (!amdgpu_gmc_vram_full_visible(&adev->gmc) &&
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-18 9:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 18:26 [PATCH] drm/amdgpu: fix radv vulkan fps drop after s3 resume Mohan Marimuthu, Yogesh
2021-08-18 8:58 ` Christian König
2021-08-18 9:54 ` Mohan Marimuthu, Yogesh
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.