xf86-video-intel: 2 commits - src/i830_render.c src/i830_uxa.c

Chris Wilson ickle at kemper.freedesktop.org
Fri May 14 17:16:55 PDT 2010


 src/i830_render.c |   48 +++++++++++++++++++++++++-----------------------
 src/i830_uxa.c    |   33 ++-------------------------------
 2 files changed, 27 insertions(+), 54 deletions(-)

New commits:
commit 9c3da71349bcfeabae08f1572cf602c357bf7641
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat May 15 01:05:24 2010 +0100

    i830: Remove xrgb conversion to argb, no longer required.
    
    All textures are now properly declared so that the alpha swizzling
    occurs in the sampler or not at all. The downside is that for quite a
    few composite operations we have to fallback to software on older
    hardware. There is scope for more performing the alpha expansion in
    shaders or combiners when we know the picture covers the clip - which is
    almost all of the time for normal operations especially those
    constructed by Cairo.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index b2370fe..d402895 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -681,35 +681,7 @@ static Bool i830_bo_put_image(PixmapPtr pixmap, dri_bo *bo, char *src, int src_p
 {
 	int stride = i830_pixmap_pitch(pixmap);
 
-	/* fill alpha channel */
-	if (pixmap->drawable.depth == 24) {
-		pixman_image_t *src_image, *dst_image;
-
-		src_image = pixman_image_create_bits (PIXMAN_x8r8g8b8,
-						      w, h,
-						      (uint32_t *) src, src_pitch);
-
-		dst_image = pixman_image_create_bits (PIXMAN_a8r8g8b8,
-						      w, h,
-						      (uint32_t *) bo->virtual, stride);
-
-		if (src_image && dst_image)
-			pixman_image_composite (PictOpSrc,
-						src_image, NULL, dst_image,
-						0, 0,
-						0, 0,
-						0, 0,
-						w, h);
-
-		if (src_image)
-			pixman_image_unref (src_image);
-
-		if (dst_image)
-			pixman_image_unref (dst_image);
-
-		if (src_image == NULL || dst_image == NULL)
-			return FALSE;
-	} else if (src_pitch == stride) {
+	if (src_pitch == stride) {
 		memcpy (bo->virtual, src, stride * h);
 	} else {
 		char *dst = bo->virtual;
@@ -803,8 +775,7 @@ static Bool i830_uxa_put_image(PixmapPtr pixmap,
 
 	priv = i830_get_pixmap_intel(pixmap);
 	if (priv->batch_read_domains ||
-	    drm_intel_bo_busy(priv->bo) ||
-	    pixmap->drawable.depth == 24) {
+	    drm_intel_bo_busy(priv->bo)) {
 		dri_bo *bo;
 
 		/* Partial replacement, copy incoming image to a bo and blit. */
commit 926fbc7d90ac1d0d49d154f136f9c9ed613c98c2
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat May 15 01:01:20 2010 +0100

    i830: Remove incorrectly mapped tex formats.
    
    We no longer workaround the lack of alpha expansion for xrgb textures as
    this interferes with EXTEND_NONE, though we could if we know the source
    covers the clip...
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_render.c b/src/i830_render.c
index e7f55ce..57f8ecd 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -126,21 +126,19 @@ static struct blendinfo i830_blend_op[] = {
 	{0, 0, BLENDFACTOR_ONE, BLENDFACTOR_ONE},
 };
 
-/* The x8* formats could use MT_32BIT_X* on 855+, but since we implement
- * workarounds for 830/845 anyway, we just rely on those whether the hardware
- * could handle it for us or not.
- */
 static struct formatinfo i830_tex_formats[] = {
 	{PICT_a8r8g8b8, MT_32BIT_ARGB8888},
-	{PICT_x8r8g8b8, MT_32BIT_ARGB8888},
 	{PICT_a8b8g8r8, MT_32BIT_ABGR8888},
-	{PICT_x8b8g8r8, MT_32BIT_ABGR8888},
 	{PICT_r5g6b5, MT_16BIT_RGB565},
 	{PICT_a1r5g5b5, MT_16BIT_ARGB1555},
-	{PICT_x1r5g5b5, MT_16BIT_ARGB1555},
 	{PICT_a8, MT_8BIT_A8},
 };
 
+static struct formatinfo i855_tex_formats[] = {
+	{PICT_x8r8g8b8, MT_32BIT_XRGB8888},
+	{PICT_x8b8g8r8, MT_32BIT_XBGR8888},
+};
+
 static Bool i830_get_dest_format(PicturePtr dest_picture, uint32_t * dst_format)
 {
 	ScrnInfoPtr scrn;
@@ -221,15 +219,26 @@ static Bool i830_get_blend_cntl(ScrnInfoPtr scrn, int op, PicturePtr mask,
 	return TRUE;
 }
 
-static uint32_t i8xx_get_card_format(PicturePtr picture)
+static uint32_t i8xx_get_card_format(intel_screen_private *intel,
+				     PicturePtr picture)
 {
 	int i;
+
 	for (i = 0; i < sizeof(i830_tex_formats) / sizeof(i830_tex_formats[0]);
 	     i++) {
 		if (i830_tex_formats[i].fmt == picture->format)
 			return i830_tex_formats[i].card_fmt;
 	}
-	FatalError("Unsupported format type %d\n", picture->format);
+
+	if (IS_I85X(intel) || IS_I865G(intel)) {
+		for (i = 0; i < sizeof(i855_tex_formats) / sizeof(i855_tex_formats[0]);
+		     i++) {
+			if (i855_tex_formats[i].fmt == picture->format)
+				return i855_tex_formats[i].card_fmt;
+		}
+	}
+
+	return 0;
 }
 
 static void i830_texture_setup(PicturePtr picture, PixmapPtr pixmap, int unit)
@@ -251,7 +260,7 @@ static void i830_texture_setup(PicturePtr picture, PixmapPtr pixmap, int unit)
 	else
 		texcoordtype = TEXCOORDTYPE_HOMOGENEOUS;
 
-	format = i8xx_get_card_format(picture);
+	format = i8xx_get_card_format(intel, picture);
 
 	switch (picture->repeatType) {
 	case RepeatNone:
@@ -378,8 +387,10 @@ i830_check_composite(int op, PicturePtr source_picture, PicturePtr mask_picture,
 Bool
 i830_check_composite_texture(ScreenPtr screen, PicturePtr picture)
 {
+	ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+	intel_screen_private *intel = intel_get_screen_private(scrn);
+
 	if (picture->repeatType > RepeatReflect) {
-		ScrnInfoPtr scrn = xf86Screens[screen->myNum];
 		intel_debug_fallback(scrn, "Unsupported picture repeat %d\n",
 			     picture->repeatType);
 		return FALSE;
@@ -387,34 +398,25 @@ i830_check_composite_texture(ScreenPtr screen, PicturePtr picture)
 
 	if (picture->filter != PictFilterNearest &&
 	    picture->filter != PictFilterBilinear) {
-		ScrnInfoPtr scrn = xf86Screens[screen->myNum];
 		intel_debug_fallback(scrn, "Unsupported filter 0x%x\n",
 				     picture->filter);
 		return FALSE;
 	}
 
 	if (picture->pDrawable) {
-		int w, h, i;
+		int w, h;
 
 		w = picture->pDrawable->width;
 		h = picture->pDrawable->height;
 		if ((w > 2048) || (h > 2048)) {
-			ScrnInfoPtr scrn = xf86Screens[screen->myNum];
 			intel_debug_fallback(scrn,
 					     "Picture w/h too large (%dx%d)\n",
 					     w, h);
 			return FALSE;
 		}
 
-		for (i = 0;
-		     i < sizeof(i830_tex_formats) / sizeof(i830_tex_formats[0]);
-		     i++) {
-			if (i830_tex_formats[i].fmt == picture->format)
-				break;
-		}
-		if (i == sizeof(i830_tex_formats) / sizeof(i830_tex_formats[0]))
-		{
-			ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+		/* XXX we can use the xrgb32 types if there the picture covers the clip */
+		if (!i8xx_get_card_format(intel, picture)) {
 			intel_debug_fallback(scrn, "Unsupported picture format "
 					     "0x%x\n",
 					     (int)picture->format);


More information about the xorg-commit mailing list