xf86-video-intel: 5 commits - src/i830_uxa.c uxa/uxa-accel.c uxa/uxa-render.c

Chris Wilson ickle at kemper.freedesktop.org
Wed May 26 02:21:45 PDT 2010


 src/i830_uxa.c   |    3 +
 uxa/uxa-accel.c  |  128 +++++++++++++++++++++++++++++++++++++++++++++----------
 uxa/uxa-render.c |    9 +++
 3 files changed, 117 insertions(+), 23 deletions(-)

New commits:
commit 03bbb4c896ef3cd275312b413a2c85d9f499c032
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed May 26 10:16:36 2010 +0100

    uxa: Perform manual damage for CompositeRects
    
    [xserver-1.8] The damage layer doesn't wrap CompositeRects, so we need to
    manually append the damaged region ourselves. This works for
    miCompsiteRects since that translates the call into multiple invocations
    of either PolyFillRectangle or Composite, which themselves cause damage.
    
    Fixes:
    
      Bug 28120 - Tint2's tooltip borders end up at 0,0 and do not disappear
      https://bugs.freedesktop.org/show_bug.cgi?id=28120
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index f1c34e7..caa36ee 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -963,6 +963,11 @@ uxa_solid_rects (CARD8		op,
 		return;
 	}
 
+	/* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must
+	 * manually append the damaged regions ourselves.
+	 */
+	DamageRegionAppend(dst->pDrawable, &region);
+
 	pixman_region_translate(&region, dst_x, dst_y);
 	boxes = pixman_region_rectangles(&region, &num_boxes);
 	extents = pixman_region_extents (&region);
commit b9ada52a3081f54e0ed094ac31188bb240866f81
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed May 26 10:14:52 2010 +0100

    uxa: Force the alpha value to 0xffff when treating Over as Src
    
    Since we have at most 8 bits of alpha, we treat >= 0xff00 as opaque.
    However, being paranoid we should set the alpha value to 0xfff in case
    something unexpected happens when converting from the xRenderColor to
    the pixel value.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 41daf06..f1c34e7 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -969,8 +969,10 @@ uxa_solid_rects (CARD8		op,
 
 	if (op == PictOpClear)
 		color->red = color->green = color->blue = color->alpha = 0;
-	if (color->alpha >= 0xff00 && op == PictOpOver)
+	if (color->alpha >= 0xff00 && op == PictOpOver) {
+		color->alpha = 0xffff;
 		op = PictOpSrc;
+	}
 
 	/* Using GEM, the relocation costs outweigh the advantages of the blitter */
 	if (num_boxes == 1 && (op == PictOpSrc || op == PictOpClear)) {
commit 3055d40164590147d35b5e7059ebe5f5858c85fa
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed May 26 10:12:57 2010 +0100

    uxa: Use Composite rather than solid blitter for PolyRect
    
    Due to the relocation overhead, using a single composite with many
    rectangles outperforms many solid blits.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index 29f1fdc..9a4b4e7 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -866,7 +866,7 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
 {
 	uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
 	RegionPtr pClip = fbGetCompositeClip(pGC);
-	PixmapPtr pPixmap = uxa_get_drawable_pixmap(pDrawable);
+	PixmapPtr pPixmap;
 	register BoxPtr pbox;
 	BoxPtr pextent;
 	int extentX1, extentX2, extentY1, extentY2;
@@ -884,11 +884,13 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
 	if (!REGION_NUM_RECTS(pReg))
 		goto out;
 
-	uxa_get_drawable_deltas(pDrawable, pPixmap, &xoff, &yoff);
-
 	if (uxa_screen->swappedOut)
 		goto fallback;
 
+	pPixmap = uxa_get_offscreen_pixmap (pDrawable, &xoff, &yoff);
+	if (!pPixmap)
+		goto fallback;
+
 	/* For ROPs where overlaps don't matter, convert rectangles to region
 	 * and call uxa_fill_region_{solid,tiled}.
 	 */
@@ -914,8 +916,7 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
 		goto fallback;
 	}
 
-	if (!uxa_pixmap_is_offscreen(pPixmap) ||
-	    !(*uxa_screen->info->prepare_solid) (pPixmap,
+	if (!(*uxa_screen->info->prepare_solid) (pPixmap,
 						 pGC->alu,
 						 pGC->planemask,
 						 pGC->fgPixel)) {
@@ -1058,39 +1059,121 @@ uxa_fill_region_solid(DrawablePtr pDrawable,
 		      RegionPtr pRegion,
 		      Pixel pixel, CARD32 planemask, CARD32 alu)
 {
-	uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
-	PixmapPtr pPixmap = uxa_get_drawable_pixmap(pDrawable);
+	ScreenPtr screen = pDrawable->pScreen;
+	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+	PixmapPtr pixmap;
 	int xoff, yoff;
+	int nbox;
+	BoxPtr pBox, extents;
 	Bool ret = FALSE;
 
-	if (uxa_screen->info->check_solid && !uxa_screen->info->check_solid(pDrawable, alu, planemask))
+	pixmap = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
+	if (!pixmap)
 		return FALSE;
 
-	pPixmap = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
-	if (!pPixmap)
-		return FALSE;
+	REGION_TRANSLATE(screen, pRegion, xoff, yoff);
 
-	REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
+	nbox = REGION_NUM_RECTS(pRegion);
+	pBox = REGION_RECTS(pRegion);
+	extents = REGION_EXTENTS(screen, pRegion);
 
-	if ((*uxa_screen->info->prepare_solid) (pPixmap, alu, planemask, pixel)) {
-		int nbox;
-		BoxPtr pBox;
+	/* Using GEM, the relocation costs outweigh the advantages of the blitter */
+	if (nbox == 1 || (alu != GXcopy && alu != GXclear) || planemask != FB_ALLONES) {
+try_solid:
+		if (uxa_screen->info->check_solid &&
+		    !uxa_screen->info->check_solid(&pixmap->drawable, alu, planemask))
+			goto err;
 
-		nbox = REGION_NUM_RECTS(pRegion);
-		pBox = REGION_RECTS(pRegion);
+		if (!uxa_screen->info->prepare_solid(pixmap, alu, planemask, pixel))
+			goto err;
 
 		while (nbox--) {
-			(*uxa_screen->info->solid) (pPixmap, pBox->x1, pBox->y1,
-						    pBox->x2, pBox->y2);
+			uxa_screen->info->solid(pixmap,
+						pBox->x1, pBox->y1,
+						pBox->x2, pBox->y2);
 			pBox++;
 		}
-		(*uxa_screen->info->done_solid) (pPixmap);
 
-		ret = TRUE;
+		uxa_screen->info->done_solid(pixmap);
+	} else {
+		PicturePtr dst, src;
+		PixmapPtr src_pixmap = NULL;
+		xRenderColor color;
+		int error;
+
+		dst = CreatePicture(0, &pixmap->drawable,
+				    PictureMatchFormat(screen,
+						       pixmap->drawable.depth,
+						       format_for_depth(pixmap->drawable.depth)),
+				    0, 0, serverClient, &error);
+		if (!dst)
+			goto err;
+
+		ValidatePicture(dst);
+
+		uxa_get_rgba_from_pixel(pixel,
+					&color.red,
+					&color.green,
+					&color.blue,
+					&color.alpha,
+					format_for_depth(pixmap->drawable.depth));
+		src = CreateSolidPicture(0, &color, &error);
+		if (!src) {
+			FreePicture(dst, 0);
+			goto err;
+		}
+
+		if (!uxa_screen->info->check_composite(PictOpSrc, src, NULL, dst,
+						       extents->x2 - extents->x1,
+						       extents->y2 - extents->y1)) {
+			FreePicture(src, 0);
+			FreePicture(dst, 0);
+			goto try_solid;
+		}
+
+		if (!uxa_screen->info->check_composite_texture ||
+		    !uxa_screen->info->check_composite_texture(screen, src)) {
+			PicturePtr solid;
+			int src_off_x, src_off_y;
+
+			solid = uxa_acquire_solid(screen, src->pSourcePict);
+			FreePicture(src, 0);
+
+			src = solid;
+			src_pixmap = uxa_get_offscreen_pixmap(src->pDrawable,
+							      &src_off_x, &src_off_y);
+			if (!src_pixmap) {
+				FreePicture(src, 0);
+				FreePicture(dst, 0);
+				goto err;
+			}
+		}
+
+		if (!uxa_screen->info->prepare_composite(PictOpSrc, src, NULL, dst, src_pixmap, NULL, pixmap)) {
+			FreePicture(src, 0);
+			FreePicture(dst, 0);
+			goto err;
+		}
+
+		while (nbox--) {
+			uxa_screen->info->composite(pixmap,
+						    0, 0, 0, 0,
+						    pBox->x1,
+						    pBox->y1,
+						    pBox->x2 - pBox->x1,
+						    pBox->y2 - pBox->y1);
+			pBox++;
+		}
+
+		uxa_screen->info->done_composite(pixmap);
+		FreePicture(src, 0);
+		FreePicture(dst, 0);
 	}
 
-	REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
+	ret = TRUE;
 
+err:
+	REGION_TRANSLATE(screen, pRegion, -xoff, -yoff);
 	return ret;
 }
 
commit ec2437f958ec4f5ac5222b37cba4cd403b5c8855
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed May 26 10:12:18 2010 +0100

    uxa: Add PICT format mapping for depth 4 pixmaps.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index 77963f3..29f1fdc 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -41,6 +41,7 @@ format_for_depth(int depth)
 {
 	switch (depth) {
 	case 1: return PICT_a1;
+	case 4: return PICT_a4;
 	case 8: return PICT_a8;
 	case 15: return PICT_x1r5g5b5;
 	case 16: return PICT_r5g6b5;
commit 309bd3a29943ef7502d40c67be49c19a59b6d1a2
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed May 26 10:11:32 2010 +0100

    i830: Skip an empty fill.
    
    In the extremely unlikely event that the higher layer erroneous gave us
    an empty fill, skip it.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index a2da530..bbbf542 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -282,6 +282,9 @@ static void i830_uxa_solid(PixmapPtr pixmap, int x1, int y1, int x2, int y2)
 	if (y2 > pixmap->drawable.height)
 		y2 = pixmap->drawable.height;
 
+	if (x2 <= x1 || y2 <= y1)
+		return;
+
 	pitch = i830_pixmap_pitch(pixmap);
 
 	{


More information about the xorg-commit mailing list