From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Michel_D=c3=a4nzer?= Subject: Re: [PATCH 4/4] drm/radeon: unpin cursor BOs before suspend Date: Fri, 3 Jul 2015 12:30:04 +0900 Message-ID: <559601BC.2030703@daenzer.net> References: <1435881253-4912-1-git-send-email-greg@chown.ath.cx> <1435881253-4912-4-git-send-email-greg@chown.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <1435881253-4912-4-git-send-email-greg@chown.ath.cx> Sender: stable-owner@vger.kernel.org To: Grigori Goronzy Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org [ 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. >=20 > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=3D100541 > Cc: stable@vger.kernel.org > Signed-off-by: Grigori Goronzy > --- > drivers/gpu/drm/radeon/radeon_device.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) >=20 > 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); > } > =20 > + /* unpin cursors */ > + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { > + struct radeon_crtc *radeon_crtc =3D to_radeon_crtc(crtc); > + > + if (radeon_crtc->cursor_bo) { > + struct radeon_bo *robj =3D gem_to_radeon_bo(radeon_crtc->cursor_b= o); > + r =3D radeon_bo_reserve(robj, false); > + if (r =3D=3D 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 =3D to_radeon_framebuffer(crtc->pri= mary->fb); >=20 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 th= e 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 wha= t the best way is to achieve that, I'll think about it more later. --=20 Earthling Michel D=C3=A4nzer | http://www.a= md.com Libre software enthusiast | Mesa and X develope= r