xf86-video-intel: src/sna/sna_driver.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Dec 10 12:06:23 PST 2012
src/sna/sna_driver.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
New commits:
commit 986e13a56a8544d5b32dbcaacbc0ee9cf5d47e27
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Dec 10 17:29:08 2012 +0000
sna: Try installing a fallback config on VT enter in case full desiredMode fails
This can happen naturally for 3-pipe config on Ivybridge or if the
outputs are rearranged whilst we slept. Instead of failing to change the
display on the VT, install at least a fb on the CompatOutput so that
hopefully the DE can take over, or give some control to the user.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 7ac44d2..fc80cf3 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -975,6 +975,50 @@ static void sna_free_screen(FREE_SCREEN_ARGS_DECL)
sna_close_drm_master(scrn);
}
+static void
+sna_set_fallback_mode(ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ DisplayModePtr mode;
+ int n;
+
+ output = xf86CompatOutput(scrn);
+ crtc = xf86CompatCrtc(scrn);
+ if (output == NULL || crtc == NULL)
+ return;
+
+ for (n = 0; n < config->num_output; n++)
+ config->output[n]->crtc = NULL;
+ for (n = 0; n < config->num_crtc; n++)
+ config->crtc[n]->enabled = FALSE;
+
+ output->crtc = crtc;
+
+ mode = xf86OutputFindClosestMode(output, scrn->currentMode);
+ if (mode &&
+ xf86CrtcSetModeTransform(crtc, mode, RR_Rotate_0, NULL, 0, 0)) {
+ crtc->desiredMode = *mode;
+ crtc->desiredMode.prev = crtc->desiredMode.next = NULL;
+ crtc->desiredMode.name = NULL;
+ crtc->desiredMode.PrivSize = 0;
+ crtc->desiredMode.PrivFlags = 0;
+ crtc->desiredMode.Private = NULL;
+ crtc->desiredRotation = RR_Rotate_0;
+ crtc->desiredTransformPresent = FALSE;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ crtc->enabled = TRUE;
+ }
+
+ xf86DisableUnusedFunctions(scrn);
+#ifdef RANDR_12_INTERFACE
+ if (scrn->pScreen->root)
+ xf86RandR12TellChanged(scrn->pScreen);
+#endif
+}
+
/*
* This gets called when gaining control of the VT, and from ScreenInit().
*/
@@ -995,9 +1039,11 @@ static Bool sna_enter_vt(VT_FUNC_ARGS_DECL)
}
}
- if (!xf86SetDesiredModes(scrn))
+ if (!xf86SetDesiredModes(scrn)) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"failed to restore desired modes on VT switch\n");
+ sna_set_fallback_mode(scrn);
+ }
sna_mode_disable_unused(sna);
More information about the xorg-commit
mailing list