xserver: Branch 'server-1.4-branch' - 3 commits

Eric Anholt anholt at kemper.freedesktop.org
Tue Sep 4 13:06:39 PDT 2007


 composite/compalloc.c  |   73 ++++++++++++++++++++++++++++++++++++-------------
 composite/compint.h    |    3 ++
 composite/compwindow.c |    2 -
 randr/rrscreen.c       |   11 ++++---
 randr/rrxinerama.c     |   14 ++++-----
 5 files changed, 73 insertions(+), 30 deletions(-)

New commits:
diff-tree b69e6165136ff76ba4649bb9d11906fef27b78bc (from 87f98178417718d8720566a2df04857a682a2d15)
Author: Keith Packard <keithp at koto.keithp.com>
Date:   Sat Sep 1 21:14:22 2007 -0700

    [COMPOSITE] Composite used for pixmap population on redirect. (Bug #7447)
    
    compNewPixmap copies bits from the parent window to the redirected child
    pixmap to populate the pixmap with reasonable data. It cannot always use
    CopyArea as that only works across matching depths. Use Composite when
    the depths do not match.
    (cherry picked from commit f98dfec79dadb70fa7bba84e7335f92b3a73dc02)

diff --git a/composite/compalloc.c b/composite/compalloc.c
index f555411..006e808 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -461,7 +461,6 @@ compNewPixmap (WindowPtr pWin, int x, in
     ScreenPtr	    pScreen = pWin->drawable.pScreen;
     WindowPtr	    pParent = pWin->parent;
     PixmapPtr	    pPixmap;
-    GCPtr	    pGC;
 
     pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth);
 
@@ -471,25 +470,63 @@ compNewPixmap (WindowPtr pWin, int x, in
     pPixmap->screen_x = x;
     pPixmap->screen_y = y;
     
-    pGC = GetScratchGC (pWin->drawable.depth, pScreen);
-    
-    /*
-     * Copy bits from the parent into the new pixmap so that it will
-     * have "reasonable" contents in case for background None areas.
-     */
-    if (pGC)
+    if (pParent->drawable.depth == pWin->drawable.depth)
     {
-	XID val = IncludeInferiors;
+	GCPtr	pGC = GetScratchGC (pWin->drawable.depth, pScreen);
 	
-	ValidateGC(&pPixmap->drawable, pGC);
-	dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL);
-	(*pGC->ops->CopyArea) (&pParent->drawable,
-			       &pPixmap->drawable,
-			       pGC,
-			       x - pParent->drawable.x,
-			       y - pParent->drawable.y,
-			       w, h, 0, 0);
-	FreeScratchGC (pGC);
+	/*
+	 * Copy bits from the parent into the new pixmap so that it will
+	 * have "reasonable" contents in case for background None areas.
+	 */
+	if (pGC)
+	{
+	    XID val = IncludeInferiors;
+	    
+	    ValidateGC(&pPixmap->drawable, pGC);
+	    dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL);
+	    (*pGC->ops->CopyArea) (&pParent->drawable,
+				   &pPixmap->drawable,
+				   pGC,
+				   x - pParent->drawable.x,
+				   y - pParent->drawable.y,
+				   w, h, 0, 0);
+	    FreeScratchGC (pGC);
+	}
+    }
+    else
+    {
+	PictFormatPtr	pSrcFormat = compWindowFormat (pParent);
+	PictFormatPtr	pDstFormat = compWindowFormat (pWin);
+	XID		inferiors = IncludeInferiors;
+	int		error;
+
+	PicturePtr	pSrcPicture = CreatePicture (None,
+						     &pParent->drawable,
+						     pSrcFormat,
+						     CPSubwindowMode,
+						     &inferiors,
+						     serverClient, &error);
+						    
+	PicturePtr	pDstPicture = CreatePicture (None,
+						     &pPixmap->drawable,
+						     pDstFormat,
+						     0, 0,
+						     serverClient, &error);
+
+	if (pSrcPicture && pDstPicture)
+	{
+	    CompositePicture (PictOpSrc,
+			      pSrcPicture,
+			      NULL,
+			      pDstPicture,
+			      x - pParent->drawable.x,
+			      y - pParent->drawable.y,
+			      0, 0, 0, 0, w, h);
+	}
+	if (pSrcPicture)
+	    FreePicture (pSrcPicture, 0);
+	if (pDstPicture)
+	    FreePicture (pDstPicture, 0);
     }
     return pPixmap;
 }
diff --git a/composite/compint.h b/composite/compint.h
index 2c4d5c0..a5ed24e 100644
--- a/composite/compint.h
+++ b/composite/compint.h
@@ -232,6 +232,9 @@ compCheckTree (ScreenPtr pScreen);
 #define compCheckTree(s)
 #endif
 
+PictFormatPtr
+compWindowFormat (WindowPtr pWin);
+
 void
 compSetPixmap (WindowPtr pWin, PixmapPtr pPixmap);
 
diff --git a/composite/compwindow.c b/composite/compwindow.c
index a4c4e6f..bfd2946 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -685,7 +685,7 @@ compGetWindowVisual (WindowPtr pWin)
     return 0;
 }
 
-static PictFormatPtr
+PictFormatPtr
 compWindowFormat (WindowPtr pWin)
 {
     ScreenPtr	pScreen = pWin->drawable.pScreen;
diff-tree 87f98178417718d8720566a2df04857a682a2d15 (from 61460cf095a655d8711b79225080a8c2808dbbc4)
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Aug 31 22:11:13 2007 -0700

    [RANDR] Don't mark Xinerama as active if no crtcs are enabled. (bug #11504).
    
    Clients expect any Xinerama-enabled screen to report at least one
    monitor, but with RandR, there may not be any enabled crtcs. In this case,
    tell the client that Xinerama is not active.
    (cherry picked from commit 1afdf8b0a92437dffe84fa98b6083b3d8fd55e27)

diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index 2a57e4e..896f61f 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -148,12 +148,6 @@ ProcRRXineramaGetState(ClientPtr client)
 }
 
 static Bool
-RRXineramaScreenActive (ScreenPtr pScreen)
-{
-    return rrGetScrPriv(pScreen) != NULL;
-}
-
-static Bool
 RRXineramaCrtcActive (RRCrtcPtr crtc)
 {
     return crtc->mode != NULL && crtc->numOutputs > 0;
@@ -165,7 +159,7 @@ RRXineramaScreenCount (ScreenPtr pScreen
     int	i, n;
     
     n = 0;
-    if (RRXineramaScreenActive (pScreen))
+    if (rrGetScrPriv (pScreen))
     {
 	rrScrPriv(pScreen);
 	for (i = 0; i < pScrPriv->numCrtcs; i++)
@@ -175,6 +169,12 @@ RRXineramaScreenCount (ScreenPtr pScreen
     return n;
 }
 
+static Bool
+RRXineramaScreenActive (ScreenPtr pScreen)
+{
+    return RRXineramaScreenCount (pScreen) > 0;
+}
+
 int
 ProcRRXineramaGetScreenCount(ClientPtr client)
 {
diff-tree 61460cf095a655d8711b79225080a8c2808dbbc4 (from ec56c5e958248ea0161dda885fa59752b20f5d7c)
Author: Marius Gedminas <mgedmin at b4net.lt>
Date:   Fri Aug 31 21:36:37 2007 -0700

    [RANDR] Compare only milliseconds of config time. (Bug #6502)
    
    The timestamp transferred in the X protocol is a 32-bit number of
    milliseconds.
    
    The timestamp stored in the server is a structure that contains two fields:
    months (!) and milliseconds.
    
    When the server passes the config timestamp to the client, it discards the
    months part and sends only the milliseconds part.
    
    When the server receives the config timestamp from the client, it tries to
    guess the "months" part by looking at the current time and then maybe adding
    or
    subtracting one.  The guess is wrong after the server has been running long
    enough (several hours).
    
    I have added two ErrorF calls around the 'if' statement that returns
    RRSetConfigInvalidConfigTimestamp in randr/randr.c and my Xorg.0.log has
    this:
    
      randr request got good config time: 0:-2103495671
    
    for the first few successful xrandr calls, and
    
      randr request failed with RRSetConfigInvalidConfigTime: client passed
      1:-2103495671, server has 0:-2103495671
    
    when it fails.  The server has been running for 8 and a half hours.
    
    The obvious fix would be to ignore the months field and only compare the
    milliseconds.
    (cherry picked from commit 0dc2bb6101704d0fd25f36e2c3df79687f119f5b)

diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 8798b42..811a557 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -766,7 +766,6 @@ ProcRRSetScreenConfig (ClientPtr client)
     pScrPriv = rrGetScrPriv(pScreen);
     
     time = ClientTimeToServerTime(stuff->timestamp);
-    configTime = ClientTimeToServerTime(stuff->configTimestamp);
     
     if (!pScrPriv)
     {
@@ -788,11 +787,15 @@ ProcRRSetScreenConfig (ClientPtr client)
     crtc = output->crtc;
 
     /*
-     * if the client's config timestamp is not the same as the last config
+     * If the client's config timestamp is not the same as the last config
      * timestamp, then the config information isn't up-to-date and
-     * can't even be validated
+     * can't even be validated.
+     *
+     * Note that the client only knows about the milliseconds part of the
+     * timestamp, so using CompareTimeStamps here would cause randr to suddenly
+     * stop working after several hours have passed (freedesktop bug #6502).
      */
-    if (CompareTimeStamps (configTime, pScrPriv->lastConfigTime) != 0)
+    if (stuff->configTimestamp != pScrPriv->lastConfigTime.milliseconds)
     {
 	rep.status = RRSetConfigInvalidConfigTime;
 	goto sendReply;


More information about the xorg-commit mailing list