[gdm] slave: Use more RANDR 1.3



commit cafa3bf4fc99a3a5dcf43efe339a72c49cc2ee2c
Author: Adam Jackson <ajax redhat com>
Date:   Mon Jan 28 13:22:39 2013 -0500

    slave: Use more RANDR 1.3
    
    GetScreenResources has the side effect of re-polling outputs, which is
    probably a waste for us.  X just started, it just _did_ connection
    sense, we don't need to do it again.
    
    For cases where the driver either does not or does not always cache
    EDID, this should speed up login by about 100ms per uncached display.
    
    Signed-off-by: Adam Jackson <ajax redhat com>

 daemon/gdm-slave.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gdm-slave.c b/daemon/gdm-slave.c
index ffe2aca..91ccbce 100644
--- a/daemon/gdm-slave.c
+++ b/daemon/gdm-slave.c
@@ -444,6 +444,27 @@ gdm_slave_save_root_windows (GdmSlave *slave)
         XSync (slave->priv->server_display, False);
 }
 
+static XRRScreenResources *
+get_screen_resources (Display *dpy)
+{
+        int major = 0, minor = 0;
+
+        if (!XRRQueryVersion(dpy, &major, &minor)) {
+                return NULL;
+        }
+
+        if (major > 1) {
+                return NULL;
+        }
+
+        if (minor >= 3) {
+                return XRRGetScreenResourcesCurrent (dpy,
+                                                     DefaultRootWindow (dpy));
+        }
+
+        return XRRGetScreenResources (dpy, DefaultRootWindow (dpy));
+}
+
 static void
 determine_initial_cursor_position (GdmSlave *slave,
                                    int      *x,
@@ -462,8 +483,7 @@ determine_initial_cursor_position (GdmSlave *slave,
                                  DefaultScreen (slave->priv->server_display));
 
         gdm_error_trap_push ();
-        resources = XRRGetScreenResources (slave->priv->server_display,
-                                           DefaultRootWindow (slave->priv->server_display));
+        resources = get_screen_resources (slave->priv->server_display);
         primary_output = XRRGetOutputPrimary (slave->priv->server_display,
                                               DefaultRootWindow (slave->priv->server_display));
         gdm_error_trap_pop ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]