diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2015-08-05 12:41:48 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-08-17 16:50:18 -0400 |
commit | 5ceb54c68a28fc8af5cf8d32c4fde29c97dd3c18 (patch) | |
tree | 2202b44528b6471bdc11fcf580b5348ec7354f48 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | c6a4079badc2f0eda69a028622c7080a284ae147 (diff) |
drm/amdgpu: add fence suspend/resume functions
Added to:
- handle draining the ring on suspend
- properly enable/disable interrupts on suspend and resume
Fix breakages from:
commit 467ee3be53d240d08beed2e82a941e820c1ac323
Author: Chunming Zhou <david1.zhou@amd.com>
Date: Mon Jun 1 14:14:32 2015 +0800
drm/amdgpu: always enable EOP interrupt v2
Tested-by: Audrey Grodzovsky <audrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 99f158e1baff..a816580fb474 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1627,8 +1627,7 @@ int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon) | |||
1627 | struct amdgpu_device *adev; | 1627 | struct amdgpu_device *adev; |
1628 | struct drm_crtc *crtc; | 1628 | struct drm_crtc *crtc; |
1629 | struct drm_connector *connector; | 1629 | struct drm_connector *connector; |
1630 | int i, r; | 1630 | int r; |
1631 | bool force_completion = false; | ||
1632 | 1631 | ||
1633 | if (dev == NULL || dev->dev_private == NULL) { | 1632 | if (dev == NULL || dev->dev_private == NULL) { |
1634 | return -ENODEV; | 1633 | return -ENODEV; |
@@ -1667,21 +1666,7 @@ int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon) | |||
1667 | /* evict vram memory */ | 1666 | /* evict vram memory */ |
1668 | amdgpu_bo_evict_vram(adev); | 1667 | amdgpu_bo_evict_vram(adev); |
1669 | 1668 | ||
1670 | /* wait for gpu to finish processing current batch */ | 1669 | amdgpu_fence_driver_suspend(adev); |
1671 | for (i = 0; i < AMDGPU_MAX_RINGS; i++) { | ||
1672 | struct amdgpu_ring *ring = adev->rings[i]; | ||
1673 | if (!ring) | ||
1674 | continue; | ||
1675 | |||
1676 | r = amdgpu_fence_wait_empty(ring); | ||
1677 | if (r) { | ||
1678 | /* delay GPU reset to resume */ | ||
1679 | force_completion = true; | ||
1680 | } | ||
1681 | } | ||
1682 | if (force_completion) { | ||
1683 | amdgpu_fence_driver_force_completion(adev); | ||
1684 | } | ||
1685 | 1670 | ||
1686 | r = amdgpu_suspend(adev); | 1671 | r = amdgpu_suspend(adev); |
1687 | 1672 | ||
@@ -1739,6 +1724,8 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon) | |||
1739 | 1724 | ||
1740 | r = amdgpu_resume(adev); | 1725 | r = amdgpu_resume(adev); |
1741 | 1726 | ||
1727 | amdgpu_fence_driver_resume(adev); | ||
1728 | |||
1742 | r = amdgpu_ib_ring_tests(adev); | 1729 | r = amdgpu_ib_ring_tests(adev); |
1743 | if (r) | 1730 | if (r) |
1744 | DRM_ERROR("ib ring test failed (%d).\n", r); | 1731 | DRM_ERROR("ib ring test failed (%d).\n", r); |