xf86-video-intel: 6 commits - src/i915_render.c uxa/uxa-render.c

Chris Wilson ickle at kemper.freedesktop.org
Thu May 13 09:21:15 PDT 2010


 src/i915_render.c |  100 +++++++++++++++++-------
 uxa/uxa-render.c  |  221 +++++++++++++++++++++++++++++-------------------------
 2 files changed, 193 insertions(+), 128 deletions(-)

New commits:
commit 8de09a0707ee1be1b919b979843711728618ef27
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 13 17:15:28 2010 +0100

    uxa: Convert 1x1R back to solid_fill
    
    In the change to prevent blitting between incompatible sources, we also
    prevented 1x1R pixmaps from being used for solid fills. Reorder the
    sequence of conditions to enable this fast path again.

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 9393058..39793ba 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -1374,90 +1374,89 @@ uxa_composite(CARD8 op,
 					}
 				}
 			}
-		} else if (compatible_formats (op, pDst, pSrc)) {
-			if (pSrc->pDrawable->width == 1 &&
-			    pSrc->pDrawable->height == 1 &&
-			    pSrc->repeat) {
-				ret = uxa_try_driver_solid_fill(pSrc, pDst,
-								xSrc, ySrc,
-								xDst, yDst,
-								width, height);
+		} else if (pSrc->pDrawable->width == 1 &&
+			   pSrc->pDrawable->height == 1 &&
+			   pSrc->repeat) {
+			ret = uxa_try_driver_solid_fill(pSrc, pDst,
+							xSrc, ySrc,
+							xDst, yDst,
+							width, height);
+			if (ret == 1)
+				goto done;
+		} else if (compatible_formats (op, pDst, pSrc) &&
+			   !pSrc->repeat &&
+			   transform_is_integer_translation(pSrc->transform, &tx, &ty) &&
+			   drawable_contains(pSrc->pDrawable,
+					     xSrc + tx, ySrc + ty,
+					     width, height)) {
+			xDst += pDst->pDrawable->x;
+			yDst += pDst->pDrawable->y;
+			xSrc += pSrc->pDrawable->x + tx;
+			ySrc += pSrc->pDrawable->y + ty;
+
+			if (!miComputeCompositeRegion
+			    (&region, pSrc, pMask, pDst, xSrc, ySrc,
+			     xMask, yMask, xDst, yDst, width, height))
+				goto done;
+
+			uxa_copy_n_to_n(pSrc->pDrawable,
+					pDst->pDrawable, NULL,
+					REGION_RECTS(&region),
+					REGION_NUM_RECTS(&region),
+					xSrc - xDst, ySrc - yDst, FALSE,
+					FALSE, 0, NULL);
+			REGION_UNINIT(pDst->pDrawable->pScreen,
+				      &region);
+			goto done;
+		} else if (pSrc->pDrawable->type == DRAWABLE_PIXMAP &&
+			   pSrc->repeatType == RepeatNormal &&
+			   transform_is_integer_translation(pSrc->transform, &tx, &ty)) {
+			DDXPointRec patOrg;
+
+			/* Let's see if the driver can do the repeat
+			 * in one go
+			 */
+			if (uxa_screen->info->prepare_composite) {
+				ret = uxa_try_driver_composite(op, pSrc,
+							       pMask, pDst,
+							       xSrc, ySrc,
+							       xMask, yMask,
+							       xDst, yDst,
+							       width, height);
 				if (ret == 1)
 					goto done;
-			} else if (!pSrc->repeat &&
-				   transform_is_integer_translation(pSrc->transform, &tx, &ty) &&
-				   drawable_contains(pSrc->pDrawable,
-						     xSrc + tx, ySrc + ty,
-						     width, height)) {
-				xDst += pDst->pDrawable->x;
-				yDst += pDst->pDrawable->y;
-				xSrc += pSrc->pDrawable->x + tx;
-				ySrc += pSrc->pDrawable->y + ty;
-
-				if (!miComputeCompositeRegion
-				    (&region, pSrc, pMask, pDst, xSrc, ySrc,
-				     xMask, yMask, xDst, yDst, width, height))
-					goto done;
+			}
 
-				uxa_copy_n_to_n(pSrc->pDrawable,
-						pDst->pDrawable, NULL,
-						REGION_RECTS(&region),
-						REGION_NUM_RECTS(&region),
-						xSrc - xDst, ySrc - yDst, FALSE,
-						FALSE, 0, NULL);
-				REGION_UNINIT(pDst->pDrawable->pScreen,
-					      &region);
+			/* Now see if we can use
+			 * uxa_fill_region_tiled()
+			 */
+			xDst += pDst->pDrawable->x;
+			yDst += pDst->pDrawable->y;
+			xSrc += pSrc->pDrawable->x + tx;
+			ySrc += pSrc->pDrawable->y + ty;
+
+			if (!miComputeCompositeRegion
+			    (&region, pSrc, pMask, pDst, xSrc, ySrc,
+			     xMask, yMask, xDst, yDst, width, height))
 				goto done;
-			} else if (pSrc->pDrawable->type == DRAWABLE_PIXMAP &&
-				   !pSrc->transform &&
-				   pSrc->repeatType == RepeatNormal) {
-				DDXPointRec patOrg;
-
-				/* Let's see if the driver can do the repeat
-				 * in one go
-				 */
-				if (uxa_screen->info->prepare_composite) {
-					ret = uxa_try_driver_composite(op, pSrc,
-								       pMask, pDst,
-								       xSrc, ySrc,
-								       xMask, yMask,
-								       xDst, yDst,
-								       width, height);
-					if (ret == 1)
-						goto done;
-				}
-
-				/* Now see if we can use
-				 * uxa_fill_region_tiled()
-				 */
-				xDst += pDst->pDrawable->x;
-				yDst += pDst->pDrawable->y;
-				xSrc += pSrc->pDrawable->x;
-				ySrc += pSrc->pDrawable->y;
-
-				if (!miComputeCompositeRegion
-				    (&region, pSrc, pMask, pDst, xSrc, ySrc,
-				     xMask, yMask, xDst, yDst, width, height))
-					goto done;
 
-				/* pattern origin is the point in the
-				 * destination drawable
-				 * corresponding to (0,0) in the source */
-				patOrg.x = xDst - xSrc;
-				patOrg.y = yDst - ySrc;
+			/* pattern origin is the point in the
+			 * destination drawable
+			 * corresponding to (0,0) in the source */
+			patOrg.x = xDst - xSrc;
+			patOrg.y = yDst - ySrc;
 
-				ret = uxa_fill_region_tiled(pDst->pDrawable,
-							    &region,
-							    (PixmapPtr) pSrc->
-							    pDrawable, &patOrg,
-							    FB_ALLONES, GXcopy);
+			ret = uxa_fill_region_tiled(pDst->pDrawable,
+						    &region,
+						    (PixmapPtr) pSrc->
+						    pDrawable, &patOrg,
+						    FB_ALLONES, GXcopy);
 
-				REGION_UNINIT(pDst->pDrawable->pScreen,
-					      &region);
+			REGION_UNINIT(pDst->pDrawable->pScreen,
+				      &region);
 
-				if (ret)
-					goto done;
-			}
+			if (ret)
+				goto done;
 		}
 	}
 
commit 92e9cf8af784b13c28030e38b15c8decf29e6a32
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 13 15:12:51 2010 +0100

    uxa: Only use solid_fill for SRC.

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 0ba8b9d..9393058 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -1362,12 +1362,16 @@ uxa_composite(CARD8 op,
 			if (pSrc->pSourcePict) {
 				SourcePict *source = pSrc->pSourcePict;
 				if (source->type == SourcePictTypeSolidFill) {
-					ret = uxa_try_driver_solid_fill(pSrc, pDst,
-									xSrc, ySrc,
-									xDst, yDst,
-									width, height);
-					if (ret == 1)
-						goto done;
+					if (op == PictOpSrc ||
+					    (op == PictOpOver &&
+					     (source->solidFill.color & 0xff000000) == 0xff000000)) {
+						ret = uxa_try_driver_solid_fill(pSrc, pDst,
+										xSrc, ySrc,
+										xDst, yDst,
+										width, height);
+						if (ret == 1)
+							goto done;
+					}
 				}
 			}
 		} else if (compatible_formats (op, pDst, pSrc)) {
commit d1bd14e8b6754ba9f797642e1b33bf689e19417b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 13 15:11:16 2010 +0100

    uxa: Replace source for CLEAR with a transparent solid
    
    This means that we will hit the faster try_solid_fill path instead.

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 06bd9ce..0ba8b9d 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -559,6 +559,21 @@ uxa_create_solid(ScreenPtr screen, uint32_t color)
 }
 
 static PicturePtr
+uxa_solid_clear(ScreenPtr screen)
+{
+	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+	PicturePtr picture;
+
+	if (!uxa_screen->solid_clear) {
+		uxa_screen->solid_clear = uxa_create_solid(screen, 0);
+		if (!uxa_screen->solid_clear)
+			return 0;
+	}
+	picture = uxa_screen->solid_clear;
+	return picture;
+}
+
+static PicturePtr
 uxa_acquire_solid(ScreenPtr screen, SourcePict *source)
 {
 	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
@@ -567,12 +582,10 @@ uxa_acquire_solid(ScreenPtr screen, SourcePict *source)
 	int i;
 
 	if ((solid->color >> 24) == 0) {
-		if (!uxa_screen->solid_clear) {
-			uxa_screen->solid_clear = uxa_create_solid(screen, 0);
-			if (!uxa_screen->solid_clear)
-				return 0;
-		}
-		picture = uxa_screen->solid_clear;
+		picture = uxa_solid_clear(screen);
+		if (!picture)
+		    return 0;
+
 		goto DONE;
 	} else if (solid->color == 0xff000000) {
 		if (!uxa_screen->solid_black) {
@@ -1335,6 +1348,16 @@ uxa_composite(CARD8 op,
 		pSrc->repeat = 0;
 
 	if (!pMask) {
+		if (op == PictOpClear) {
+			PicturePtr clear = uxa_solid_clear(pDst->pDrawable->pScreen);
+			if (clear &&
+			    uxa_try_driver_solid_fill(clear, pDst,
+						      xSrc, ySrc,
+						      xDst, yDst,
+						      width, height) == 1)
+				goto done;
+		}
+
 		if (pSrc->pDrawable == NULL) {
 			if (pSrc->pSourcePict) {
 				SourcePict *source = pSrc->pSourcePict;
commit cdab72c405434ecbf7a79e402ff2d65d6a728179
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 13 15:12:32 2010 +0100

    uxa: Fallback early if compositing with alphaMaps

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 4958dd8..06bd9ce 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -1276,9 +1276,6 @@ compatible_formats (CARD8 op, PicturePtr dst, PicturePtr src)
 		if (dst->format == PICT_a8r8g8b8 && src->format == PICT_x8r8g8b8)
 			return 1;
 	} else if (op == PictOpOver) {
-		if (src->alphaMap || dst->alphaMap)
-			return 0;
-
 		if (src->format != dst->format)
 			return 0;
 
@@ -1325,7 +1322,10 @@ uxa_composite(CARD8 op,
 		goto fallback;
 
 	if (!uxa_drawable_is_offscreen(pDst->pDrawable))
-	    goto fallback;
+		goto fallback;
+
+	if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
+		goto fallback;
 
 	/* Remove repeat in source if useless */
 	if (pSrc->pDrawable && pSrc->repeat &&
@@ -1389,8 +1389,7 @@ uxa_composite(CARD8 op,
 				/* Let's see if the driver can do the repeat
 				 * in one go
 				 */
-				if (uxa_screen->info->prepare_composite
-				    && !pSrc->alphaMap && !pDst->alphaMap) {
+				if (uxa_screen->info->prepare_composite) {
 					ret = uxa_try_driver_composite(op, pSrc,
 								       pMask, pDst,
 								       xSrc, ySrc,
@@ -1436,15 +1435,13 @@ uxa_composite(CARD8 op,
 	}
 
 	/* Remove repeat in mask if useless */
-	if (pMask && pMask->repeat && !pMask->transform && pMask->pDrawable &&
+	if (pMask && pMask->pDrawable && pMask->repeat &&
+	    transform_is_integer_translation(pMask->transform, &tx, &ty) &&
 	    (pMask->pDrawable->width > 1 || pMask->pDrawable->height > 1) &&
-	    xMask >= 0 && (xMask + width) <= pMask->pDrawable->width &&
-	    yMask >= 0 && (yMask + height) <= pMask->pDrawable->height)
+	    drawable_contains(pMask->pDrawable, xMask + tx, yMask + ty, width, height))
 		pMask->repeat = 0;
 
-	if (uxa_screen->info->prepare_composite &&
-	    !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
-	{
+	if (uxa_screen->info->prepare_composite) {
 		Bool isSrcSolid;
 
 		ret =
commit 25811dc7b7d1ad3fb01c31197d1ae1fe5b498975
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 13 15:09:28 2010 +0100

    i915: Force output alpha to 1. if dst has no alpha channel.
    
    Ensure that garbage is not stored in the unused alpha channel so that
    we can rely on it being currently initialiased when used as a source or
    returning via GetImage.
    
    Partial fix for rendercheck -t blend

diff --git a/src/i915_render.c b/src/i915_render.c
index be89b55..ad21a7c 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -492,6 +492,7 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
 	uint32_t blendctl, tiling_bits;
 	Bool is_affine_src, is_affine_mask;
 	Bool is_solid_src, is_solid_mask;
+	Bool dst_has_alpha = PICT_FORMAT_A(dest_picture->format);
 	int tex_count, t;
 
 	intel->needs_render_state_emit = FALSE;
@@ -636,21 +637,40 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
 		}
 	    }
 
-	    /* Load the source_picture texel */
-	    if (! is_solid_src) {
-		if (is_affine_src) {
-		    i915_fs_texld(FS_R0, FS_S0, FS_T0);
-		} else {
-		    i915_fs_texldp(FS_R0, FS_S0, FS_T0);
-		}
-
-		src_reg = FS_R0;
-	    }
-
 	    if (!mask) {
-		/* No mask, so move to output color */
-		i915_fs_mov(out_reg, i915_fs_operand_reg(src_reg));
+		    /* No mask, so load directly to output color */
+		    if (! is_solid_src) {
+			    if (dst_format == COLR_BUF_8BIT)
+				    src_reg = FS_R0;
+			    else if (dst_has_alpha)
+				    src_reg = FS_OC;
+			    else
+				    src_reg = FS_R0;
+			    if (is_affine_src)
+				    i915_fs_texld(src_reg, FS_S0, FS_T0);
+			    else
+				    i915_fs_texldp(src_reg, FS_S0, FS_T0);
+		    }
+		    if (src_reg != FS_OC) {
+			    if (dst_format == COLR_BUF_8BIT)
+				    i915_fs_mov(FS_OC, i915_fs_operand(src_reg, W, W, W, W));
+			    else if (dst_has_alpha)
+				    i915_fs_mov(FS_OC, i915_fs_operand_reg(src_reg));
+			    else
+				    i915_fs_mov(FS_OC, i915_fs_operand(src_reg, X, Y, Z, ONE));
+		    }
 	    } else {
+		    if (! is_solid_src) {
+			    /* Load the source_picture texel */
+			    if (is_affine_src) {
+				    i915_fs_texld(FS_R0, FS_S0, FS_T0);
+			    } else {
+				    i915_fs_texldp(FS_R0, FS_S0, FS_T0);
+			    }
+
+			    src_reg = FS_R0;
+		    }
+
 		if (! is_solid_mask) {
 		    /* Load the mask_picture texel */
 		    if (is_affine_mask) {
@@ -673,24 +693,40 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
 		 * source value (src.X * mask.A).
 		 */
 		if (mask_picture->componentAlpha &&
-			PICT_FORMAT_RGB(mask_picture->format)) {
-		    if (i915_blend_op[op].src_alpha) {
-			i915_fs_mul(out_reg,
-				    i915_fs_operand(src_reg, W, W, W, W),
-				    i915_fs_operand_reg(mask_reg));
-		    } else {
-			    i915_fs_mul(out_reg,
-					i915_fs_operand_reg(src_reg),
-					i915_fs_operand_reg(mask_reg));
-		    }
+		    PICT_FORMAT_RGB(mask_picture->format)) {
+			if (i915_blend_op[op].src_alpha) {
+				if (dst_has_alpha)
+					i915_fs_mul(out_reg,
+						    i915_fs_operand(src_reg, W, W, W, W),
+						    i915_fs_operand_reg(mask_reg));
+				else
+					i915_fs_mul(out_reg,
+						    i915_fs_operand(src_reg, W, W, W, ONE),
+						    i915_fs_operand(mask_reg, X, Y, Z, ONE));
+			} else {
+				if (dst_has_alpha)
+					i915_fs_mul(out_reg,
+						    i915_fs_operand_reg(src_reg),
+						    i915_fs_operand_reg(mask_reg));
+				else
+					i915_fs_mul(out_reg,
+						    i915_fs_operand(src_reg, X, Y, Z, ONE),
+						    i915_fs_operand(mask_reg, X, Y, Z, ONE));
+			}
 		} else {
-		    i915_fs_mul(out_reg,
-				i915_fs_operand_reg(src_reg),
-				i915_fs_operand(mask_reg, W, W, W, W));
+			if (dst_has_alpha)
+				i915_fs_mul(out_reg,
+					    i915_fs_operand_reg(src_reg),
+					    i915_fs_operand(mask_reg, W, W, W, W));
+			else
+				i915_fs_mul(out_reg,
+					    i915_fs_operand(src_reg, X, Y, Z, ONE),
+					    i915_fs_operand(mask_reg, W, W, W, ONE));
 		}
+
+		if (dst_format == COLR_BUF_8BIT)
+		    i915_fs_mov(FS_OC, i915_fs_operand(out_reg, W, W, W, W));
 	    }
-	    if (dst_format == COLR_BUF_8BIT)
-		i915_fs_mov(FS_OC, i915_fs_operand(out_reg, W, W, W, W));
 
 	    FS_END();
 	}
commit 0e726b85ca6013ae9dc51391aaa309203352b61e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 13 09:41:39 2010 +0100

    i915: Add a2r10g10b10 format and friends
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i915_render.c b/src/i915_render.c
index 6ce7256..be89b55 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -79,16 +79,18 @@ static struct blendinfo i915_blend_op[] = {
 };
 
 static struct formatinfo i915_tex_formats[] = {
+	{PICT_a8, MAPSURF_8BIT | MT_8BIT_A8},
 	{PICT_a8r8g8b8, MAPSURF_32BIT | MT_32BIT_ARGB8888},
 	{PICT_x8r8g8b8, MAPSURF_32BIT | MT_32BIT_XRGB8888},
 	{PICT_a8b8g8r8, MAPSURF_32BIT | MT_32BIT_ABGR8888},
 	{PICT_x8b8g8r8, MAPSURF_32BIT | MT_32BIT_XBGR8888},
+	{PICT_a2r10g10b10, MAPSURF_32BIT | MT_32BIT_ARGB2101010},
+	{PICT_a2b10g10r10, MAPSURF_32BIT | MT_32BIT_ABGR2101010},
 	{PICT_r5g6b5, MAPSURF_16BIT | MT_16BIT_RGB565},
 	{PICT_a1r5g5b5, MAPSURF_16BIT | MT_16BIT_ARGB1555},
 	{PICT_x1r5g5b5, MAPSURF_16BIT | MT_16BIT_ARGB1555},
 	{PICT_a4r4g4b4, MAPSURF_16BIT | MT_16BIT_ARGB4444},
 	{PICT_x4r4g4b4, MAPSURF_16BIT | MT_16BIT_ARGB4444},
-	{PICT_a8, MAPSURF_8BIT | MT_8BIT_A8},
 };
 
 static uint32_t i915_get_blend_cntl(int op, PicturePtr mask,
@@ -156,6 +158,10 @@ static Bool i915_get_dest_format(PicturePtr dest_picture, uint32_t * dst_format)
 	case PICT_x1r5g5b5:
 		*dst_format = COLR_BUF_ARGB1555;
 		break;
+	case PICT_a2r10g10b10:
+	case PICT_x2r10g10b10:
+		*dst_format = COLR_BUF_ARGB2AAA;
+		break;
 	case PICT_a8:
 		*dst_format = COLR_BUF_8BIT;
 		break;


More information about the xorg-commit mailing list