xf86-video-intel: src/i830.h src/i915_render.c uxa/uxa.h uxa/uxa-render.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Nov 13 12:24:05 PST 2009


 src/i830.h        |    4 ++--
 src/i915_render.c |   34 ++++++++++++++++++++++++++++------
 uxa/uxa-render.c  |   33 ++++++++++++++++++++++-----------
 uxa/uxa.h         |    6 ++++++
 4 files changed, 58 insertions(+), 19 deletions(-)

New commits:
commit c180baf43b8a0e407448018f3a7e42491cf974ae
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Nov 13 19:35:23 2009 +0000

    i915: Derive the correct target color from the pixmap by checking its format
    
    Particularly noting to route alpha to the green channel when blending
    with a8 destinations.
    
    Fixes:
    
      rendercheck/repeat/triangles regressed
      http://bugs.freedesktop.org/show_bug.cgi?id=25047
    
    introduced with commit 14109a.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830.h b/src/i830.h
index bd62743..87b3dba 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -259,8 +259,8 @@ typedef struct intel_screen_private {
 
 	PixmapPtr render_source, render_mask, render_dest;
 	PicturePtr render_source_picture, render_mask_picture, render_dest_picture;
-	uint32_t render_source_solid;
-	uint32_t render_mask_solid;
+	CARD32 render_source_solid;
+	CARD32 render_mask_solid;
 	Bool render_source_is_solid;
 	Bool render_mask_is_solid;
 	Bool needs_render_state_emit;
diff --git a/src/i915_render.c b/src/i915_render.c
index f64e031..c720f2f 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -375,11 +375,23 @@ i915_prepare_composite(int op, PicturePtr source_picture,
 	    source_picture->pDrawable->width == 1 &&
 	    source_picture->pDrawable->height == 1 &&
 	    source_picture->repeat;
-	if (intel->render_source_is_solid)
-		intel->render_source_solid = uxa_get_pixmap_first_pixel(source);
-	else if (!intel_check_pitch_3d(source))
+
+	if (intel->render_source_is_solid) {
+	    if (! uxa_get_color_for_pixmap (source,
+					    source_picture->format,
+					    PICT_a8r8g8b8,
+					    &intel->render_source_solid))
+		return FALSE;
+
+	    /* route alpha to the green channel when using a8 targets */
+	    if (dest_picture->format == PICT_a8) {
+		intel->render_source_solid >>= 24;
+		intel->render_source_solid *= 0x01010101;
+	    }
+	} else if (!intel_check_pitch_3d(source))
 		return FALSE;
 
+
 	intel->render_mask_is_solid = TRUE; /* mask == NULL => opaque */
 	if (mask) {
 	    intel->render_mask_is_solid =
@@ -387,9 +399,19 @@ i915_prepare_composite(int op, PicturePtr source_picture,
 		mask_picture->pDrawable->width == 1 &&
 		mask_picture->pDrawable->height == 1 &&
 		mask_picture->repeat;
-	    if (intel->render_mask_is_solid)
-		    intel->render_mask_solid = uxa_get_pixmap_first_pixel(mask);
-	    else if (!intel_check_pitch_3d(mask))
+	    if (intel->render_mask_is_solid) {
+		if (! uxa_get_color_for_pixmap (mask,
+						mask_picture->format,
+						PICT_a8r8g8b8,
+						&intel->render_mask_solid))
+		    return FALSE;
+
+		/* route alpha to the green channel when using a8 targets */
+		if (dest_picture->format == PICT_a8) {
+		    intel->render_mask_solid >>= 24;
+		    intel->render_mask_solid *= 0x01010101;
+		}
+	    } else if (!intel_check_pitch_3d(mask))
 		    return FALSE;
 	}
 
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 79017b5..abd0bf5 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -230,6 +230,27 @@ uxa_get_rgba_from_pixel(CARD32 pixel,
 	return TRUE;
 }
 
+int
+uxa_get_color_for_pixmap (PixmapPtr	 pixmap,
+			  CARD32	 src_format,
+			  CARD32	 dst_format,
+			  CARD32	*pixel)
+{
+	CARD16 red, green, blue, alpha;
+
+	*pixel = uxa_get_pixmap_first_pixel(pixmap);
+
+	if (!uxa_get_rgba_from_pixel(*pixel, &red, &green, &blue, &alpha,
+				     src_format))
+		return 0;
+
+	if (!uxa_get_pixel_from_rgba(pixel, red, green, blue, alpha,
+				     dst_format))
+		return 0;
+
+	return 1;
+}
+
 static int
 uxa_try_driver_solid_fill(PicturePtr pSrc,
 			  PicturePtr pDst,
@@ -244,7 +265,6 @@ uxa_try_driver_solid_fill(PicturePtr pSrc,
 	int dst_off_x, dst_off_y;
 	PixmapPtr pSrcPix, pDstPix;
 	CARD32 pixel;
-	CARD16 red, green, blue, alpha;
 
 	pDstPix = uxa_get_drawable_pixmap(pDst->pDrawable);
 	pSrcPix = uxa_get_drawable_pixmap(pSrc->pDrawable);
@@ -264,21 +284,12 @@ uxa_try_driver_solid_fill(PicturePtr pSrc,
 
 	REGION_TRANSLATE(pScreen, &region, dst_off_x, dst_off_y);
 
-	pixel = uxa_get_pixmap_first_pixel(pSrcPix);
-
 	if (!uxa_pixmap_is_offscreen(pDstPix)) {
 		REGION_UNINIT(pDst->pDrawable->pScreen, &region);
 		return 0;
 	}
 
-	if (!uxa_get_rgba_from_pixel(pixel, &red, &green, &blue, &alpha,
-				     pSrc->format)) {
-		REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-		return -1;
-	}
-
-	if (!uxa_get_pixel_from_rgba(&pixel, red, green, blue, alpha,
-				     pDst->format)) {
+	if (! uxa_get_color_for_pixmap (pSrcPix, pSrc->format, pDst->format, &pixel)) {
 		REGION_UNINIT(pDst->pDrawable->pScreen, &region);
 		return -1;
 	}
diff --git a/uxa/uxa.h b/uxa/uxa.h
index b1f3737..c7e5566 100644
--- a/uxa/uxa.h
+++ b/uxa/uxa.h
@@ -521,6 +521,12 @@ void uxa_driver_fini(ScreenPtr pScreen);
 
 CARD32 uxa_get_pixmap_first_pixel(PixmapPtr pPixmap);
 
+Bool
+uxa_get_color_for_pixmap (PixmapPtr	 pixmap,
+			  CARD32	 src_format,
+			  CARD32	 dst_format,
+			  CARD32	*pixel);
+
 void uxa_set_fallback_debug(ScreenPtr screen, Bool enable);
 
 /**


More information about the xorg-commit mailing list