xserver: Branch 'master' - 4 commits

Keith Packard keithp at kemper.freedesktop.org
Tue Aug 10 09:30:29 PDT 2010


 dix/dixfonts.c                  |  101 +++++++++++++++++++---------------------
 fb/fbpict.c                     |   24 +++++++--
 hw/xwin/glx/indirect.c          |   14 +++--
 include/closestr.h              |    5 -
 miext/rootless/rootlessCommon.c |    3 +
 5 files changed, 78 insertions(+), 69 deletions(-)

New commits:
commit fbd02046797185715e1a120d52e410ec78fc365f
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Aug 5 15:19:20 2010 +0100

    Cygwin/X: Fix glxWinCreateDrawable() for API change
    
    Commit 9de0e31746d5f0d9d39d11c94ec3cbc04a9935fc changed the signature
    of __GLXScreen's createDrawable method.
    
    Update the glxWinCreateDrawable() function in XWin's GLX provider
    appropriately.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 8ec40da..1cf82a7 100755
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -375,10 +375,12 @@ static __GLXscreen *glxWinScreenProbe(ScreenPtr pScreen);
 static __GLXcontext *glxWinCreateContext(__GLXscreen *screen,
                                         __GLXconfig *modes,
                                         __GLXcontext *baseShareContext);
-static __GLXdrawable *glxWinCreateDrawable(__GLXscreen *screen,
+static __GLXdrawable *glxWinCreateDrawable(ClientPtr client,
+                                          __GLXscreen *screen,
                                           DrawablePtr pDraw,
-                                          int type,
                                           XID drawId,
+                                          int type,
+                                          XID glxDrawId,
                                           __GLXconfig *conf);
 
 static Bool glxWinRealizeWindow(WindowPtr pWin);
@@ -901,10 +903,12 @@ glxWinDrawableDestroy(__GLXdrawable *base)
 }
 
 static __GLXdrawable *
-glxWinCreateDrawable(__GLXscreen *screen,
+glxWinCreateDrawable(ClientPtr client,
+                    __GLXscreen *screen,
                     DrawablePtr pDraw,
-                    int type,
                     XID drawId,
+                    int type,
+                    XID glxDrawId,
                     __GLXconfig *conf)
 {
   __GLXWinDrawable *glxPriv;
@@ -916,7 +920,7 @@ glxWinCreateDrawable(__GLXscreen *screen,
 
   memset(glxPriv, 0, sizeof *glxPriv);
 
-  if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, drawId, conf)) {
+  if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
     free(glxPriv);
     return NULL;
   }
commit ff70848e623920779d20f35d47e9e1f34157de47
Author: Keith Packard <keithp at keithp.com>
Date:   Fri May 21 09:01:43 2010 -0700

    Don't let alpha maps recurse in fb. Bug 23581.
    
    Recursive alpha maps (where one picture's alpha map is set to a
    picture with an external alpha map) would be all fine and dandy,
    except for the case where the client constructs a loop. Detecting this
    case when setting the alpha map values would be difficult as any time
    an alpha map is set, the server would have to check for the looping
    case.
    
    Instead, a far simpler fix is to simply disallow recursive alpha maps
    in the rendering code, the Render spec is ambiguous in this area and
    allows us to to ignore the recursive case.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fbpict.c b/fb/fbpict.c
index 26cdc0d..f7f1200 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -332,8 +332,11 @@ create_bits_picture (PicturePtr pict,
     return image;
 }
 
+static pixman_image_t *
+image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map);
+
 static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
 {
     pixman_repeat_t repeat;
     pixman_filter_t filter;
@@ -382,10 +385,13 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
     
     pixman_image_set_repeat (image, repeat);
     
-    if (pict->alphaMap)
+    /* Fetch alpha map unless 'pict' is being used
+     * as the alpha map for this operation
+     */
+    if (pict->alphaMap && !is_alpha_map)
     {
 	int alpha_xoff, alpha_yoff;
-	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff);
+	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE);
 	
 	pixman_image_set_alpha_map (
 	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
@@ -417,8 +423,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
     pixman_image_set_source_clipping (image, TRUE);
 }
 
-pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+static pixman_image_t *
+image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
 {
     pixman_image_t *image = NULL;
 
@@ -452,11 +458,17 @@ image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
     }
     
     if (image)
-	set_image_properties (image, pict, has_clip, xoff, yoff);
+	set_image_properties (image, pict, has_clip, xoff, yoff, is_alpha_map);
     
     return image;
 }
 
+pixman_image_t *
+image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+{
+    return image_from_pict_internal (pict, has_clip, xoff, yoff, FALSE);
+}
+
 void
 free_pixman_pict (PicturePtr pict, pixman_image_t *image)
 {
commit 70a94c5b7a42adc0995bf774c44587a0778be0d0
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Tue Aug 3 19:49:10 2010 +0100

    rootless: fix uninitialized private key assert in non-rootless modes in Cygwin/X
    
    IsFramedWindow() is called from miPaintWindow() if the server has
    been built with ROOTLESS defined, irrespective of if RootlessInit()
    has ever been called, or not.
    
    Add a check to IsFramedWindow() to check if rootlessWindowPrivateKey
    has been registered (as a proxy for checking if the rootless extension
    has been initialized) so we don't go on to try to use that key,
    triggering an assert.
    
    This bug exposes what appears to be a difference in opinion about
    the rootless extension between XQuartz and XWin.  XQuartz always
    initializes the rootless extension, whereas XWin offers several modes
    of operation, and the rootless extension is only used for one of them
    
    That probably means that the all code under compile time guard for
    ROOTLESS should be carefully checked that it doesn't also need to be
    under a run-time guard
    
    (I've reviewed the other ROOTLESS blocks in dix/events.c and
    dix/window.c and they look ok -- keithp)
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c
index 82fe0b9..f91cfb4 100644
--- a/miext/rootless/rootlessCommon.c
+++ b/miext/rootless/rootlessCommon.c
@@ -92,6 +92,9 @@ IsFramedWindow(WindowPtr pWin)
 {
     WindowPtr top;
 
+    if (!dixPrivateKeyRegistered(&rootlessWindowPrivateKeyRec))
+        return FALSE;
+
     if (!pWin->realized)
         return FALSE;
     top = TopLevelParent(pWin);
commit 3ab6cd31cbdf8095b2948034fce5fb645422d8da
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Aug 9 15:20:20 2010 -0400

    fonts: Fix refcounting for asynchronous font operations (#3040)
    
    When doing Xinerama, we'll dispatch font ops across all backend screens.
    If using a font server (such that some operations can sleep), we'll put
    the client to sleep once for each screen, but only wake up once, because
    we're trying to keep track of the sleep count in _each_ screen's
    closure.
    
    Instead, just ask the core whether the client is already asleep.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 4a8f113..e22eabe 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -321,10 +321,10 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
 	    continue;
 	}
 	if (err == Suspended) {
-	    if (!c->slept) {
-		c->slept = TRUE;
-		ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (pointer) c);
-	    }
+	    if (!ClientIsAsleep(client))
+		ClientSleep(client, (ClientSleepProcPtr)doOpenFont, c);
+	    else
+		goto xinerama_sleep;
 	    return TRUE;
 	}
 	break;
@@ -373,8 +373,8 @@ bail:
 	SendErrorToClient(c->client, X_OpenFont, 0,
 			  c->fontid, FontToXError(err));
     }
-    if (c->slept)
-	ClientWakeup(c->client);
+    ClientWakeup(c->client);
+xinerama_sleep:
     for (i = 0; i < c->num_fpes; i++) {
 	FreeFPE(c->fpe_list[i]);
     }
@@ -460,7 +460,6 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna
     c->current_fpe = 0;
     c->num_fpes = num_fpes;
     c->fnamelen = lenfname;
-    c->slept = FALSE;
     c->flags = flags;
     c->non_cachable_font = cached;
 
@@ -622,12 +621,12 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 		 c->names);
 
 	    if (err == Suspended) {
-		if (!c->slept) {
-		    c->slept = TRUE;
+		if (!ClientIsAsleep(client))
 		    ClientSleep(client,
-			(ClientSleepProcPtr)doListFontsAndAliases,
-			(pointer) c);
-		}
+				(ClientSleepProcPtr)doListFontsAndAliases,
+				c);
+		else
+		    goto xinerama_sleep;
 		return TRUE;
 	    }
 
@@ -650,12 +649,12 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 		     c->current.patlen, c->current.max_names - c->names->nnames,
 		     &c->current.private);
 		if (err == Suspended) {
-		    if (!c->slept) {
+		    if (!ClientIsAsleep(client))
 			ClientSleep(client,
 				    (ClientSleepProcPtr)doListFontsAndAliases,
-				    (pointer) c);
-			c->slept = TRUE;
-		    }
+				    c);
+		    else
+			goto xinerama_sleep;
 		    return TRUE;
 		}
 		if (err == Successful)
@@ -668,12 +667,12 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 		    ((pointer) c->client, fpe, &name, &namelen, &tmpname,
 		     &resolvedlen, c->current.private);
 		if (err == Suspended) {
-		    if (!c->slept) {
+		    if (ClientIsAsleep(client))
 			ClientSleep(client,
 				    (ClientSleepProcPtr)doListFontsAndAliases,
-				    (pointer) c);
-			c->slept = TRUE;
-		    }
+				    c);
+		    else
+			goto xinerama_sleep;
 		    return TRUE;
 		}
 		if (err == FontNameAlias) {
@@ -822,8 +821,8 @@ finish:
     free(bufferStart);
 
 bail:
-    if (c->slept)
-	ClientWakeup(client);
+    ClientWakeup(client);
+xinerama_sleep:
     for (i = 0; i < c->num_fpes; i++)
 	FreeFPE(c->fpe_list[i]);
     free(c->fpe_list);
@@ -881,7 +880,6 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
     c->current.list_started = FALSE;
     c->current.private = 0;
     c->haveSaved = FALSE;
-    c->slept = FALSE;
     c->savedName = 0;
     doListFontsAndAliases(client, c);
     return Success;
@@ -928,11 +926,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
 		 c->current.max_names, &c->current.private);
 	    if (err == Suspended)
  	    {
-		if (!c->slept)
- 		{
-		    ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c);
-		    c->slept = TRUE;
-		}
+		if (!ClientIsAsleep(client))
+		    ClientSleep(client,
+				(ClientSleepProcPtr)doListFontsWithInfo, c);
+		else
+		    goto xinerama_sleep;
 		return TRUE;
 	    }
 	    if (err == Successful)
@@ -947,13 +945,11 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
 		 &numFonts, c->current.private);
 	    if (err == Suspended)
  	    {
-		if (!c->slept)
- 		{
+		if (!ClientIsAsleep(client))
 		    ClientSleep(client,
-		    	     (ClientSleepProcPtr)doListFontsWithInfo,
-			     c);
-		    c->slept = TRUE;
-		}
+				(ClientSleepProcPtr)doListFontsWithInfo, c);
+		else
+		    goto xinerama_sleep;
 		return TRUE;
 	    }
 	}
@@ -1098,8 +1094,8 @@ finish:
 		     - sizeof(xGenericReply));
     WriteSwappedDataToClient(client, length, &finalReply);
 bail:
-    if (c->slept)
-	ClientWakeup(client);
+    ClientWakeup(client);
+xinerama_sleep:
     for (i = 0; i < c->num_fpes; i++)
 	FreeFPE(c->fpe_list[i]);
     free(c->reply);
@@ -1154,7 +1150,6 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
     c->current.private = 0;
     c->savedNumFonts = 0;
     c->haveSaved = FALSE;
-    c->slept = FALSE;
     c->savedName = 0;
     doListFontsWithInfo(client, c);
     return Success;
@@ -1181,7 +1176,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 	fpe = c->pGC->font->fpe;
 	(*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
 
-	if (c->slept)
+	if (ClientIsAsleep(client))
 	{
 	    /* Client has died, but we cannot bail out right now.  We
 	       need to clean up after the work we did when going to
@@ -1198,7 +1193,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
     }
 
     /* Make sure our drawable hasn't disappeared while we slept. */
-    if (c->slept && c->pDraw)
+    if (ClientIsAsleep(client) && c->pDraw)
     {
 	DrawablePtr pDraw;
 	dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
@@ -1212,7 +1207,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 	}
     }
 
-    client_state = c->slept ? SLEEPING : NEVER_SLEPT;
+    client_state = ClientIsAsleep(client) ? SLEEPING : NEVER_SLEPT;
 
     while (c->endReq - c->pElt > TextEltHeader)
     {
@@ -1295,7 +1290,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 
 	    if (lgerr == Suspended)
 	    {
-		if (!c->slept) {
+		if (!ClientIsAsleep(client)) {
 		    int len;
 		    GC *pGC;
 		    PTclosurePtr new_closure;
@@ -1368,15 +1363,14 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 		    c->pGC = pGC;
 		    ValidateGC(c->pDraw, c->pGC);
 		    
-		    c->slept = TRUE;
-		    ClientSleep(client,
-		    	     (ClientSleepProcPtr)doPolyText,
-			     (pointer) c);
+		    ClientSleep(client, (ClientSleepProcPtr)doPolyText, c);
 
 		    /* Set up to perform steps 3 and 4 */
 		    client_state = START_SLEEP;
 		    continue;	/* on to steps 3 and 4 */
 		}
+		else
+		    goto xinerama_sleep;
 		return TRUE;
 	    }
 	    else if (lgerr != Successful)
@@ -1419,9 +1413,10 @@ bail:
 #endif
 	    SendErrorToClient(c->client, c->reqType, 0, 0, err);
     }
-    if (c->slept)
+    if (ClientIsAsleep(client))
     {
 	ClientWakeup(c->client);
+xinerama_sleep:
 	ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
 
 	/* Unreference the font from the scratch GC */
@@ -1460,7 +1455,6 @@ PolyText(ClientPtr client, DrawablePtr pDraw, GC *pGC, unsigned char *pElt,
     local_closure.pGC = pGC;
     local_closure.did = did;
     local_closure.err = Success;
-    local_closure.slept = FALSE;
 
     (void) doPolyText(client, &local_closure);
     return Success;
@@ -1485,7 +1479,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
     }
 
     /* Make sure our drawable hasn't disappeared while we slept. */
-    if (c->slept && c->pDraw)
+    if (ClientIsAsleep(client) && c->pDraw)
     {
 	DrawablePtr pDraw;
 	dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
@@ -1502,7 +1496,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
     lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, c->itemSize, c->data);
     if (lgerr == Suspended)
     {
-        if (!c->slept) {
+        if (!ClientIsAsleep(client)) {
 	    GC *pGC;
 	    unsigned char *data;
 	    ITclosurePtr new_closure;
@@ -1555,9 +1549,10 @@ doImageText(ClientPtr client, ITclosurePtr c)
 	    c->pGC = pGC;
 	    ValidateGC(c->pDraw, c->pGC);
 
-	    c->slept = TRUE;
-            ClientSleep(client, (ClientSleepProcPtr)doImageText, (pointer) c);
+            ClientSleep(client, (ClientSleepProcPtr)doImageText, c);
         }
+	else
+	    goto xinerama_sleep;
         return TRUE;
     }
     else if (lgerr != Successful)
@@ -1576,9 +1571,10 @@ bail:
     if (err != Success && c->client != serverClient) {
 	SendErrorToClient(c->client, c->reqType, 0, 0, err);
     }
-    if (c->slept)
+    if (ClientIsAsleep(client))
     {
 	ClientWakeup(c->client);
+xinerama_sleep:
 	ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
 
 	/* Unreference the font from the scratch GC */
@@ -1616,7 +1612,6 @@ ImageText(ClientPtr client, DrawablePtr pDraw, GC *pGC, int nChars,
 	local_closure.itemSize = 2;
     }
     local_closure.did = did;
-    local_closure.slept = FALSE;
 
     (void) doImageText(client, &local_closure);
     return Success;
diff --git a/include/closestr.h b/include/closestr.h
index 2cd67b1..7ca2613 100644
--- a/include/closestr.h
+++ b/include/closestr.h
@@ -46,7 +46,6 @@ typedef struct _OFclosure {
     short       num_fpes;
     FontPathElementPtr *fpe_list;
     Mask        flags;
-    Bool        slept;
 
 /* XXX -- get these from request buffer instead? */
     char       *origFontName;
@@ -79,7 +78,6 @@ typedef struct _LFWIclosure {
     LFWIstateRec	saved;
     int			savedNumFonts;
     Bool		haveSaved;
-    Bool		slept;
     char		*savedName;
 } LFWIclosureRec;
 
@@ -93,7 +91,6 @@ typedef struct _LFclosure {
     LFWIstateRec current;
     LFWIstateRec saved;
     Bool        haveSaved;
-    Bool        slept;
     char	*savedName;
     int		savedNameLen;
 }	LFclosureRec;
@@ -124,7 +121,6 @@ typedef struct _PTclosure {
     int			itemSize;
     XID			did;
     int			err;
-    Bool		slept;
 } PTclosureRec;
 
 /* ImageText */
@@ -151,6 +147,5 @@ typedef struct _ITclosure {
     ImageTextPtr	imageText;
     int			itemSize;
     XID			did;
-    Bool		slept;
 } ITclosureRec;
 #endif				/* CLOSESTR_H */


More information about the xorg-commit mailing list