From c4eb5528a456b65c673f7c984d14a622ac67cdca Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 5 Jun 2012 16:04:16 +0100 Subject: [PATCH] uxa: Check for DPMS off before scheduling a WAIT_ON_EVENT Regression from commit 3f3bde4f0c72f6f31aae322bcdc20b95eade6631 Author: Chris Wilson Date: Thu May 24 11:58:46 2012 +0100 uxa: Only consider an output valid if the kernel reports it attached When backporting from SNA, a key difference that UXA does not track DPMS state in its enabled flag and that a DPMS off CRTC is still bound to the fb. So we do need to rescan the outputs and check that we have a connector enabled *and* the pipe is running prior to emitting a scanline wait. References: https://bugs.freedesktop.org/show_bug.cgi?id=50668 Signed-off-by: Chris Wilson --- src/intel_display.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/intel_display.c b/src/intel_display.c index 7d75abb4..6f3f7e64 100644 --- a/src/intel_display.c +++ b/src/intel_display.c @@ -1716,13 +1716,28 @@ int intel_crtc_to_pipe(xf86CrtcPtr crtc) Bool intel_crtc_on(xf86CrtcPtr crtc) { struct intel_crtc *intel_crtc = crtc->driver_private; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); drmModeCrtcPtr drm_crtc; Bool ret; + int i; if (!crtc->enabled) return FALSE; /* Kernel manages CRTC status based on output config */ + ret = FALSE; + for (i = 0; i < xf86_config->num_output; i++) { + xf86OutputPtr output = xf86_config->output[i]; + if (output->crtc == crtc && + intel_output_dpms_status(output) == DPMSModeOn) { + ret = TRUE; + break; + } + } + if (!ret) + return FALSE; + + /* And finally check with the kernel that the fb is bound */ drm_crtc = drmModeGetCrtc(intel_crtc->mode->fd, crtc_id(intel_crtc)); if (drm_crtc == NULL) return FALSE;