drm/radeon: Ensure vblank interrupt is enabled on DPMS transition to on
diff mbox

Message ID 20161122083512.1597-1-michel@daenzer.net
State New
Headers show

Commit Message

Michel Dänzer Nov. 22, 2016, 8:35 a.m. UTC
From: Michel Dänzer <michel.daenzer@amd.com>

Fixes the vblank interrupt being disabled when it should be on, which
can cause at least the following symptoms:

* Hangs when running 'xset dpms force off' in a GNOME session with
  gnome-shell using DRI2.
* RandR 1.4 slave outputs freezing with garbage displayed using
  xf86-video-ati 7.8.0 or newer.

NOTE: This patch only applies to 4.5.y or older kernels. With newer
kernels, this problem cannot happen because the driver now uses
drm_crtc_vblank_on/off instead of drm_vblank_pre/post_modeset. I
consider this patch safer for older kernels than backporting the API
change, because drm_crtc_vblank_on/off had various issues in older
kernels, and I'm not sure all fixes for those have been backported to
all stable branches where this patch could be applied.

Reported-and-Tested-by: Max Staudt <mstaudt@suse.de>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 drivers/gpu/drm/radeon/atombios_crtc.c      | 2 ++
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 2 ++
 2 files changed, 4 insertions(+)

Comments

Daniel Vetter Nov. 22, 2016, 10:09 a.m. UTC | #1
On Tue, Nov 22, 2016 at 05:35:12PM +0900, Michel Dänzer wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
> 
> Fixes the vblank interrupt being disabled when it should be on, which
> can cause at least the following symptoms:
> 
> * Hangs when running 'xset dpms force off' in a GNOME session with
>   gnome-shell using DRI2.
> * RandR 1.4 slave outputs freezing with garbage displayed using
>   xf86-video-ati 7.8.0 or newer.
> 
> NOTE: This patch only applies to 4.5.y or older kernels. With newer
> kernels, this problem cannot happen because the driver now uses
> drm_crtc_vblank_on/off instead of drm_vblank_pre/post_modeset. I
> consider this patch safer for older kernels than backporting the API
> change, because drm_crtc_vblank_on/off had various issues in older
> kernels, and I'm not sure all fixes for those have been backported to
> all stable branches where this patch could be applied.

Yeah, makes sense to opt for the conservative option for backporting. I
guess for stable this needs some reference to the corresponding upstream
fix, which is:

commit 777e3cbc791f131806d9bf24b3325637c7fc228d
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Jan 21 11:08:57 2016 +0100

    drm/radeon: Switch to drm_vblank_on/off

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> 
> Reported-and-Tested-by: Max Staudt <mstaudt@suse.de>
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c      | 2 ++
>  drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
> index dac78ad..115b4a4 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -275,6 +275,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
>  			atombios_enable_crtc_memreq(crtc, ATOM_ENABLE);
>  		atombios_blank_crtc(crtc, ATOM_DISABLE);
>  		drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
> +		/* Make sure vblank interrupt is still enabled if needed */
> +		radeon_irq_set(rdev);
>  		radeon_crtc_load_lut(crtc);
>  		break;
>  	case DRM_MODE_DPMS_STANDBY:
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> index 678b438..89f22bd 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> @@ -331,6 +331,8 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
>  			WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl));
>  		}
>  		drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
> +		/* Make sure vblank interrupt is still enabled if needed */
> +		radeon_irq_set(rdev);
>  		radeon_crtc_load_lut(crtc);
>  		break;
>  	case DRM_MODE_DPMS_STANDBY:
> -- 
> 2.10.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher Nov. 22, 2016, 2:52 p.m. UTC | #2
On Tue, Nov 22, 2016 at 3:35 AM, Michel Dänzer <michel@daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> Fixes the vblank interrupt being disabled when it should be on, which
> can cause at least the following symptoms:
>
> * Hangs when running 'xset dpms force off' in a GNOME session with
>   gnome-shell using DRI2.
> * RandR 1.4 slave outputs freezing with garbage displayed using
>   xf86-video-ati 7.8.0 or newer.
>
> NOTE: This patch only applies to 4.5.y or older kernels. With newer
> kernels, this problem cannot happen because the driver now uses
> drm_crtc_vblank_on/off instead of drm_vblank_pre/post_modeset. I
> consider this patch safer for older kernels than backporting the API
> change, because drm_crtc_vblank_on/off had various issues in older
> kernels, and I'm not sure all fixes for those have been backported to
> all stable branches where this patch could be applied.
>
> Reported-and-Tested-by: Max Staudt <mstaudt@suse.de>
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c      | 2 ++
>  drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
> index dac78ad..115b4a4 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -275,6 +275,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
>                         atombios_enable_crtc_memreq(crtc, ATOM_ENABLE);
>                 atombios_blank_crtc(crtc, ATOM_DISABLE);
>                 drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
> +               /* Make sure vblank interrupt is still enabled if needed */
> +               radeon_irq_set(rdev);
>                 radeon_crtc_load_lut(crtc);
>                 break;
>         case DRM_MODE_DPMS_STANDBY:
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> index 678b438..89f22bd 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
> @@ -331,6 +331,8 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
>                         WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl));
>                 }
>                 drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
> +               /* Make sure vblank interrupt is still enabled if needed */
> +               radeon_irq_set(rdev);
>                 radeon_crtc_load_lut(crtc);
>                 break;
>         case DRM_MODE_DPMS_STANDBY:
> --
> 2.10.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index dac78ad..115b4a4 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -275,6 +275,8 @@  void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
 			atombios_enable_crtc_memreq(crtc, ATOM_ENABLE);
 		atombios_blank_crtc(crtc, ATOM_DISABLE);
 		drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
+		/* Make sure vblank interrupt is still enabled if needed */
+		radeon_irq_set(rdev);
 		radeon_crtc_load_lut(crtc);
 		break;
 	case DRM_MODE_DPMS_STANDBY:
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index 678b438..89f22bd 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -331,6 +331,8 @@  static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
 			WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl));
 		}
 		drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
+		/* Make sure vblank interrupt is still enabled if needed */
+		radeon_irq_set(rdev);
 		radeon_crtc_load_lut(crtc);
 		break;
 	case DRM_MODE_DPMS_STANDBY: