aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2015-10-08 00:03:36 -0400
committerAlex Deucher <alexander.deucher@amd.com>2015-10-14 16:16:35 -0400
commit756e6880c51376d2e4d53050582d66d88fc281c7 (patch)
treea6bce16a540df09f39770e9b4c76deaa9390e454 /drivers/gpu/drm/amd
parenta2df42da61109653782949789ffe6c358e5d2685 (diff)
drm/amdgpu: unpin cursor BOs on suspend and pin them again on resume
Everything is evicted from VRAM before suspend, so we need to make sure all BOs are unpinned and re-pinned after resume. Fixes broken mouse cursor after resume introduced by commit b9729b17. Port of radeon commit: f3cbb17bcf676a2fc6aedebe9fbebd59e550c51a Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 4256b00d0b37..901a460b2c55 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1657,11 +1657,21 @@ int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon)
1657 } 1657 }
1658 drm_modeset_unlock_all(dev); 1658 drm_modeset_unlock_all(dev);
1659 1659
1660 /* unpin the front buffers */ 1660 /* unpin the front buffers and cursors */
1661 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 1661 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
1662 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
1662 struct amdgpu_framebuffer *rfb = to_amdgpu_framebuffer(crtc->primary->fb); 1663 struct amdgpu_framebuffer *rfb = to_amdgpu_framebuffer(crtc->primary->fb);
1663 struct amdgpu_bo *robj; 1664 struct amdgpu_bo *robj;
1664 1665
1666 if (amdgpu_crtc->cursor_bo) {
1667 struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo);
1668 r = amdgpu_bo_reserve(aobj, false);
1669 if (r == 0) {
1670 amdgpu_bo_unpin(aobj);
1671 amdgpu_bo_unreserve(aobj);
1672 }
1673 }
1674
1665 if (rfb == NULL || rfb->obj == NULL) { 1675 if (rfb == NULL || rfb->obj == NULL) {
1666 continue; 1676 continue;
1667 } 1677 }
@@ -1713,6 +1723,7 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
1713{ 1723{
1714 struct drm_connector *connector; 1724 struct drm_connector *connector;
1715 struct amdgpu_device *adev = dev->dev_private; 1725 struct amdgpu_device *adev = dev->dev_private;
1726 struct drm_crtc *crtc;
1716 int r; 1727 int r;
1717 1728
1718 if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) 1729 if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
@@ -1746,6 +1757,24 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
1746 if (r) 1757 if (r)
1747 return r; 1758 return r;
1748 1759
1760 /* pin cursors */
1761 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
1762 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
1763
1764 if (amdgpu_crtc->cursor_bo) {
1765 struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo);
1766 r = amdgpu_bo_reserve(aobj, false);
1767 if (r == 0) {
1768 r = amdgpu_bo_pin(aobj,
1769 AMDGPU_GEM_DOMAIN_VRAM,
1770 &amdgpu_crtc->cursor_addr);
1771 if (r != 0)
1772 DRM_ERROR("Failed to pin cursor BO (%d)\n", r);
1773 amdgpu_bo_unreserve(aobj);
1774 }
1775 }
1776 }
1777
1749 /* blat the mode back in */ 1778 /* blat the mode back in */
1750 if (fbcon) { 1779 if (fbcon) {
1751 drm_helper_resume_force_mode(dev); 1780 drm_helper_resume_force_mode(dev);