xserver: Branch 'server-1.6-branch' - 2 commits

Keith Packard keithp at kemper.freedesktop.org
Fri Jan 30 20:38:09 PST 2009


 randr/randr.c      |    2 +-
 randr/randrstr.h   |    2 +-
 randr/rrinfo.c     |   10 +++++++++-
 randr/rrscreen.c   |   21 ++++++++++++---------
 randr/rrxinerama.c |   23 ++++++++++++-----------
 5 files changed, 35 insertions(+), 23 deletions(-)

New commits:
commit 56f6fb8c8652c85e522e42557f8969987069076b
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Jan 30 19:06:17 2009 -0800

    randr: Avoid re-querying the configuration on everything but GetScreenResources.
    
    The new path should only re-query on the other requests when we haven't
    gathered the information from the DDX yet (such as with a non-RandR 1.2 DDX).
    
    Bug #19037.
    (cherry picked from commit 317f2b4a9fe4b606975711bc332166a82db5087d)

diff --git a/randr/randrstr.h b/randr/randrstr.h
index b5cebdc..9c9b7c0 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -468,7 +468,7 @@ RRTellChanged (ScreenPtr pScreen);
  * Poll the driver for changed information
  */
 Bool
-RRGetInfo (ScreenPtr pScreen);
+RRGetInfo (ScreenPtr pScreen, Bool force_query);
 
 Bool RRInit (void);
 
diff --git a/randr/rrinfo.c b/randr/rrinfo.c
index 38314de..12b9a4a 100644
--- a/randr/rrinfo.c
+++ b/randr/rrinfo.c
@@ -178,12 +178,20 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
  * Poll the driver for changed information
  */
 Bool
-RRGetInfo (ScreenPtr pScreen)
+RRGetInfo (ScreenPtr pScreen, Bool force_query)
 {
     rrScrPriv (pScreen);
     Rotation	    rotations;
     int		    i;
 
+    /* Return immediately if we don't need to re-query and we already have the
+     * information.
+     */
+    if (!force_query) {
+	if (pScrPriv->numCrtcs != 0 || pScrPriv->numOutputs != 0)
+	    return TRUE;
+    }
+
     for (i = 0; i < pScrPriv->numOutputs; i++)
 	pScrPriv->outputs[i]->changed = FALSE;
     for (i = 0; i < pScrPriv->numCrtcs; i++)
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 95662c9..da633b2 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -224,7 +224,7 @@ ProcRRGetScreenSizeRange (ClientPtr client)
     
     if (pScrPriv) 
     {
-	if (!RRGetInfo (pScreen))
+	if (!RRGetInfo (pScreen, FALSE))
 	    return BadAlloc;
 	rep.minWidth  = pScrPriv->minWidth;
 	rep.minHeight = pScrPriv->minHeight;
@@ -340,7 +340,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
     rep.pad = 0;
     
     if (query && pScrPriv)
-	if (!RRGetInfo (pScreen))
+	if (!RRGetInfo (pScreen, query))
 	    return BadAlloc;
 
     if (!pScrPriv)
@@ -615,7 +615,7 @@ ProcRRGetScreenInfo (ClientPtr client)
     rep.pad = 0;
     
     if (pScrPriv)
-	if (!RRGetInfo (pScreen))
+	if (!RRGetInfo (pScreen, FALSE))
 	    return BadAlloc;
 
     output = RRFirstOutput (pScreen);
@@ -796,7 +796,7 @@ ProcRRSetScreenConfig (ClientPtr client)
 	rep.status = RRSetConfigFailed;
 	goto sendReply;
     }
-    if (!RRGetInfo (pScreen))
+    if (!RRGetInfo (pScreen, FALSE))
 	return BadAlloc;
     
     output = RRFirstOutput (pScreen);
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index 7f9a798..36135c6 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -307,12 +307,8 @@ ProcRRXineramaQueryScreens(ClientPtr client)
     REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
 
     if (RRXineramaScreenActive (pScreen))
-    {
-	rrScrPriv(pScreen);
-	if (pScrPriv->numCrtcs == 0 || pScrPriv->numOutputs == 0)
-	    RRGetInfo (pScreen);
-    }
-    
+	RRGetInfo (pScreen, FALSE);
+
     rep.type = X_Reply;
     rep.sequenceNumber = client->sequence;
     rep.number = RRXineramaScreenCount (pScreen);
commit 6d928aa227b12832dd358619722a5f4dc71b5d19
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Jan 30 20:17:10 2009 -0800

    RandR crtcs not fetched correctly when primary output is set.
    
    Primary outputs may not have a CRTC.
    Loops fetching CRTCs respecting primary output were broken.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 4de5705545792d77c9990bbec3e263a517757a2a)

diff --git a/randr/randr.c b/randr/randr.c
index 2e482f0..6fe9b56 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -438,7 +438,7 @@ RRFirstOutput (ScreenPtr pScreen)
     RROutputPtr		    output;
     int	i, j;
     
-    if (pScrPriv->primaryOutput)
+    if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
 	return pScrPriv->primaryOutput;
 
     for (i = 0; i < pScrPriv->numCrtcs; i++)
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 9b1024e..95662c9 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -324,7 +324,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
     rrScrPrivPtr		pScrPriv;
     CARD8			*extra;
     unsigned long		extraLen;
-    int				i, n, rc, has_primary;
+    int				i, n, rc, has_primary = 0;
     RRCrtc			*crtcs;
     RROutput			*outputs;
     xRRModeInfo			*modeinfos;
@@ -402,19 +402,22 @@ rrGetScreenResources(ClientPtr client, Bool query)
 	modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs);
 	names = (CARD8 *) (modeinfos + num_modes);
 
-	has_primary = (pScrPriv->primaryOutput != NULL);
-	if (pScrPriv->primaryOutput)
+	if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
 	{
-	    crtcs[0] = pScrPriv->primaryOutput->id;
+	    has_primary = 1;
+	    crtcs[0] = pScrPriv->primaryOutput->crtc->id;
 	    if (client->swapped)
 		swapl (&crtcs[0], n);
 	}
 	
 	for (i = 0; i < pScrPriv->numCrtcs; i++)
 	{
-	    if (pScrPriv->primaryOutput &&
+	    if (has_primary &&
 		pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
+	    {
+		has_primary = 0;
 		continue;
+	    }
 	    crtcs[i + has_primary] = pScrPriv->crtcs[i]->id;
 	    if (client->swapped)
 		swapl (&crtcs[i + has_primary], n);
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index 5af6fb0..7f9a798 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -328,16 +328,21 @@ ProcRRXineramaQueryScreens(ClientPtr client)
     if(rep.number) {
 	rrScrPriv(pScreen);
 	int i;
-	int has_primary = (pScrPriv->primaryOutput != NULL);
+	int has_primary = 0;
 
-	if (has_primary) {
+	if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) {
+	    has_primary = 1;
 	    RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc);
 	}
 
 	for(i = 0; i < pScrPriv->numCrtcs; i++) {
-	    RRCrtcPtr	crtc = pScrPriv->crtcs[i];
-	    if (!has_primary || (crtc != pScrPriv->primaryOutput->crtc))
-		RRXineramaWriteCrtc(client, crtc);
+	    if (has_primary &&
+		pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
+	    {
+		has_primary = 0;
+		continue;
+	    }
+	    RRXineramaWriteCrtc(client, pScrPriv->crtcs[i]);
 	}
     }
 


More information about the xorg-commit mailing list