Skip to contentSkip to conversation

xf86-video-intel: deactivate unused CRTCs

PATCH In review Helge Bahmann 2 participants 3 messages Dec 15, 2011 – Mar 26, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xf86-video-intel: deactivate unused CRTCs

Hi everyone,

would you mind putting something along the following into xf86-video-intel?

Thanks!
Helge Bahmann

---
Deactivate unused CRTCs

Have intel_crtc_dpms actually do something and deactivate CRTCs on demand. This allows the X-Server to actually deactivate all unused CRTCs, avoiding the following bug scenario:

- boot system with only internal LVDS display
- start X
- attach external display
- use xrandr to turn off internal LVDS, and turn on external display
- switch to console
- switch back to X
- use xrandr to turn off external display, turn an internal LVDS

At this point X believes that internal LVDS is active, when in fact it is not displaying any image. The root cause appears to be that X and kernel disagree on CRTC states.

This problem is verifiable on some notebooks (e.g. ThinkPad T400) but not all. I guess this is due to varying crtc selection logic.

---
 src/intel_display.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
src/intel_display.c +8 -2
index b6592c4..f771df8 100644
@@ -324,9 +324,15 @@ mode_to_kmode(ScrnInfoPtr scrn,
 }
 
 static void
-intel_crtc_dpms(xf86CrtcPtr intel_crtc, int mode)
+intel_crtc_dpms(xf86CrtcPtr crtc, int mode)
 {
-
+	struct intel_crtc *intel_crtc = crtc->driver_private;
+	struct intel_mode *modeset = intel_crtc->mode;
+	if (mode == DPMSModeOff) {
+		drmModeSetCrtc(modeset->fd, crtc_id(intel_crtc),
+				0, 0, 0, NULL, 0,
+				NULL);
+	}
 }
 
 static Bool
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 3 lines · Helge Bahmann

Hi everyone,

would you mind putting something along the following into xf86-video-intel?

A few months later... I looked at this and concluded that it is just working around a kernel bug, which I'm always optimistic will be resolved in the next release.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 10 lines · On Monday 26 March 2012 14:22:02 Chris Wilson wrote:
Quoted 4 lines · Helge Bahmann

Hi everyone,

would you mind putting something along the following into xf86-video-intel?

A few months later... I looked at this and concluded that it is just working around a kernel bug, which I'm always optimistic will be resolved in the next release.
-Chris

Most likely there is a "bug" in my understandig of how X-Server and drm console layer are supposed to cooperate:

- how does the kernel layer reliably distinguish between the states "userspace manages display heads vs. "kernel console layer manages display heads" ?
- how does the kernel layer reliably detect the "ground state" from which userspace starts setting up things ?
- what assumptions may user-space make on the "left-over" state when it takes over responsibility?

I don't think kernel code currently handles these issues too well, resulting in a number of odd corner cases when plugging/unplugging displays at the "right" times (while switched away from X, while in suspend-to-ram state, while X server resumes but is slow to re-setup things because it got paged out...). My best shot at fixing this was to have X not make too many assumptions on the state after taking over, and bring everything into a well-defined state.

Could you perhaps briefly explain how the interaction is supposed to look? I would really like to provide a more "correct" fix, but I don't fully grasp the intended model so far.

Best regards
Helge

Signature · 19 lines
Dr.-Ing.
Helge Bahmann
Berater
Geschäftsbereich Hochsicherheit
secunet Security Networks AG
Ammonstraße 74
01067 Dresden, Germany
Fon: +49 201 54 54-3586
Fax: +49 201 54 54-1323
Email: [email protected]

Sitz: Kronprinzenstraße 30, 45128 Essen
Amtsgericht Essen HRB 13615
Vorstand: Dr. Rainer Baumgart, Thomas Koelzer, Thomas Pleines
Aufsichtsratsvorsitzender: Dr. Karsten Ottenberg
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx