Commit fe1053b7 authored by Alex Deucher's avatar Alex Deucher

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: e00fb856 drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-and-tested-by: default avatarAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e7854a03
...@@ -2709,10 +2709,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) ...@@ -2709,10 +2709,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
} }
drm_modeset_unlock_all(dev); drm_modeset_unlock_all(dev);
}
amdgpu_amdkfd_suspend(adev);
/* unpin the front buffers and cursors */ /* unpin the front buffers and cursors */
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
...@@ -2741,12 +2737,18 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) ...@@ -2741,12 +2737,18 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
} }
} }
} }
}
amdgpu_amdkfd_suspend(adev);
r = amdgpu_device_ip_suspend_phase1(adev);
/* evict vram memory */ /* evict vram memory */
amdgpu_bo_evict_vram(adev); amdgpu_bo_evict_vram(adev);
amdgpu_fence_driver_suspend(adev); amdgpu_fence_driver_suspend(adev);
r = amdgpu_device_ip_suspend(adev); r = amdgpu_device_ip_suspend_phase2(adev);
/* evict remaining vram memory /* evict remaining vram memory
* This second call to evict vram is to evict the gart page table * This second call to evict vram is to evict the gart page table
...@@ -2819,6 +2821,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) ...@@ -2819,6 +2821,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
if (r) if (r)
return r; return r;
if (!amdgpu_device_has_dc_support(adev)) {
/* pin cursors */ /* pin cursors */
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
...@@ -2835,6 +2838,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) ...@@ -2835,6 +2838,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
} }
} }
} }
}
r = amdgpu_amdkfd_resume(adev); r = amdgpu_amdkfd_resume(adev);
if (r) if (r)
return r; return r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment