xserver: Branch 'master' - 7 commits

Keith Packard keithp at kemper.freedesktop.org
Wed Apr 27 11:58:30 PDT 2011


 configure.ac        |    2 -
 exa/exa_unaccel.c   |    7 ++---
 fb/fbtrap.c         |   63 ++++++++++++++++++++++++++++------------------------
 glx/glxdri.c        |   17 ++++++++++----
 include/regionstr.h |    5 ++++
 render/picture.c    |   58 -----------------------------------------------
 render/picturestr.h |   48 ---------------------------------------
 7 files changed, 56 insertions(+), 144 deletions(-)

New commits:
commit c6cb70be1ed7cf73bd3411b8d66ec05a9efcfeb9
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Mon Mar 28 13:30:52 2011 -0400

    Fix trapezoid and triangle rendering to windows
    
    For fbAdd{Traps,Triangles}() and fbRasterizeTrapezoid() this is just a
    matter of adding the image offsets to the trap offsets.
    
    For fbShapes, the story is more complicated:
    
    The recently added pixman API did not allow offsetting
    trapezoids. Instead, it would use x_dst and y_dst in such a way that
    the effect was to only offset the source image.
    
    In pixman 0.21.8, this API has changed such that all the traps are
    conceptually rendered to an infinitely big image, and the source and
    destination coordinates are then aligned with (0, 0) of that
    image. This means offsetting dst_x and dst_y will now offset the
    entire drawing, which is similar to how other composite functions
    work.
    
    This patch then changes fbComposite{Triangles,Traps} such that the
    source image is aligned with the shapes, and the destination
    coordinates offset according to drawable->{x, y}.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Soren Sandmann <ssp at redhat.com>

diff --git a/configure.ac b/configure.ac
index 56e51a4..e2b3fa6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -797,7 +797,7 @@ LIBPCIACCESS="pciaccess >= 0.8.0"
 LIBUDEV="libudev >= 143"
 LIBSELINUX="libselinux >= 2.0.86"
 LIBDBUS="dbus-1 >= 1.0"
-LIBPIXMAN="pixman-1 >= 0.21.6"
+LIBPIXMAN="pixman-1 >= 0.21.8"
 
 dnl Pixman is always required, but we separate it out so we can link
 dnl specific modules against it
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index b5c5a61..0b5a638 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -38,13 +38,14 @@ fbAddTraps (PicturePtr	pPicture,
 	    int		ntrap,
 	    xTrap	*traps)
 {
-    int image_xoff, image_yoff;
-    pixman_image_t *image = image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
+    pixman_image_t *image;
+    int dst_xoff, dst_yoff;
 
-    if (!image)
+    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
 	return;
     
-    pixman_add_traps (image, x_off, y_off, ntrap, (pixman_trap_t *)traps);
+    pixman_add_traps (image, x_off + dst_xoff, y_off + dst_yoff,
+		      ntrap, (pixman_trap_t *)traps);
 
     free_pixman_pict (pPicture, image);
 }
@@ -55,13 +56,15 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
 		      int	    x_off,
 		      int	    y_off)
 {
-    int	mask_xoff, mask_yoff;
-    pixman_image_t *image = image_from_pict (pPicture, FALSE, &mask_xoff, &mask_yoff);
+    pixman_image_t *image;
+    int	dst_xoff, dst_yoff;
 
-    if (!image)
+    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
 	return;
 
-    pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap, x_off, y_off);
+    pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap,
+				x_off + dst_xoff,
+				y_off + dst_yoff);
 
     free_pixman_pict (pPicture, image);
 }
@@ -73,14 +76,15 @@ fbAddTriangles (PicturePtr  pPicture,
 		int	    ntri,
 		xTriangle *tris)
 {
-    int image_xoff, image_yoff;
-    pixman_image_t *image =
-	image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
+    pixman_image_t *image;
+    int dst_xoff, dst_yoff;
 
-    if (!image)
+    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
 	return;
     
-    pixman_add_triangles (image, x_off, y_off, ntri, (pixman_triangle_t *)tris);
+    pixman_add_triangles (image,
+			  dst_xoff + x_off, dst_yoff + y_off,
+			  ntri, (pixman_triangle_t *)tris);
 
     free_pixman_pict (pPicture, image);
 }
@@ -101,8 +105,6 @@ fbShapes (CompositeShapesFunc	composite,
 	  PictFormatPtr		maskFormat,
 	  int16_t		xSrc,
 	  int16_t		ySrc,
-	  int16_t		xDst,
-	  int16_t		yDst,
 	  int			nshapes,
 	  int			shape_size,
 	  const uint8_t *	shapes)
@@ -136,8 +138,8 @@ fbShapes (CompositeShapesFunc	composite,
 		composite (op, src, dst, format,
 			   xSrc + src_xoff,
 			   ySrc + src_yoff,
-			   xDst + dst_xoff,
-			   yDst + dst_yoff,
+			   dst_xoff,
+			   dst_yoff,
 			   1, shapes + i * shape_size);
 	    }
 	}
@@ -162,8 +164,8 @@ fbShapes (CompositeShapesFunc	composite,
 	    composite (op, src, dst, format,
 		       xSrc + src_xoff,
 		       ySrc + src_yoff,
-		       xDst + dst_xoff,
-		       yDst + dst_yoff,
+		       dst_xoff,
+		       dst_yoff,
 		       nshapes, shapes);
 	}
 
@@ -184,14 +186,12 @@ fbTrapezoids (CARD8	    op,
 	      int	    ntrap,
 	      xTrapezoid    *traps)
 {
-    int xDst, yDst;
-
-    xDst = traps[0].left.p1.x >> 16;
-    yDst = traps[0].left.p1.y >> 16;
+    xSrc -= (traps[0].left.p1.x >> 16);
+    ySrc -= (traps[0].left.p1.y >> 16);
     
     fbShapes ((CompositeShapesFunc)pixman_composite_trapezoids,
 	      op, pSrc, pDst, maskFormat,
-	      xSrc, ySrc, xDst, yDst,
+	      xSrc, ySrc,
 	      ntrap, sizeof (xTrapezoid), (const uint8_t *)traps);
 }
 
@@ -205,13 +205,11 @@ fbTriangles (CARD8	    op,
 	     int	    ntris,
 	     xTriangle    *tris)
 { 
-    int xDst, yDst;
-
-    xDst = tris[0].p1.x >> 16;
-    yDst = tris[0].p1.y >> 16;
+    xSrc -= (tris[0].p1.x >> 16);
+    ySrc -= (tris[0].p1.y >> 16);
     
     fbShapes ((CompositeShapesFunc)pixman_composite_triangles,
 	      op, pSrc, pDst, maskFormat,
-	      xSrc, ySrc, xDst, yDst,
+	      xSrc, ySrc,
 	      ntris, sizeof (xTriangle), (const uint8_t *)tris);
 }
commit 1b96a99d8edd9016bc4a35348f9d5ddb45832f14
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Thu Mar 10 08:52:41 2011 -0500

    fb: Call miCompositeSourceValidate() on the source in fbShapes()
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Soren Sandmann <ssp at redhat.com>

diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 612fae7..b5c5a61 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -111,6 +111,8 @@ fbShapes (CompositeShapesFunc	composite,
     int src_xoff, src_yoff;
     int dst_xoff, dst_yoff;
 
+    miCompositeSourceValidate (pSrc);
+
     src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
     dst = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
 
commit 04635069554859ec67003b89f56965421cba7f52
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Tue Mar 29 00:11:00 2011 -0400

    render: Remove unused TriStrip and TriFan typedefs
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Soren Sandmann <ssp at redhat.com>

diff --git a/render/picturestr.h b/render/picturestr.h
index c536c38..7b7f911 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -260,24 +260,6 @@ typedef void	(*TrianglesProcPtr)	    (CARD8	    op,
 					     int	    ntri,
 					     xTriangle	    *tris);
 
-typedef void	(*TriStripProcPtr)	    (CARD8	    op,
-					     PicturePtr	    pSrc,
-					     PicturePtr	    pDst,
-					     PictFormatPtr  maskFormat,
-					     INT16	    xSrc,
-					     INT16	    ySrc,
-					     int	    npoint,
-					     xPointFixed    *points);
-
-typedef void	(*TriFanProcPtr)	    (CARD8	    op,
-					     PicturePtr	    pSrc,
-					     PicturePtr	    pDst,
-					     PictFormatPtr  maskFormat,
-					     INT16	    xSrc,
-					     INT16	    ySrc,
-					     int	    npoint,
-					     xPointFixed    *points);
-
 typedef Bool	(*InitIndexedProcPtr)	    (ScreenPtr	    pScreen,
 					     PictFormatPtr  pFormat);
 
commit 2b0cabec620f3a2a5e431052441b092ef979bf94
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Tue Mar 29 00:07:44 2011 -0400

    render: Remove unused fields in the source picture structs
    
    The fields class, stopRange, colorTable and colorTableSize are not
    used by any current code.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Soren Sandmann <ssp at redhat.com>

diff --git a/render/picture.c b/render/picture.c
index 058db2b..49e83ed 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -843,11 +843,6 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
         pGradient->gradient.stops[i].x = stopPoints[i];
         pGradient->gradient.stops[i].color = stopColors[i];
     }
-
-    pGradient->gradient.class	       = SourcePictClassUnknown;
-    pGradient->gradient.stopRange      = 0xffff;
-    pGradient->gradient.colorTable     = NULL;
-    pGradient->gradient.colorTableSize = 0;
 }
 
 static PicturePtr createSourcePicture(void)
@@ -922,8 +917,6 @@ CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2,
     return pPicture;
 }
 
-#define FixedToDouble(x) ((x)/65536.)
-
 PicturePtr
 CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer,
                              xFixed innerRadius, xFixed outerRadius,
@@ -959,12 +952,6 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
     radial->c2.x = outer->x;
     radial->c2.y = outer->y;
     radial->c2.radius = outerRadius;
-    radial->cdx = (radial->c2.x - radial->c1.x) / 65536.;
-    radial->cdy = (radial->c2.y - radial->c1.y) / 65536.;
-    radial->dr = (radial->c2.radius - radial->c1.radius) / 65536.;
-    radial->A = (  radial->cdx * radial->cdx
-		   + radial->cdy * radial->cdy
-		   - radial->dr  * radial->dr);
     
     initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
     if (*error) {
diff --git a/render/picturestr.h b/render/picturestr.h
index 8b387f7..c536c38 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -65,13 +65,8 @@ typedef struct pixman_transform PictTransform, *PictTransformPtr;
 #define SourcePictTypeRadial 2
 #define SourcePictTypeConical 3
 
-#define SourcePictClassUnknown    0
-#define SourcePictClassHorizontal 1
-#define SourcePictClassVertical   2
-
 typedef struct _PictSolidFill {
     unsigned int type;
-    unsigned int class;
     CARD32 color;
 } PictSolidFill, *PictSolidFillPtr;
 
@@ -82,22 +77,14 @@ typedef struct _PictGradientStop {
 
 typedef struct _PictGradient {
     unsigned int type;
-    unsigned int class;
     int nstops;
     PictGradientStopPtr stops;
-    int stopRange;
-    CARD32 *colorTable;
-    int colorTableSize;
 } PictGradient, *PictGradientPtr;
 
 typedef struct _PictLinearGradient {
     unsigned int type;
-    unsigned int class;
     int nstops;
     PictGradientStopPtr stops;
-    int stopRange;
-    CARD32 *colorTable;
-    int colorTableSize;
     xPointFixed p1;
     xPointFixed p2;
 } PictLinearGradient, *PictLinearGradientPtr;
@@ -110,28 +97,16 @@ typedef struct _PictCircle {
 
 typedef struct _PictRadialGradient {
     unsigned int type;
-    unsigned int class;
     int nstops;
     PictGradientStopPtr stops;
-    int stopRange;
-    CARD32 *colorTable;
-    int colorTableSize;
     PictCircle c1;
     PictCircle c2;
-    double cdx;
-    double cdy;
-    double dr;
-    double A;
 } PictRadialGradient, *PictRadialGradientPtr;
 
 typedef struct _PictConicalGradient {
     unsigned int type;
-    unsigned int class;
     int nstops;
     PictGradientStopPtr stops;
-    int stopRange;
-    CARD32 *colorTable;
-    int colorTableSize;
     xPointFixed center;
     xFixed angle;
 } PictConicalGradient, *PictConicalGradientPtr;
commit b0d84f94393edab395d65d2b2cb983fc9fec3d36
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Mon Mar 28 20:59:34 2011 -0400

    render: Delete PictureGradientColor()
    
    PictureGradientColor(), INTERPOLATE_PIXEL_256() and premultiply() are
    not used by anything.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Soren Sandmann <ssp at redhat.com>

diff --git a/render/picture.c b/render/picture.c
index e7e1f2b..058db2b 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -811,51 +811,6 @@ static CARD32 xRenderColorToCard32(xRenderColor c)
         (c.blue >> 8);
 }
 
-static unsigned int premultiply(unsigned int x)
-{
-    unsigned int a = x >> 24;
-    unsigned int t = (x & 0xff00ff) * a + 0x800080;
-    t = (t + ((t >> 8) & 0xff00ff)) >> 8;
-    t &= 0xff00ff;
-
-    x = ((x >> 8) & 0xff) * a + 0x80;
-    x = (x + ((x >> 8) & 0xff));
-    x &= 0xff00;
-    x |= t | (a << 24);
-    return x;
-}
-
-static unsigned int INTERPOLATE_PIXEL_256(unsigned int x, unsigned int a,
-                                          unsigned int y, unsigned int b)
-{
-    CARD32 t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
-    t >>= 8;
-    t &= 0xff00ff;
-
-    x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b;
-    x &= 0xff00ff00;
-    x |= t;
-    return x;
-}
-
-CARD32
-PictureGradientColor (PictGradientStopPtr stop1,
-		      PictGradientStopPtr stop2,
-		      CARD32	          x)
-{
-     CARD32 current_color, next_color;
-     int	   dist, idist;
-
-     current_color = xRenderColorToCard32 (stop1->color);
-     next_color    = xRenderColorToCard32 (stop2->color);
-
-     dist  = (int) (256 * (x - stop1->x) / (stop2->x - stop1->x));
-     idist = 256 - dist;
-
-     return premultiply (INTERPOLATE_PIXEL_256 (current_color, idist,
-					       next_color, dist));
-}
-
 static void initGradient(SourcePictPtr pGradient, int stopCount,
                          xFixed *stopPoints, xRenderColor *stopColors, int *error)
 {
diff --git a/render/picturestr.h b/render/picturestr.h
index 7c7edb1..8b387f7 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -614,11 +614,6 @@ CompositeTriFan (CARD8		op,
 		 int		npoints,
 		 xPointFixed	*points);
 
-extern _X_EXPORT CARD32
-PictureGradientColor (PictGradientStopPtr stop1,
-		      PictGradientStopPtr stop2,
-		      CARD32	          x);
-
 extern _X_EXPORT void RenderExtensionInit (void);
 
 Bool
commit 61a92a78cd49969f74a046fa26c3199e06365814
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Tue Mar 29 13:06:36 2011 -0400

    Add RegionInitBoxes(), and fix some buggy callers of RegionInit().
    
    The interface to RegionInit():
    
        RegionInit (RegionPtr pReg, BoxPtr rect, int size);
    
    is very confusing because it doesn't take a list of boxes, it takes
    *one* box, but if that box is NULL, it initializes an empty region
    with 'size' rectangles preallocated.
    
    Most callers of this function were correctly passing either NULL or
    just one box, but there were three confused cases, where the code
    seems to expect a region to be created from a list of boxes.
    
    This patch adds a new function RegionInitBoxes() and fixes those
    instances to call that instead.
    
    And yes, the pixman function to initialize a region from a list of
    boxes is called init_rects() because pixman is also awesome.
    
    V2: Make RegionInitBoxes() return a Bool indicating whether the call
        succeeded, and fix the callers to check this return value.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Søren Sandmann <ssp at redhat.com>

diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index bd533c4..078b91c 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -127,11 +127,10 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst,  GCPtr pGC,
     EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrc, pDst,
 		  exaDrawableLocation(pSrc), exaDrawableLocation(pDst)));
 
-    if (pExaScr->prepare_access_reg) {
+    if (pExaScr->prepare_access_reg && RegionInitBoxes(&reg, pbox, nbox)) {
 	PixmapPtr pPixmap = exaGetDrawablePixmap(pSrc);
 
 	exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff);
-	RegionInit(&reg, pbox, nbox);
 	RegionTranslate(&reg, xoff + dx, yoff + dy);
 	pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, &reg);
 	RegionUninit(&reg);
@@ -140,11 +139,11 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst,  GCPtr pGC,
 
     if (pExaScr->prepare_access_reg &&
 	!exaGCReadsDestination(pDst, pGC->planemask, pGC->fillStyle,
-			       pGC->alu, pGC->clientClipType)) {
+			       pGC->alu, pGC->clientClipType) &&
+	RegionInitBoxes (&reg, pbox, nbox)) {
 	PixmapPtr pPixmap = exaGetDrawablePixmap(pDst);
 
 	exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff);
-	RegionInit(&reg, pbox, nbox);
 	RegionTranslate(&reg, xoff, yoff);
 	pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST, &reg);
 	RegionUninit(&reg);
diff --git a/glx/glxdri.c b/glx/glxdri.c
index c87ac9a..244eac6 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -817,10 +817,19 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
 
     __glXenterServer(GL_FALSE);
 
-    RegionInit(&region, (BoxPtr) rects, num_rects);
-    RegionTranslate(&region, pDraw->x, pDraw->y);
-    DamageDamageRegion(pDraw, &region);
-    RegionUninit(&region);
+    if (RegionInitBoxes(&region, (BoxPtr) rects, num_rects)) {
+	RegionTranslate(&region, pDraw->x, pDraw->y);
+	DamageDamageRegion(pDraw, &region);
+	RegionUninit(&region);
+    }
+    else {
+	while (num_rects--) {
+	    RegionInit (&region, (BoxPtr) rects++, 1);
+	    RegionTranslate(&region, pDraw->x, pDraw->y);
+	    DamageDamageRegion(pDraw, &region);
+	    RegionUninit(&region);
+	}
+    }
 
     __glXleaveServer(GL_FALSE);
 }
diff --git a/include/regionstr.h b/include/regionstr.h
index 3759fe1..3dfef5c 100644
--- a/include/regionstr.h
+++ b/include/regionstr.h
@@ -132,6 +132,11 @@ static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
     }
 }
 
+static inline Bool RegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes)
+{
+    return pixman_region_init_rects (pReg, boxes, nBoxes);
+}
+
 static inline void RegionUninit(RegionPtr _pReg)
 {
     if ((_pReg)->data && (_pReg)->data->size) {
commit c7bce22b58530239e583d91ae56312bad1630da4
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Mon Mar 28 11:38:11 2011 -0400

    Track damage for fbTrapezoids() and fbTriangles().
    
    These calls no longer go through the CompositePicture() hook, so
    damage was no longer generated for them. This patch simply damages the
    entire destination clip region.
    
    It would be possible to generate tighter damage for certain operators
    such as Over and Add, where blank source pixels have no effect on the
    destination, but given that virtually all trapezoid rendering takes
    place on pixmaps, it's unlikely that anybody would actually benefit
    from this optimization, and the miTrapezoidBounds function did
    sometimes show up on profiles, probably because it does several
    divisions per trapezoid.
    
    V2: Call DamageRegionProcessPending() - pointed out by Michel Dänzer.
    V3: Call DamageRegionProcessPending() *after* rendering -
            pointed out by Maarten Maathuis
    
    Reviewed-by: Michel Dänzer <daenzer at vmware.com>
    Signed-off-by: Søren Sandmann <ssp at redhat.com>

diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 2554fcc..612fae7 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -29,6 +29,7 @@
 #include "picturestr.h"
 #include "mipict.h"
 #include "fbpict.h"
+#include "damage.h"
 
 void
 fbAddTraps (PicturePtr	pPicture,
@@ -117,6 +118,8 @@ fbShapes (CompositeShapesFunc	composite,
     {
 	pixman_format_code_t format;
 
+	DamageRegionAppend (pDst->pDrawable, pDst->pCompositeClip);
+
 	if (!maskFormat)
 	{
 	    int i;
@@ -161,6 +164,8 @@ fbShapes (CompositeShapesFunc	composite,
 		       yDst + dst_yoff,
 		       nshapes, shapes);
 	}
+
+	DamageRegionProcessPending (pDst->pDrawable);
     }
 
     free_pixman_pict (pSrc, src);


More information about the xorg-commit mailing list