xserver: Branch 'server-1_1-branch' - 11 commits

Eric Anholt anholt at kemper.freedesktop.org
Thu Jul 6 20:50:07 EEST 2006


 exa/exa.h                                   |    9 +++++++
 exa/exa_priv.h                              |    8 -------
 exa/exa_render.c                            |    5 +++-
 fb/fbcompose.c                              |   29 ++++++++++++++++---------
 fb/fbmmx.c                                  |    2 -
 hw/xfree86/common/xf86Init.c                |    6 ++++-
 hw/xfree86/os-support/linux/lnx_agp.c       |    6 ++++-
 hw/xfree86/os-support/shared/libc_wrapper.c |    5 +++-
 hw/xfree86/parser/write.c                   |    5 +++-
 hw/xfree86/xaa/xaaPict.c                    |    8 ++++++-
 miext/cw/cw_ops.c                           |    4 +++
 os/utils.c                                  |   18 ++++++++++-----
 render/filter.c                             |   32 +++++++++++++++++++++-------
 render/picture.c                            |   17 +++++++++-----
 render/picturestr.h                         |   10 ++++++++
 15 files changed, 120 insertions(+), 44 deletions(-)

New commits:
diff-tree 5d3e60552d6040495b772fb8b1bad8b2c5c54eba (from e8cb08ce08d1cb0fa019266297466f3bd0eaf206)
Author: Rudo Thomas <rudo at matfyz.cz>
Date:   Sat Jul 1 12:34:36 2006 -0700

    Missing close parenthesis in one of the setuid() fixes.
    (cherry picked from 50a3e1ad18c815a5adafee22beccdf970bae62d6 commit)

diff --git a/hw/xfree86/parser/write.c b/hw/xfree86/parser/write.c
index 82baa5a..de3bb8a 100644
--- a/hw/xfree86/parser/write.c
+++ b/hw/xfree86/parser/write.c
@@ -170,7 +170,7 @@ xf86writeConfigFile (const char *filenam
 					strerror(errno));
 			return 0;
 		case 0: /* child */
-			if (setuid(getuid() == -1) 
+			if (setuid(getuid()) == -1) 
 			    FatalError("xf86writeConfigFile(): "
 				"setuid failed(%s)\n", 
 				strerror(errno));
diff-tree e8cb08ce08d1cb0fa019266297466f3bd0eaf206 (from 1628bdcd644eece020c308d70b85e769caf7747e)
Author: Matthieu Herrb <matthieu at deville.herrb.com>
Date:   Tue Jun 20 21:07:53 2006 +0200

    Check setuid() return value. Bugzilla #7116.

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index e04bec8..e2b5fa7 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1905,7 +1905,11 @@ xf86RunVtInit(void)
           FatalError("xf86RunVtInit: fork failed (%s)\n", strerror(errno));
           break;
       case 0:  /* child */
-          setuid(getuid());
+	  if (setuid(getuid()) == -1) {
+	      xf86Msg(X_ERROR, "xf86RunVtInit: setuid failed (%s)\n",
+			 strerror(errno));
+	      exit(255);
+	  }
           /* set stdin, stdout to the consoleFd */
           for (i = 0; i < 2; i++) {
             if (xf86Info.consoleFd != i) {
diff --git a/hw/xfree86/os-support/shared/libc_wrapper.c b/hw/xfree86/os-support/shared/libc_wrapper.c
index fc4edc3..1663893 100644
--- a/hw/xfree86/os-support/shared/libc_wrapper.c
+++ b/hw/xfree86/os-support/shared/libc_wrapper.c
@@ -1270,7 +1270,10 @@ xf86execl(const char *pathname, const ch
 #ifndef SELF_CONTAINED_WRAPPER
 	xf86DisableIO();
 #endif
-        setuid(getuid());
+        if (setuid(getuid()) == -1) {
+		ErrorF("xf86Execl: setuid() failed: %s\n", strerror(errno));
+		exit(255);
+	}
 #if !defined(SELF_CONTAINED_WRAPPER)
         /* set stdin, stdout to the consoleFD, and leave stderr alone */
         for (i = 0; i < 2; i++)
diff --git a/hw/xfree86/parser/write.c b/hw/xfree86/parser/write.c
index 285080d..82baa5a 100644
--- a/hw/xfree86/parser/write.c
+++ b/hw/xfree86/parser/write.c
@@ -170,7 +170,10 @@ xf86writeConfigFile (const char *filenam
 					strerror(errno));
 			return 0;
 		case 0: /* child */
-			setuid(getuid());
+			if (setuid(getuid() == -1) 
+			    FatalError("xf86writeConfigFile(): "
+				"setuid failed(%s)\n", 
+				strerror(errno));
 			ret = doWriteConfigFile(filename, cptr);
 			exit(ret);
 			break;
diff --git a/os/utils.c b/os/utils.c
index 173013a..92da58e 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1721,8 +1721,10 @@ System(char *command)
     case -1:	/* error */
 	p = -1;
     case 0:	/* child */
-	setgid(getgid());
-	setuid(getuid());
+	if (setgid(getgid()) == -1)
+	    _exit(127);
+	if (setuid(getuid()) == -1)
+	    _exit(127);
 	execl("/bin/sh", "sh", "-c", command, (char *)NULL);
 	_exit(127);
     default:	/* parent */
@@ -1773,8 +1775,10 @@ Popen(char *command, char *type)
 	xfree(cur);
 	return NULL;
     case 0:	/* child */
-	setgid(getgid());
-	setuid(getuid());
+	if (setgid(getgid()) == -1)
+	    _exit(127);
+	if (setuid(getuid()) == -1)
+	    _exit(127);
 	if (*type == 'r') {
 	    if (pdes[1] != 1) {
 		/* stdout */
@@ -1848,8 +1852,10 @@ Fopen(char *file, char *type)
 	xfree(cur);
 	return NULL;
     case 0:	/* child */
-	setgid(getgid());
-	setuid(getuid());
+	if (setgid(getgid()) == -1)
+	    _exit(127);
+	if (setuid(getuid()) == -1)
+	    _exit(127);
 	if (*type == 'r') {
 	    if (pdes[1] != 1) {
 		/* stdout */
diff-tree 1628bdcd644eece020c308d70b85e769caf7747e (from 8348131abb292dea46d1e1ca4545561ec671c936)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Fri Jun 16 10:14:30 2006 -0700

    Bugzilla #5120, #7246: In CW's GC ops, validate the backing GC against the
    backing drawable if the serial numbers differ.  Fixes crash in XAA which
    occurred when the DDX bumped the serial number on the backing drawable and
    expected it to get re-validated, and we didn't because the wrapped drawable
    hadn't been bumped.
    (cherry picked from 53f74b6aa95fe57fda45fd8a051595e772f00402 commit)

diff --git a/miext/cw/cw_ops.c b/miext/cw/cw_ops.c
index 6ba804b..80b7280 100644
--- a/miext/cw/cw_ops.c
+++ b/miext/cw/cw_ops.c
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 
 #include "gcstruct.h"
+#include "pixmapstr.h"
 #include "cw.h"
 
 #define SETUP_BACKING_DST(_pDst, _pGC) \
@@ -43,6 +44,9 @@
 	&src_off_y)
 
 #define PROLOGUE(pGC) do { \
+    if (pBackingGC->serialNumber != pBackingDst->serialNumber) { \
+	ValidateGC(pBackingDst, pBackingGC); \
+    } \
     pGC->funcs = pGCPrivate->wrapFuncs;\
     pGC->ops = pGCPrivate->wrapOps;\
 } while (0)
diff-tree 8348131abb292dea46d1e1ca4545561ec671c936 (from b4a0cabc98b3b7aca05effd5d7c9b4b23096640d)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jun 19 16:42:09 2006 -0700

    Fix crash when using PICT_x4a4 by supplying an appropriate fbFetchPixel_x4a4.
    (cherry picked from 569c808a2375be71f835ee8693605487484bd22e commit)

diff --git a/fb/fbcompose.c b/fb/fbcompose.c
index 490a196..23664d9 100644
--- a/fb/fbcompose.c
+++ b/fb/fbcompose.c
@@ -849,6 +849,14 @@ fbFetchPixel_c8 (const FbBits *bits, int
     return indexed->rgba[pixel];
 }
 
+static FASTCALL CARD32
+fbFetchPixel_x4a4 (const FbBits *bits, int offset, miIndexedPtr indexed)
+{
+    CARD32   pixel = ((CARD8 *) bits)[offset];
+
+    return ((pixel & 0xf) | ((pixel & 0xf) << 4)) << 24;
+}
+
 #define Fetch8(l,o)    (((CARD8 *) (l))[(o) >> 2])
 #if IMAGE_BYTE_ORDER == MSBFirst
 #define Fetch4(l,o)    ((o) & 2 ? Fetch8(l,o) & 0xf : Fetch8(l,o) >> 4)
@@ -988,6 +996,7 @@ static fetchPixelProc fetchPixelProcForP
     case PICT_a2b2g2r2: return fbFetchPixel_a2b2g2r2;
     case PICT_c8: return  fbFetchPixel_c8;
     case PICT_g8: return  fbFetchPixel_c8;
+    case PICT_x4a4: return fbFetchPixel_x4a4;
 
         /* 4bpp formats */
     case PICT_a4: return  fbFetchPixel_a4;
diff-tree b4a0cabc98b3b7aca05effd5d7c9b4b23096640d (from fe99f25e979ef3c0e7cd8ba68ae46a7c18cb9fd3)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jun 19 14:06:02 2006 -0700

    Correct component ordering when fetching [ax]4b4g4r4 pixels.
    
    Noticed by:	rendercheck
    (cherry picked from e793f0eeee3e9c83b6a7b50d451fb6db12839087 commit)

diff --git a/fb/fbcompose.c b/fb/fbcompose.c
index a9ae6da..490a196 100644
--- a/fb/fbcompose.c
+++ b/fb/fbcompose.c
@@ -267,11 +267,11 @@ fbFetch_a4b4g4r4 (const FbBits *bits, in
         CARD32  r,g,b, a;
 
         a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16;
-        b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12;
+        b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4;
         g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
-        r = ((p & 0x000f) | ((p & 0x000f) << 4));
+        r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16;
         *buffer++ = (a | r | g | b);
-	}
+    }
 }
 
 static FASTCALL void
@@ -283,11 +283,11 @@ fbFetch_x4b4g4r4 (const FbBits *bits, in
         CARD32  p = *pixel++;
         CARD32  r,g,b;
 
-        b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12;
+        b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4;
         g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
-        r = ((p & 0x000f) | ((p & 0x000f) << 4));
+        r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16;
         *buffer++ = (0xff000000 | r | g | b);
-	}
+    }
 }
 
 static FASTCALL void
@@ -758,9 +758,9 @@ fbFetchPixel_a4b4g4r4 (const FbBits *bit
     CARD32  a,r,g,b;
 
     a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16;
-    b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12;
+    b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4;
     g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
-    r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4));
+    r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16;
     return (a | r | g | b);
 }
 
@@ -770,9 +770,9 @@ fbFetchPixel_x4b4g4r4 (const FbBits *bit
     CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  r,g,b;
 
-    b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12;
+    b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4;
     g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
-    r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4));
+    r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16;
     return (0xff000000 | r | g | b);
 }
 
diff-tree fe99f25e979ef3c0e7cd8ba68ae46a7c18cb9fd3 (from 87b9fa20f1658e498e5cf5b598c8fd89c453be5b)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jun 26 15:57:32 2006 +0200

    Move EXA_PM_IS_SOLID() to the public API, since drivers will want it frequently.
    (cherry picked from 48c871564d493203d434d5da015903399287f619 commit)

diff --git a/exa/exa.h b/exa/exa.h
index 2cb2008..96465a7 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -36,6 +36,7 @@
 #include "windowstr.h"
 #include "gcstruct.h"
 #include "picturestr.h"
+#include "fb.h"
 
 #define EXA_VERSION_MAJOR   2
 #define EXA_VERSION_MINOR   0
@@ -715,4 +716,12 @@ exaGetPixmapSize(PixmapPtr pPix);
 void
 exaEnableDisableFBAccess (int index, Bool enable);
 
+/**
+ * Returns TRUE if the given planemask covers all the significant bits in the
+ * pixel values for pDrawable.
+ */
+#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
+	(((_pm) & FbFullMask((_pDrawable)->depth)) == \
+	 FbFullMask((_pDrawable)->depth))
+
 #endif /* EXA_H */
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 18550ee..e98e546 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -132,14 +132,6 @@ extern int exaPixmapPrivateIndex;
 /** Align an offset to a power-of-two alignment */
 #define EXA_ALIGN2(offset, align) (((offset) + (align) - 1) & ~((align) - 1))
 
-/**
- * Returns TRUE if the given planemask covers all the significant bits in the
- * pixel values for pDrawable.
- */
-#define EXA_PM_IS_SOLID(_pDrawable, _pm) \
-	(((_pm) & FbFullMask((_pDrawable)->depth)) == \
-	 FbFullMask((_pDrawable)->depth))
-
 #define EXA_PIXMAP_SCORE_MOVE_IN    10
 #define EXA_PIXMAP_SCORE_MAX	    20
 #define EXA_PIXMAP_SCORE_MOVE_OUT   -10
diff-tree 87b9fa20f1658e498e5cf5b598c8fd89c453be5b (from f8330f8d0fe1cdd4bca117537c7d1e918436ee3b)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Mon Jul 3 12:48:12 2006 -0700

    Correct AGP memory deallocation argument on *BSD.
    
    This fixes leaks and eventual crashes with RandR resizing on Intel.
    (cherry picked from 002e28c12c74aa63777f65cbfb382c2bfd0d6850 commit)

diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c
index 65a5a0e..77773f7 100644
--- a/hw/xfree86/os-support/linux/lnx_agp.c
+++ b/hw/xfree86/os-support/linux/lnx_agp.c
@@ -1,7 +1,7 @@
 /*
  * Abstraction of the AGP GART interface.
  *
- * This version is for both Linux and FreeBSD.
+ * This version is for Linux and Free/Open/NetBSD.
  *
  * Copyright © 2000 VA Linux Systems, Inc.
  * Copyright © 2001 The XFree86 Project, Inc.
@@ -264,7 +264,11 @@ xf86DeallocateGARTMemory(int screenNum, 
 		return FALSE;
 	}
 
+#ifdef __linux__
 	if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)key) != 0) {
+#else
+	if (ioctl(gartFd, AGPIOC_DEALLOCATE, &key) != 0) {
+#endif
 		xf86DrvMsg(screenNum, X_WARNING,"xf86DeAllocateGARTMemory: "
                    "deallocation gart memory with key %d failed\n\t(%s)\n",
                    key, strerror(errno));
diff-tree f8330f8d0fe1cdd4bca117537c7d1e918436ee3b (from 3413f75e5265e8957813df10af5af5aece9cfec4)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Sun Jul 2 12:41:35 2006 +0200

    Fix bugs in support for new repeatTypes in XAA and EXA.
    
    EXA now won't pass pictures with new repeatTypes to drivers.  We can add a flag
    for them to support it at a later time.
    (cherry picked from 7106a77df37c06d2b5568eceeb9297096bff3137 commit)

diff --git a/exa/exa_render.c b/exa/exa_render.c
index 9f78c34..0147c8f 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -490,7 +490,8 @@ exaComposite(CARD8	op,
 	if (op == PictOpSrc)
 	{
 	    if (pSrc->pDrawable->width == 1 &&
-		pSrc->pDrawable->height == 1 && pSrc->repeat)
+		pSrc->pDrawable->height == 1 && pSrc->repeat &&
+		pSrc->repeatType == RepeatNormal)
 	    {
 		ret = exaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst,
 					    width, height);
@@ -531,6 +532,8 @@ exaComposite(CARD8	op,
 
 
     if (pExaScr->info->PrepareComposite &&
+	(!pSrc->repeat || pSrc->repeat == RepeatNormal) &&
+	(!pMask || !pMask->repeat || pMask->repeat == RepeatNormal) &&
 	!pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
     {
 	ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask,
diff --git a/hw/xfree86/xaa/xaaPict.c b/hw/xfree86/xaa/xaaPict.c
index 847ccb2..0391ed4 100644
--- a/hw/xfree86/xaa/xaaPict.c
+++ b/hw/xfree86/xaa/xaaPict.c
@@ -218,7 +218,13 @@ XAADoComposite (
 
     if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
 	return FALSE;
-	
+
+    if ((pSrc->repeat && pSrc->repeatType != RepeatNormal) ||
+	(pMask && pMask->repeat && pMask->repeatType != RepeatNormal))
+    {
+	return FALSE;
+    }
+
     xDst += pDst->pDrawable->x;
     yDst += pDst->pDrawable->y;
     xSrc += pSrc->pDrawable->x;
diff-tree 3413f75e5265e8957813df10af5af5aece9cfec4 (from c5bdc9aea043bd9b45afa449ef922b7702d4a04b)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Fri Jun 30 12:03:47 2006 +0200

    Bug #7366: Fix crashes when setting filters on source pictures.
    
    Now, filters may only be set on source pictures when the filter is common to
    all screens.  Also, like SetPictureTransform, ChangePictureFilter is now not
    called on source pictures.
    (cherry picked from f5e92542a14f51029347b6476e4e4af69144930b commit)
    (cherry picked from 25d871d98462f0481ee419295ddc94b8c79dc881 commit)

diff --git a/render/filter.c b/render/filter.c
index f81cc4a..71375da 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -271,11 +271,24 @@ PictureResetFilters (ScreenPtr pScreen)
 int
 SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams)
 {
-    ScreenPtr		pScreen = pPicture->pDrawable->pScreen;
-    PictureScreenPtr	ps = GetPictureScreen(pScreen);
-    PictFilterPtr	pFilter = PictureFindFilter (pScreen, name, len);
+    PictFilterPtr	pFilter;
     xFixed		*new_params;
-    int			i, result;
+    int			i, s, result;
+
+    pFilter = PictureFindFilter (screenInfo.screens[0], name, len);
+
+    if (pPicture->pDrawable == NULL) {
+	/* For source pictures, the picture isn't tied to a screen.  So, ensure
+	 * that all screens can handle a filter we set for the picture.
+	 */
+	for (s = 0; s < screenInfo.numScreens; s++) {
+	    if (PictureFindFilter (screenInfo.screens[s], name, len)->id !=
+		pFilter->id)
+	    {
+		return BadMatch;
+	    }
+	}
+    }
 
     if (!pFilter)
 	return BadName;
@@ -300,8 +313,13 @@ SetPictureFilter (PicturePtr pPicture, c
 	pPicture->filter_params[i] = params[i];
     pPicture->filter = pFilter->id;
 
-    result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
-					 params, nparams);
-    return result;
+    if (pPicture->pDrawable) {
+	ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+	PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+	result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
+					     params, nparams);
+	return result;
+    }
     return Success;
 }
diff --git a/render/picturestr.h b/render/picturestr.h
index 81dab5b..beda955 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -355,7 +355,12 @@ typedef struct _PictureScreen {
      */
     ChangePictureTransformProcPtr   ChangePictureTransform;
 
+    /**
+     * Called immediately after a picture's transform is changed through the
+     * SetPictureFilter request.  Not called for source-only pictures.
+     */
     ChangePictureFilterProcPtr	ChangePictureFilter;
+
     DestroyPictureFilterProcPtr	DestroyPictureFilter;
 
     TrapezoidsProcPtr		Trapezoids;
diff-tree c5bdc9aea043bd9b45afa449ef922b7702d4a04b (from fa5ea59d2d4c8d6b20e827ae0c5de966a941bbd1)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Fri Jun 30 03:01:14 2006 +0200

    Bug #7366: Fix two crashes in operations on source pictures.
    
    A screen's ChangePictureTransform now isn't called when changing the transform,
    as source pictures aren't associated with screens.  Also, attempting to set
    an AlphaMap to a source picture will fail with BadMatch just like a Window
    would, preventing another crash.
    (cherry picked from 6ef457913955d4289081c7d07d528963ccf5272c commit)

diff --git a/render/picture.c b/render/picture.c
index ee385e5..55763fc 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1217,7 +1217,8 @@ ChangePicture (PicturePtr	pPicture,
 			    error = BadPixmap;
 			    break;
 			}
-			if (pAlpha->pDrawable->type != DRAWABLE_PIXMAP)
+			if (pAlpha->pDrawable == NULL ||
+			    pAlpha->pDrawable->type != DRAWABLE_PIXMAP)
 			{
 			    client->errorValue = pid;
 			    error = BadMatch;
@@ -1469,9 +1470,6 @@ SetPictureTransform (PicturePtr	    pPic
 	{ 0x00000, xFixed1, 0x00000 },
 	{ 0x00000, 0x00000, xFixed1 },
     } };
-    ScreenPtr		pScreen = pPicture->pDrawable->pScreen;
-    PictureScreenPtr	ps = GetPictureScreen(pScreen);
-    int			result;
 
     if (transform && memcmp (transform, &identity, sizeof (PictTransform)) == 0)
 	transform = 0;
@@ -1496,9 +1494,16 @@ SetPictureTransform (PicturePtr	    pPic
     }
     pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
 
-    result = (*ps->ChangePictureTransform) (pPicture, transform);
+    if (pPicture->pDrawable != NULL) {
+	int result;
+	PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen);
 
-    return result;
+	result = (*ps->ChangePictureTransform) (pPicture, transform);
+
+	return result;
+    }
+
+    return Success;
 }
 
 void
diff --git a/render/picturestr.h b/render/picturestr.h
index e81d769..81dab5b 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -349,7 +349,12 @@ typedef struct _PictureScreen {
     PictFilterAliasPtr		filterAliases;
     int				nfilterAliases;
 
+    /**
+     * Called immediately after a picture's transform is changed through the
+     * SetPictureTransform request.  Not called for source-only pictures.
+     */
     ChangePictureTransformProcPtr   ChangePictureTransform;
+
     ChangePictureFilterProcPtr	ChangePictureFilter;
     DestroyPictureFilterProcPtr	DestroyPictureFilter;
 
diff-tree fa5ea59d2d4c8d6b20e827ae0c5de966a941bbd1 (from 5c2560d47ff79afb96b1304d3995706403bfea35)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Tue Jun 27 04:11:47 2006 +0200

    Fix MMX Saturate implementation.
    
    The code was expanding the source blend factor from the wrong channel.  Fixes
    cairo's clip-operator test.
    (cherry picked from 63c169e3b1f7d6a7375a414fcd50cce32358a525 commit)

diff --git a/fb/fbmmx.c b/fb/fbmmx.c
index d058ffa..f74930a 100644
--- a/fb/fbmmx.c
+++ b/fb/fbmmx.c
@@ -591,7 +591,7 @@ mmxCombineSaturateU (CARD32 *dest, const
 
         if (sa > da) {
             __m64 msa = load8888(FbIntDiv(da, sa));
-            msa = expand_alpha(msa);
+            msa = expand_alpha_rev(msa);
             ms = pix_multiply(ms, msa);
         }
         md = pix_add(md, ms);



More information about the xorg-commit mailing list