stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] drm/radeon: fix HDP flushing
       [not found] <1435881253-4912-1-git-send-email-greg@chown.ath.cx>
@ 2015-07-02 23:54 ` Grigori Goronzy
  2015-07-02 23:54 ` [PATCH 4/4] drm/radeon: unpin cursor BOs before suspend Grigori Goronzy
  1 sibling, 0 replies; 3+ messages in thread
From: Grigori Goronzy @ 2015-07-02 23:54 UTC (permalink / raw)
  To: dri-devel; +Cc: Grigori Goronzy, stable

This was regressed by commit 39e7f6f8, although I don't know of any
actual issues caused by it.

The storage domain is read without TTM locking now, but the lock
never helped to prevent any races.

Cc: stable@vger.kernel.org
Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
---
 drivers/gpu/drm/radeon/radeon_gem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 7199e19..013ec71 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -476,6 +476,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
 		r = ret;
 
 	/* Flush HDP cache via MMIO if necessary */
+	cur_placement = ACCESS_ONCE(robj->tbo.mem.mem_type);
 	if (rdev->asic->mmio_hdp_flush &&
 	    radeon_mem_type_to_domain(cur_placement) == RADEON_GEM_DOMAIN_VRAM)
 		robj->rdev->asic->mmio_hdp_flush(rdev);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 4/4] drm/radeon: unpin cursor BOs before suspend
       [not found] <1435881253-4912-1-git-send-email-greg@chown.ath.cx>
  2015-07-02 23:54 ` [PATCH 2/4] drm/radeon: fix HDP flushing Grigori Goronzy
@ 2015-07-02 23:54 ` Grigori Goronzy
  2015-07-03  3:30   ` Michel Dänzer
  1 sibling, 1 reply; 3+ messages in thread
From: Grigori Goronzy @ 2015-07-02 23:54 UTC (permalink / raw)
  To: dri-devel; +Cc: Grigori Goronzy, stable

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.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=100541
Cc: stable@vger.kernel.org
Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
---
 drivers/gpu/drm/radeon/radeon_device.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 14deeae..dddd5df 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1578,6 +1578,20 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon)
 		drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
 	}
 
+	/* unpin cursors */
+	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+		struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
+
+		if (radeon_crtc->cursor_bo) {
+			struct radeon_bo *robj = gem_to_radeon_bo(radeon_crtc->cursor_bo);
+			r = radeon_bo_reserve(robj, false);
+			if (r == 0) {
+				radeon_bo_unpin(robj);
+				radeon_bo_unreserve(robj);
+			}
+		}
+	}
+
 	/* unpin the front buffers */
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
 		struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->primary->fb);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/4] drm/radeon: unpin cursor BOs before suspend
  2015-07-02 23:54 ` [PATCH 4/4] drm/radeon: unpin cursor BOs before suspend Grigori Goronzy
@ 2015-07-03  3:30   ` Michel Dänzer
  0 siblings, 0 replies; 3+ messages in thread
From: Michel Dänzer @ 2015-07-03  3:30 UTC (permalink / raw)
  To: Grigori Goronzy; +Cc: dri-devel


[ Dropping stable@vger.kernel.org from Cc; the patch will be picked up
for stable after it lands in Linus' tree ]

On 03.07.2015 08:54, Grigori Goronzy wrote:
> 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.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=100541
> Cc: stable@vger.kernel.org
> Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
> ---
>  drivers/gpu/drm/radeon/radeon_device.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index 14deeae..dddd5df 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -1578,6 +1578,20 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon)
>  		drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
>  	}
>  
> +	/* unpin cursors */
> +	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
> +		struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
> +
> +		if (radeon_crtc->cursor_bo) {
> +			struct radeon_bo *robj = gem_to_radeon_bo(radeon_crtc->cursor_bo);
> +			r = radeon_bo_reserve(robj, false);
> +			if (r == 0) {
> +				radeon_bo_unpin(robj);
> +				radeon_bo_unreserve(robj);
> +			}
> +		}
> +	}
> +
>  	/* unpin the front buffers */
>  	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
>  		struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->primary->fb);
> 

This could be done in the same loop as the front buffers.

On resume, the cursor BO is currently pinned again by
radeon_cursor_reset -> radeon_set_cursor. However, radeon_cursor_reset
is also called when changing the video mode, in which case it causes the
cursor BO pin count to increase by 1 for each CRTC using it. Presumably,
the mouse cursor would end up broken again on suspend/resume after that
for you.

We need a solution which pins the BO again on resume but doesn't
increase the pin count during a mode change. I'm not sure right now what
the best way is to achieve that, I'll think about it more later.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-03  3:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1435881253-4912-1-git-send-email-greg@chown.ath.cx>
2015-07-02 23:54 ` [PATCH 2/4] drm/radeon: fix HDP flushing Grigori Goronzy
2015-07-02 23:54 ` [PATCH 4/4] drm/radeon: unpin cursor BOs before suspend Grigori Goronzy
2015-07-03  3:30   ` Michel Dänzer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).