[Intel-gfx] [PATCH] i915: Do not force the incoming source alpha to 1.

Chris Wilson chris at chris-wilson.co.uk
Tue Nov 10 16:52:21 CET 2009


RENDER specifies that textures are extended with the clear colour in the
EXTEND_NONE case. By forcing the border colour to contain 1, we were
padding with black instead. This is a long standing bug that causes
numerous failure in cairo and has been frequently bemoaned about in
bugzilla.

  https://bugs.freedesktop.org/show_bug.cgi?id=17933
  x8r8g8b8 doesn't sample alpha=0 outside surface bounds

However, one consequence of this is that we now must trust the incoming
source alpha for x8r8g8b8 surfaces (and similar ignored alpha formats).
We workaround this by ensuring that we fill the outgoing alpha channel
with 1 for such targets, but we must also rely on the X server to fill
the alpha channel on incoming RGB images.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 src/i915_render.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/i915_render.c b/src/i915_render.c
index f64e031..8d8fde4 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -446,7 +446,6 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	int op = intel->i915_render_state.op;
-	PicturePtr source_picture = intel->render_source_picture;
 	PicturePtr mask_picture = intel->render_mask_picture;
 	PicturePtr dest_picture = intel->render_dest_picture;
 	PixmapPtr mask = intel->render_mask;
@@ -600,10 +599,6 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
 		    i915_fs_texldp(FS_R0, FS_S0, FS_T0);
 		}
 
-		/* If the texture lacks an alpha channel, force the alpha to 1. */
-		if (PICT_FORMAT_A(source_picture->format) == 0)
-		    i915_fs_mov_masked(FS_R0, MASK_W, i915_fs_operand_one());
-
 		src_reg = FS_R0;
 	    }
 
@@ -653,7 +648,9 @@ static void i915_emit_composite_setup(ScrnInfoPtr scrn)
 		}
 	    }
 	    if (dst_format == COLR_BUF_8BIT)
-		i915_fs_mov(FS_OC, i915_fs_operand(out_reg, W, W, W, W));
+		    i915_fs_mov(FS_OC, i915_fs_operand(out_reg, W, W, W, W));
+	    if (PICT_FORMAT_A(dest_picture->format) == 0)
+		    i915_fs_mov_masked(FS_OC, MASK_W, i915_fs_operand_one());
 
 	    FS_END();
 	}
-- 
1.6.5.2




More information about the Intel-gfx mailing list