[Xorg-driver-geode] DPMS power cycle during X startup

Daniel Drake dsd at laptop.org
Mon Jul 5 12:35:47 PDT 2010


Hi,

The OLPC XO-1 has a "pretty boot" sequence which involves painting a
final startup screen on the display before starting X and then using
the special display controller (DCON) to freeze that image on screen
while X is starting up.

The display is then unfrozen when the window manager signals "ready",
avoiding an uncomfortable series of VT switches and blank screens, and
allowing the "XO" icon to remain on screen from the very moment that
the machine was powered on until the UI has fully loaded (an important
element of the design).

This worked well in the Fedora 9 days but as of more recent versions
(e.g. F11), the display (including DCON) is being power cycled during
regular X startup, resulting in some corruption on-screen,
interrupting the pretty boot process. This behaviour change was
introduced by the driver port to RandR1.2

First, xf86PrepareCrtcs() powers down the display because it doesn't
know which CRTC is active on the output, because geode doesn't
implement get_crtc. I don't understand why this is needed, as the
attached patch will show, it's trivial and X already knows about this
association. (this probably means that I'm missing something. either
way, the patch avoids this)


Secondly, without checking the current display configuration, X
decides that a new CRTC configuration is needed so it calls prepare,
sets the mode, and commits the new configuration, causing
xf86-video-geode to cycle the display power and DCON.

In reality we already have the right mode being used (with lxfb) but
there is no codepath within the X server which looks at the current
mode before applying the new one -- this "flicker-free operation" is
now only possible with KMS.

We can work around this issue by avoiding the DCON power-down if an
image is frozen on screen. Patch attached.

The real solution would be porting everything to KMS, but until that
happens, please consider these 2 patches which we'll be shipping.

Daniel
-------------- next part --------------
Add get_crtc output func

From: Daniel Drake <dsd at laptop.org>

I don't know why X can't do this itself, but when no get_crtc method is
provided, X decides that it doesn't know the CRTC of the output and
decides to reset the mode completely (causing display powerdown, resulting
in an uncomfortable visual interruption to OLPC's boot process).

Index: xf86-video-geode-2.11.2/src/lx_output.c
===================================================================
--- xf86-video-geode-2.11.2.orig/src/lx_output.c
+++ xf86-video-geode-2.11.2/src/lx_output.c
@@ -228,6 +228,12 @@ lx_output_destroy(xf86OutputPtr output)
     output->driver_private = NULL;
 }
 
+static xf86CrtcPtr lx_output_get_crtc(xf86OutputPtr output)
+{
+    return output->crtc;
+}
+
+
 static const xf86OutputFuncsRec lx_output_funcs = {
     .create_resources = lx_create_resources,
     .dpms = lx_output_dpms,
@@ -240,6 +246,7 @@ static const xf86OutputFuncsRec lx_outpu
     .commit = lx_output_commit,
     .detect = lx_output_detect,
     .get_modes = lx_output_get_modes,
+    .get_crtc = lx_output_get_crtc,
     .set_property = lx_output_set_property,
     .destroy = lx_output_destroy,
 };
-------------- next part --------------
Don't power down DCON when it is frozen

From: Daniel Drake <dsd at laptop.org>

Putting a frozen DCON to sleep (as happens during regular boot of the XO)
will cause the frozen image to be corrupted.

Change the behaviour to only sleep when the DCON is not frozen.

http://dev.laptop.org/ticket/10196

Index: xf86-video-geode-2.11.2/src/geode_dcon.c
===================================================================
--- xf86-video-geode-2.11.2.orig/src/geode_dcon.c
+++ xf86-video-geode-2.11.2/src/geode_dcon.c
@@ -38,6 +38,7 @@
 #include <fcntl.h>
 
 #define DCON_SLEEP_FILE "/sys/devices/platform/dcon/sleep"
+#define DCON_FREEZE_FILE "/sys/devices/platform/dcon/freeze"
 
 static Bool
 dcon_present(void)
@@ -54,6 +55,7 @@ int
 DCONDPMSSet(ScrnInfoPtr pScrni, int mode)
 {
     static int failed = -1;
+    ssize_t ret;
     int fd;
     char value[1];
 
@@ -63,6 +65,25 @@ DCONDPMSSet(ScrnInfoPtr pScrni, int mode
     if (failed)
 	return 0;
 
+    /* If the DCON is frozen, don't power it down, it was probably frozen
+     * for a reason and powering it down would corrupt the display.
+     * This is needed to avoid losing OLPC's frozen boot image during X
+     * startup, where DPMS is used to power down and up the display.
+     * When geode uses KMS this will not be needed as the system realises
+     * that no mode change is needed and the display power is untouched. */
+    fd = open(DCON_FREEZE_FILE, O_RDONLY);
+    if (fd < 0) {
+	failed = 1;
+	return 0;
+    }
+
+    ret = read(fd, value, 1);
+    close(fd);
+    if (ret == 1) {
+	if (value[0] == '1')
+	    return 0;
+    }
+
     fd = open(DCON_SLEEP_FILE, O_WRONLY);
 
     if (fd < 0) {


More information about the Xorg-driver-geode mailing list