drm/amdgpu: Fix S3 resume failre.
Subsystems (2)
PATCH 1/1 drm/amdgpu: Fix S3 resume failre.
Problem:
FB is still not unpinned during the first run of amdgpu_bo_evict_vram and so it's left for the second run, but during second run the SDMA for moving buffer around already disabled and you have to do
it with CPU, but FB is not in visible VRAM and hence the eviction failure leading later to resume failure.
Fix:
When DAL in use get a pointer to FB from crtc->primary->state rather then from crtc->primary which is not set for DAL since it supports atomic KMS.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb; +struct drm_framebuffer *fb =amdgpu_device_has_dc_support (adev) ? + crtc->primary->state->fb : crtc->primary->fb;struct amdgpu_bo *robj;if (amdgpu_crtc->cursor_bo) {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1532013596-26662-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org
Am 19.07.2018 um 17:19 schrieb Andrey Grodzovsky:
Quoted 11 lines
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for moving buffer around already disabled and you have to do
it with CPU, but FB is not in visible VRAM and hence the eviction failure leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.
Nice catch, but could we add a helper for unpinning them and just unpin both instead of checking if DC is enabled or not?
I think that would be a little bit cleaner.
Christian.
Quoted 13 lines
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) · line 2649
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb; +struct drm_framebuffer *fb =amdgpu_device_has_dc_support (adev) ? + crtc->primary->state->fb : crtc->primary->fb;struct amdgpu_bo *robj;if (amdgpu_crtc->cursor_bo) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): fb787740-8201-8d27-4ee2-dfcc8d732bc7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 13 lines · Christian König
Am 19.07.2018 um 17:19 schrieb Andrey Grodzovsky:
Quoted 11 lines
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for moving buffer around already disabled and you have to do
it with CPU, but FB is not in visible VRAM and hence the eviction failure leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.
Good catch.
Quoted 14 lines
Nice catch, but could we add a helper for unpinning them and just unpin both instead of checking if DC is enabled or not?
I think that would be a little bit cleaner.
Christian.
Quoted 8 lines
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) · line 2646
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) /* unpin the front buffers and cursors */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); - struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb = amdgpu_device_has_dc_support(adev) ? + crtc->primary->state->fb : crtc->primary->fb;
Is that the only place or are there other places where DC is using fb from crtc, rather than crtc_state?
Harry
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) · line 2649
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0struct amdgpu_bo *robj; if (amdgpu_crtc->cursor_bo) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 8 lines · Christian König
Am 19.07.2018 um 17:19 schrieb Andrey Grodzovsky:
Quoted 7 lines
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for moving buffer around already disabled and you have to do
it with CPU, but FB is not in visible VRAM and hence the eviction failure leading later to resume failure.
Quoted 6 lines
Quoted 4 lines
Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Nice catch, but could we add a helper for unpinning them and just unpin both instead of checking if DC is enabled or not?
They are mutually exclusive, once is only used in legacy drivers another only in atomic KMS drivers.
Andrey
Quoted 13 lines
I think that would be a little bit cleaner.
Christian.
Quoted 8 lines
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 16 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) /* unpin the front buffers and cursors */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); - struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb =Quoted 4 lines
amdgpu_device_has_dc_support(adev)?
+crtc->primary->state->fb:crtc->primary->fb; structamdgpu_bo*robj;
if (amdgpu_crtc->cursor_bo) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 24 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for moving buffer around already disabled and you have to do
it with CPU, but FB is not in visible VRAM and hence the eviction failure leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) · line 2646
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb; +struct drm_framebuffer *fb =amdgpu_device_has_dc_support (adev) ? + crtc->primary->state->fb : crtc->primary->fb;
So apparently you haven't yet turned off the planes here. If I'm reading things right amdgpu_device_ip_suspend() should end up doing that through drm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?
To me it would seem better to susped the display before trying to evict the bos.
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0struct amdgpu_bo *robj;if (amdgpu_crtc->cursor_bo) {Signature · 1 line
2.7.4
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 20 lines · Ville Syrjälä
Quoted 19 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for moving buffer around already disabled and you have to do
it with CPU, but FB is not in visible VRAM and hence the eviction failure leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) · line 2646
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb; +struct drm_framebuffer *fb =amdgpu_device_has_dc_support (adev) ? + crtc->primary->state->fb : crtc->primary->fb;So apparently you haven't yet turned off the planes here. If I'm reading things right
amdgpu_device_ip_suspend()should end up doing that throughdrm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?
amdgpu_bo_unpin has a guard against that, amdgpu_bo_unreserve is less clear.
Quoted 3 lines
To me it would seem better to susped the display before trying to evict the bos.
Yea, i was aware of that and indeed DAL shouldn't rely on the code in amdgpu_device_suspend to unpin
front buffer and cursor since the atomic helper should do it. Problem is that during amdgpu_device_ip_suspend the SDMA engine gets suspended too, so you have to embed another eviction in between, after display is suspended but before SDMA and this forces ordering between them which kind of already in place (amd_ip_block_type) but still it's an extra constrain. Also I am not sure about side effects of another eviction call there - Christian any ideas ?
Andrey
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0struct amdgpu_bo *robj;if (amdgpu_crtc->cursor_bo) {Signature · 1 line
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 86de8654-1bff-ad56-9e72-9ec1eb2e7f76-5C7GfCeVMHo@public.gmane.org
Quoted 41 lines · Andrey Grodzovsky
Quoted 32 lines · Ville Syrjälä
Quoted 31 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for moving buffer around already disabled and you have to do
it with CPU, but FB is not in visible VRAM and hence the eviction failure
leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) /* unpin the front buffers and cursors */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); - struct drm_framebuffer *fb = crtc->primary->fb;Quoted 8 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+ struct drm_framebuffer *fb =
amdgpu_device_has_dc_support(adev)?
+crtc->primary->state->fb:crtc->primary->fb;So apparently you haven't yet turned off the planes here. If I'm reading things right
amdgpu_device_ip_suspend()should end up doing that throughdrm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?
Quoted 2 lines
amdgpu_bo_unpinhas a guard against that,amdgpu_bo_unreserveis less clear.
BO reservation shouldn't an issue here, BOs are only reserved for a short time around (un)pinning them.
Quoted 11 lines
Quoted 2 lines
To me it would seem better to susped the display before trying to evict the bos.
Yea, i was aware of that and indeed DAL shouldn't rely on the code in
amdgpu_device_suspendto unpin
front buffer and cursor since the atomic helper should do it. Problem is that duringamdgpu_device_ip_suspend
the SDMA engine gets suspended too, so you have to embed another eviction in between, after display is suspended but before SDMA and this forces ordering between them which kind of already in place (amd_ip_block_type) but still it's an extra constrain.
Ville's point (which I basically agree with) is that the display hardware should be turned off before evicting VRAM the first time, in which case no second eviction should be necessary (for this purpose).
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 13eee582-a100-4c36-e3c6-ad6f96f40efd-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 58 lines · Michel Dänzer
Quoted 41 lines · Andrey Grodzovsky
Quoted 32 lines · Ville Syrjälä
Quoted 31 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for moving buffer around already disabled and you have to do
it with CPU, but FB is not in visible VRAM and hence the eviction failure
leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) /* unpin the front buffers and cursors */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); - struct drm_framebuffer *fb = crtc->primary->fb;Quoted 8 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+ struct drm_framebuffer *fb =
amdgpu_device_has_dc_support(adev)?
+crtc->primary->state->fb:crtc->primary->fb;So apparently you haven't yet turned off the planes here. If I'm reading things right
amdgpu_device_ip_suspend()should end up doing that throughdrm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?Quoted 2 lines
amdgpu_bo_unpinhas a guard against that,amdgpu_bo_unreserveis less clear.BO reservation shouldn't an issue here, BOs are only reserved for a short time around (un)pinning them.
Quoted 10 lines
Quoted 2 lines
To me it would seem better to susped the display before trying to evict the bos.
Yea, i was aware of that and indeed DAL shouldn't rely on the code in
amdgpu_device_suspendto unpin
front buffer and cursor since the atomic helper should do it. Problem is that duringamdgpu_device_ip_suspend
the SDMA engine gets suspended too, so you have to embed another eviction in between, after display is suspended but before SDMA and this forces ordering between them which kind of already in place (amd_ip_block_type) but still it's an extra constrain.
Quoted 3 lines
Ville's point (which I basically agree with) is that the display hardware should be turned off before evicting VRAM the first time, in which case no second eviction should be necessary (for this purpose).
Display HW is turned off as part of all IPs in a loop inside amdgpu_device_ip_suspend. Are you suggesting to extract the display HW turn off from inside amdgpu_device_ip_suspend and place it before the first call to amdgpu_bo_evict_vram ?
Andrey
Quoted 2 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 020d0b20-32f5-8974-06a7-5ef015ddca87-5C7GfCeVMHo@public.gmane.org
Quoted 67 lines · Andrey Grodzovsky
Quoted 60 lines · Michel Dänzer
Quoted 43 lines · Andrey Grodzovsky
Quoted 34 lines · Ville Syrjälä
Quoted 33 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for
moving buffer around already disabled and you have to do it with CPU, but FB is not in visible VRAM and hence the eviction failure
leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) /* unpin the front buffers and cursors */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); - struct drm_framebuffer *fb = crtc->primary->fb;Quoted 8 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+ struct drm_framebuffer *fb =
amdgpu_device_has_dc_support(adev)?
+crtc->primary->state->fb:crtc->primary->fb;So apparently you haven't yet turned off the planes here. If I'm reading things right
amdgpu_device_ip_suspend()should end up doing that throughdrm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?Quoted 2 lines
amdgpu_bo_unpinhas a guard against that,amdgpu_bo_unreserveis less clear.BO reservation shouldn't an issue here, BOs are only reserved for a short time around (un)pinning them.
Quoted 10 lines
Quoted 2 lines
To me it would seem better to susped the display before trying to evict the bos.
Yea, i was aware of that and indeed DAL shouldn't rely on the code in
amdgpu_device_suspendto unpin
front buffer and cursor since the atomic helper should do it. Problem is that duringamdgpu_device_ip_suspend
the SDMA engine gets suspended too, so you have to embed another eviction in between, after display is suspended but before SDMA and this forces ordering between them which kind of already in place (amd_ip_block_type) but still it's an extra constrain.Quoted 3 lines
Ville's point (which I basically agree with) is that the display hardware should be turned off before evicting VRAM the first time, in which case no second eviction should be necessary (for this purpose).
Quoted 5 lines
Display HW is turned off as part of all IPs in a loop inside
amdgpu_device_ip_suspend.
Are you suggesting to extract the display HW turn off from insideamdgpu_device_ip_suspendand place it
before the first call toamdgpu_bo_evict_vram?
In a nutshell, yes.
Or maybe it would be easier to move the amdgpu_bo_evict_vram call down to somewhere called from amdgpu_device_ip_suspend?
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 455ebec7-b2cf-0f8e-3fbc-be192d0913c0-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 71 lines · Michel Dänzer
Quoted 62 lines · Andrey Grodzovsky
Quoted 60 lines · Michel Dänzer
Quoted 43 lines · Andrey Grodzovsky
Quoted 34 lines · Ville Syrjälä
Quoted 33 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for
moving buffer around already disabled and you have to do it with CPU, but FB is not in visible VRAM and hence the eviction failure
leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) /* unpin the front buffers and cursors */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); - struct drm_framebuffer *fb = crtc->primary->fb;Quoted 8 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+ struct drm_framebuffer *fb =
amdgpu_device_has_dc_support(adev)?
+crtc->primary->state->fb:crtc->primary->fb;So apparently you haven't yet turned off the planes here. If I'm reading things right
amdgpu_device_ip_suspend()should end up doing that throughdrm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?Quoted 2 lines
amdgpu_bo_unpinhas a guard against that,amdgpu_bo_unreserveis less clear.BO reservation shouldn't an issue here, BOs are only reserved for a short time around (un)pinning them.
Quoted 10 lines
Quoted 2 lines
To me it would seem better to susped the display before trying to evict the bos.
Yea, i was aware of that and indeed DAL shouldn't rely on the code in
amdgpu_device_suspendto unpin
front buffer and cursor since the atomic helper should do it. Problem is that duringamdgpu_device_ip_suspend
the SDMA engine gets suspended too, so you have to embed another eviction in between, after display is suspended but before SDMA and this forces ordering between them which kind of already in place (amd_ip_block_type) but still it's an extra constrain.Quoted 8 lines
Quoted 3 lines
Ville's point (which I basically agree with) is that the display hardware should be turned off before evicting VRAM the first time, in which case no second eviction should be necessary (for this purpose).
Display HW is turned off as part of all IPs in a loop inside
amdgpu_device_ip_suspend.
Are you suggesting to extract the display HW turn off from insideamdgpu_device_ip_suspendand place it
before the first call toamdgpu_bo_evict_vram?
Quoted 4 lines
In a nutshell, yes.
Or maybe it would be easier to move the
amdgpu_bo_evict_vramcall down to somewhere called fromamdgpu_device_ip_suspend?
I can move the BEFORE and AFTER calls to amdgpu_bo_evict_vram inside amdgpu_device_ip_suspend
such that the first one is called AFTER display is shut off, while the second in the very end of the function. I am just not sure what's gonna be the side effect of evicting after bunch of blocks (such as GMC) are already disabled.
Andrey
Quoted 2 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 7406a2c5-56ed-15f0-7007-25a806218a79-5C7GfCeVMHo@public.gmane.org
Quoted 95 lines · Andrey Grodzovsky
Quoted 86 lines · Michel Dänzer
Quoted 78 lines · Andrey Grodzovsky
Quoted 71 lines · Michel Dänzer
Quoted 49 lines · Andrey Grodzovsky
Quoted 38 lines · Ville Syrjälä
Quoted 36 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for
moving buffer around already disabled and you have to do it with CPU, but FB is not in visible VRAM and hence the eviction failure
leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb =Quoted 8 lines
Quoted 2 lines
amdgpu_device_has_dc_support(adev)?
+crtc->primary->state->fb:crtc->primary->fb;So apparently you haven't yet turned off the planes here. If I'm reading things right
amdgpu_device_ip_suspend()should end up doing that throughdrm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?Quoted 2 lines
amdgpu_bo_unpinhas a guard against that,amdgpu_bo_unreserveis less clear.BO reservation shouldn't an issue here, BOs are only reserved for a short time around (un)pinning them.
Quoted 12 lines
Quoted 2 lines
To me it would seem better to susped the display before trying to evict the bos.
Yea, i was aware of that and indeed DAL shouldn't rely on the code in
amdgpu_device_suspendto unpin
front buffer and cursor since the atomic helper should do it. Problem is
that duringamdgpu_device_ip_suspend
the SDMA engine gets suspended too, so you have to embed another eviction in between, after display is suspended but before SDMA and this forces ordering between them which kind of already in place (amd_ip_block_type) but still it's an extra constrain.Quoted 3 lines
Ville's point (which I basically agree with) is that the display hardware should be turned off before evicting VRAM the first time, in which case no second eviction should be necessary (for this purpose).
Quoted 5 lines
Display HW is turned off as part of all IPs in a loop inside
amdgpu_device_ip_suspend.
Are you suggesting to extract the display HW turn off from insideamdgpu_device_ip_suspendand place it
before the first call toamdgpu_bo_evict_vram?Quoted 4 lines
In a nutshell, yes.
Or maybe it would be easier to move the
amdgpu_bo_evict_vramcall down to somewhere called fromamdgpu_device_ip_suspend?
Quoted 6 lines
I can move the BEFORE and AFTER calls to
amdgpu_bo_evict_vraminsideamdgpu_device_ip_suspend
such that the first one is called AFTER display is shut off, while the second in the very end of the function.
I am just not sure what's gonna be the side effect of evicting after bunch of blocks (such as GMC) are already disabled.
How about something like the attached patches? Basically split the ip suspend sequence in two like we do for resume.
Alex
From 17389a607dc90e858c8e072800f7bfaca2c4db86 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Thu, 19 Jul 2018 13:24:33 -0500
Subject: [PATCH 2/2] drm/amdgpu: rework suspend and resume to deal with atomic
changes
Use the newly split ip suspend functions to do suspend displays first (to deal with atomic so that FBs can be unpinned before attempting to evict vram), then evict vram, then suspend the other IPs. Also move the non-DC pinning code to only be called in the non-DC cases since atomic should take care of DC.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 86 ++++++++++++++++-------------- 1 file changed, 45 insertions(+), 41 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +45 -41
@@ -2709,44 +2709,46 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); }drm_modeset_unlock_all (dev); - } - -amdgpu_amdkfd_suspend (adev); - -/* unpin the front buffers and cursors */ -list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { -struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb; -struct amdgpu_bo *robj; - -if (amdgpu_crtc->cursor_bo) { -struct amdgpu_bo *aobj =gem_to_amdgpu_bo (amdgpu_crtc->cursor_bo); - r =amdgpu_bo_reserve (aobj, true); -if (r ==0 ) { -amdgpu_bo_unpin (aobj); -amdgpu_bo_unreserve (aobj); +/* unpin the front buffers and cursors */ +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { +struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); +struct drm_framebuffer *fb = crtc->primary->fb; +struct amdgpu_bo *robj; + +if (amdgpu_crtc->cursor_bo) { +struct amdgpu_bo *aobj =gem_to_amdgpu_bo (amdgpu_crtc->cursor_bo); + r =amdgpu_bo_reserve (aobj, true); +if (r ==0 ) { +amdgpu_bo_unpin (aobj); +amdgpu_bo_unreserve (aobj); + } } - } -if (fb ==NULL || fb->obj[0 ] ==NULL ) { -continue ; - } - robj =gem_to_amdgpu_bo (fb->obj[0 ]); -/* don't unpin kernel fb objects */ -if (!amdgpu_fbdev_robj_is_fb (adev, robj)) { - r =amdgpu_bo_reserve (robj, true); -if (r ==0 ) { -amdgpu_bo_unpin (robj); -amdgpu_bo_unreserve (robj); +if (fb ==NULL || fb->obj[0 ] ==NULL ) { +continue ; + } + robj =gem_to_amdgpu_bo (fb->obj[0 ]); +/* don't unpin kernel fb objects */ +if (!amdgpu_fbdev_robj_is_fb (adev, robj)) { + r =amdgpu_bo_reserve (robj, true); +if (r ==0 ) { +amdgpu_bo_unpin (robj); +amdgpu_bo_unreserve (robj); + } } } } + +amdgpu_amdkfd_suspend (adev); + + r =amdgpu_device_ip_suspend_phase1 (adev); +/* evict vram memory */ amdgpu_bo_evict_vram (adev);amdgpu_fence_driver_suspend (adev); - r =amdgpu_device_ip_suspend (adev); + r =amdgpu_device_ip_suspend_phase2 (adev);/* evict remaining vram memory * This second call to evict vram is to evict the gart page table
@@ -2824,19 +2826,21 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)if (r) goto unlock; -/* pin cursors */ -list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { -struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); - -if (amdgpu_crtc->cursor_bo) { -struct amdgpu_bo *aobj =gem_to_amdgpu_bo (amdgpu_crtc->cursor_bo); - r =amdgpu_bo_reserve (aobj, true); -if (r ==0 ) { - r =amdgpu_bo_pin (aobj,AMDGPU_GEM_DOMAIN_VRAM ); -if (r !=0 ) -DRM_ERROR ("Failed to pin cursor BO (%d)\n" , r); - amdgpu_crtc->cursor_addr =amdgpu_bo_gpu_offset (aobj); -amdgpu_bo_unreserve (aobj); +if (!amdgpu_device_has_dc_support (adev)) { +/* pin cursors */ +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { +struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); + +if (amdgpu_crtc->cursor_bo) { +struct amdgpu_bo *aobj =gem_to_amdgpu_bo (amdgpu_crtc->cursor_bo); + r =amdgpu_bo_reserve (aobj, true); +if (r ==0 ) { + r =amdgpu_bo_pin (aobj,AMDGPU_GEM_DOMAIN_VRAM ); +if (r !=0 ) +DRM_ERROR ("Failed to pin cursor BO (%d)\n" , r); + amdgpu_crtc->cursor_addr =amdgpu_bo_gpu_offset (aobj); +amdgpu_bo_unreserve (aobj); + } } } }
Signature · 1 line
2.13.6
From 57fe101b1272653b63aa2fdcac8de1a425233559 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Thu, 19 Jul 2018 13:10:07 -0500
Subject: [PATCH 1/2] drm/amdgpu: split ip suspend into 2 phases
We need to do some IPs earlier to deal with ordering issues similar to how resume is split into two phases. Do DCE first to deal with atomic, then do the rest.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 78 +++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +76 -2
102 lines not on this page · raw message
Signature · 1 line
2.13.6
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CADnq5_Om34fPU5uY_ChVv7b2jAJcP36-Auv6q-2a=Jf=d_L_KA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Harry Wentland
Acked-byQuoted 104 lines · Alex Deucher
Quoted 95 lines · Andrey Grodzovsky
Quoted 86 lines · Michel Dänzer
Quoted 78 lines · Andrey Grodzovsky
Quoted 71 lines · Michel Dänzer
Quoted 49 lines · Andrey Grodzovsky
Quoted 38 lines · Ville Syrjälä
Quoted 36 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for
moving buffer around already disabled and you have to do it with CPU, but FB is not in visible VRAM and hence the eviction failure
leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_framebuffer *fb =Quoted 8 lines
Quoted 2 lines
amdgpu_device_has_dc_support(adev)?
+crtc->primary->state->fb:crtc->primary->fb;So apparently you haven't yet turned off the planes here. If I'm reading things right
amdgpu_device_ip_suspend()should end up doing that throughdrm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?Quoted 2 lines
amdgpu_bo_unpinhas a guard against that,amdgpu_bo_unreserveis less clear.BO reservation shouldn't an issue here, BOs are only reserved for a short time around (un)pinning them.
Quoted 12 lines
Quoted 2 lines
To me it would seem better to susped the display before trying to evict the bos.
Yea, i was aware of that and indeed DAL shouldn't rely on the code in
amdgpu_device_suspendto unpin
front buffer and cursor since the atomic helper should do it. Problem is
that duringamdgpu_device_ip_suspend
the SDMA engine gets suspended too, so you have to embed another eviction in between, after display is suspended but before SDMA and this forces ordering between them which kind of already in place (amd_ip_block_type) but still it's an extra constrain.Quoted 3 lines
Ville's point (which I basically agree with) is that the display hardware should be turned off before evicting VRAM the first time, in which case no second eviction should be necessary (for this purpose).
Quoted 5 lines
Display HW is turned off as part of all IPs in a loop inside
amdgpu_device_ip_suspend.
Are you suggesting to extract the display HW turn off from insideamdgpu_device_ip_suspendand place it
before the first call toamdgpu_bo_evict_vram?Quoted 4 lines
In a nutshell, yes.
Or maybe it would be easier to move the
amdgpu_bo_evict_vramcall down to somewhere called fromamdgpu_device_ip_suspend?Quoted 6 lines
I can move the BEFORE and AFTER calls to
amdgpu_bo_evict_vraminsideamdgpu_device_ip_suspend
such that the first one is called AFTER display is shut off, while the second in the very end of the function.
I am just not sure what's gonna be the side effect of evicting after bunch of blocks (such as GMC) are already disabled.
Quoted 3 lines
How about something like the attached patches? Basically split the ip suspend sequence in two like we do for resume.
Patches are
Harry
Quoted 2 lines
Alex
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 6d0bf937-a857-11d7-3472-9b9e848b6576-5C7GfCeVMHo@public.gmane.org
Quoted 89 lines · Harry Wentland
Quoted 88 lines · Alex Deucher
Quoted 86 lines · Andrey Grodzovsky
Quoted 73 lines · Michel Dänzer
Quoted 64 lines · Andrey Grodzovsky
Quoted 62 lines · Michel Dänzer
Quoted 44 lines · Andrey Grodzovsky
Quoted 35 lines · Ville Syrjälä
Quoted 34 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for
moving buffer around already disabled and you have to do it with CPU, but FB is not in visible VRAM and hence the eviction failure
leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb;Quoted 8 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+ struct drm_framebuffer *fb =
amdgpu_device_has_dc_support(adev)?
+crtc->primary->state->fb:crtc->primary->fb;So apparently you haven't yet turned off the planes here. If I'm reading things right
amdgpu_device_ip_suspend()should end up doing that throughdrm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?Quoted 2 lines
amdgpu_bo_unpinhas a guard against that,amdgpu_bo_unreserveis less clear.BO reservation shouldn't an issue here, BOs are only reserved for a short time around (un)pinning them.
Quoted 11 lines
Quoted 2 lines
To me it would seem better to susped the display before trying to evict the bos.
Yea, i was aware of that and indeed DAL shouldn't rely on the code in
amdgpu_device_suspendto unpin
front buffer and cursor since the atomic helper should do it. Problem is
that duringamdgpu_device_ip_suspend
the SDMA engine gets suspended too, so you have to embed another eviction in between, after display is suspended but before SDMA and this forces ordering between them which kind of already in place (amd_ip_block_type) but still it's an extra constrain.Quoted 8 lines
Quoted 3 lines
Ville's point (which I basically agree with) is that the display hardware should be turned off before evicting VRAM the first time, in which case no second eviction should be necessary (for this purpose).
Display HW is turned off as part of all IPs in a loop inside
amdgpu_device_ip_suspend.
Are you suggesting to extract the display HW turn off from insideamdgpu_device_ip_suspendand place it
before the first call toamdgpu_bo_evict_vram?Quoted 4 lines
In a nutshell, yes.
Or maybe it would be easier to move the
amdgpu_bo_evict_vramcall down to somewhere called fromamdgpu_device_ip_suspend?I can move the BEFORE and AFTER calls to
amdgpu_bo_evict_vraminsideamdgpu_device_ip_suspend
such that the first one is called AFTER display is shut off, while the second in the very end of the function.
I am just not sure what's gonna be the side effect of evicting after bunch of blocks (such as GMC) are already disabled.
Quoted 9 lines
Quoted 3 lines
How about something like the attached patches? Basically split the ip suspend sequence in two like we do for resume.
Patches are
Acked-by Harry Wentland <[email protected]>Harry
Quoted 1 line
Alex
Patches look good indeed but on second S3 in a raw i get a warning in dma_fence_is_later about fence contexts not equal. I will have to take a look why is that.
Andrey
Quoted 5 lines
Quoted 1 line
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 99b55a5d-fc78-c319-4c3e-cc6aa0478f7a-5C7GfCeVMHo@public.gmane.org
Quoted 99 lines · Andrey Grodzovsky
Quoted 96 lines · Harry Wentland
Quoted 83 lines · Alex Deucher
Quoted 81 lines · Andrey Grodzovsky
Quoted 78 lines · Michel Dänzer
Quoted 65 lines · Andrey Grodzovsky
Quoted 63 lines · Michel Dänzer
Quoted 45 lines · Andrey Grodzovsky
Quoted 36 lines · Ville Syrjälä
Quoted 35 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for
moving buffer around already disabled and you have to do it with CPU, but FB is not in visible VRAM and hence the eviction failure
leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct
drm_device
*dev, bool suspend, bool fbcon)
/* unpin the front buffers and cursors */list_for_each_entry(crtc, &dev->mode_config.crtc_list, head){
structamdgpu_crtc*amdgpu_crtc=to_amdgpu_crtc(crtc); - structdrm_framebuffer*fb =crtc->primary->fb;Quoted 8 lines
Quoted 3 lines
+ struct
drm_framebuffer*fb =amdgpu_device_has_dc_support(adev)?
+crtc->primary->state->fb:crtc->primary->fb;So apparently you haven't yet turned off the planes here. If I'm reading things right
amdgpu_device_ip_suspend()should end up doing that throughdrm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?Quoted 2 lines
amdgpu_bo_unpinhas a guard against that,amdgpu_bo_unreserveis less clear.BO reservation shouldn't an issue here, BOs are only reserved for a short time around (un)pinning them.
Quoted 11 lines
Quoted 2 lines
To me it would seem better to susped the display before trying to evict the bos.
Yea, i was aware of that and indeed DAL shouldn't rely on the code in
amdgpu_device_suspendto unpin
front buffer and cursor since the atomic helper should do it. Problem is
that duringamdgpu_device_ip_suspend
the SDMA engine gets suspended too, so you have to embed another eviction in between, after display is suspended but before SDMA and this forces ordering between them which kind of already in place (amd_ip_block_type) but still it's an extra constrain.Quoted 8 lines
Quoted 3 lines
Ville's point (which I basically agree with) is that the display hardware should be turned off before evicting VRAM the first time, in which case no second eviction should be necessary (for this purpose).
Display HW is turned off as part of all IPs in a loop inside
amdgpu_device_ip_suspend.
Are you suggesting to extract the display HW turn off from insideamdgpu_device_ip_suspendand place it
before the first call toamdgpu_bo_evict_vram?In a nutshell, yes.
Or maybe it would be easier to move the
amdgpu_bo_evict_vramcall down to somewhere called fromamdgpu_device_ip_suspend?Quoted 9 lines
Quoted 6 lines
I can move the BEFORE and AFTER calls to
amdgpu_bo_evict_vraminsideamdgpu_device_ip_suspend
such that the first one is called AFTER display is shut off, while the second in the very end of the function.
I am just not sure what's gonna be the side effect of evicting after bunch of blocks (such as GMC) are already disabled.How about something like the attached patches? Basically split the ip suspend sequence in two like we do for resume.
Patches are
Acked-by Harry Wentland <[email protected]>
Quoted 8 lines
Quoted 3 lines
Harry
Quoted 1 line
Alex
Patches look good indeed but on second S3 in a raw i get a warning in
dma_fence_is_laterabout fence contexts not equal. I will have to take a look why is that.Andrey
Seems like amdgpu_ttm_set_buffer_funcs_status destroys adev->mman.entity on suspend without releasing adev->mman.bdev.man[TTM_PL_VRAM].move fence so on resume the new drm_sched_entity.fence_context causes the warning against the old fence context which is different.
BTW, happens with my original change to, I just haven't noticed.
Andrey
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 88 lines · Alex Deucher
Quoted 80 lines · Andrey Grodzovsky
Quoted 73 lines · Michel Dänzer
Quoted 64 lines · Andrey Grodzovsky
Quoted 62 lines · Michel Dänzer
Quoted 44 lines · Andrey Grodzovsky
Quoted 35 lines · Ville Syrjälä
Quoted 34 lines · Andrey Grodzovsky
Problem:
FB is still not unpinned during the first run ofamdgpu_bo_evict_vramand so it's left for the second run, but during second run the SDMA for
moving buffer around already disabled and you have to do it with CPU, but FB is not in visible VRAM and hence the eviction failure
leading later to resume failure.Fix:
When DAL in use get a pointer to FB fromcrtc->primary->staterather then fromcrtc->primarywhich is not set for DAL since it supports atomic KMS.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic driversSigned-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -2642,7 +2642,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)/* unpin the front buffers and cursors */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb;Quoted 8 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+ struct drm_framebuffer *fb =
amdgpu_device_has_dc_support(adev)?
+crtc->primary->state->fb:crtc->primary->fb;So apparently you haven't yet turned off the planes here. If I'm reading things right
amdgpu_device_ip_suspend()should end up doing that throughdrm_atomic_helper_suspend(). So it looks like like now you'll end up unpinning the same bos twice. Doesn't that mess up some kind of refcount or something?Quoted 2 lines
amdgpu_bo_unpinhas a guard against that,amdgpu_bo_unreserveis less clear.BO reservation shouldn't an issue here, BOs are only reserved for a short time around (un)pinning them.
Quoted 11 lines
Quoted 2 lines
To me it would seem better to susped the display before trying to evict the bos.
Yea, i was aware of that and indeed DAL shouldn't rely on the code in
amdgpu_device_suspendto unpin
front buffer and cursor since the atomic helper should do it. Problem is
that duringamdgpu_device_ip_suspend
the SDMA engine gets suspended too, so you have to embed another eviction in between, after display is suspended but before SDMA and this forces ordering between them which kind of already in place (amd_ip_block_type) but still it's an extra constrain.Quoted 8 lines
Quoted 3 lines
Ville's point (which I basically agree with) is that the display hardware should be turned off before evicting VRAM the first time, in which case no second eviction should be necessary (for this purpose).
Display HW is turned off as part of all IPs in a loop inside
amdgpu_device_ip_suspend.
Are you suggesting to extract the display HW turn off from insideamdgpu_device_ip_suspendand place it
before the first call toamdgpu_bo_evict_vram?Quoted 4 lines
In a nutshell, yes.
Or maybe it would be easier to move the
amdgpu_bo_evict_vramcall down to somewhere called fromamdgpu_device_ip_suspend?Quoted 6 lines
I can move the BEFORE and AFTER calls to
amdgpu_bo_evict_vraminsideamdgpu_device_ip_suspend
such that the first one is called AFTER display is shut off, while the second in the very end of the function.
I am just not sure what's gonna be the side effect of evicting after bunch of blocks (such as GMC) are already disabled.
Quoted 4 lines
How about something like the attached patches? Basically split the ip suspend sequence in two like we do for resume.
Alex
Please carry over the regression info and the related Bugzilla ticket into the comments here -
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
Since the warning I observed is not specific to your change please push this and I will handle the warning separately.
Andrey
Andrey
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx