xf86-video-intel: 3 commits - src/i830_reg.h src/i830_render.c uxa/uxa-render.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Sep 21 17:40:16 PDT 2009


 src/i830_reg.h    |    2 +-
 src/i830_render.c |   49 +++++++++++++++++++++++++------------------------
 uxa/uxa-render.c  |    2 +-
 3 files changed, 27 insertions(+), 26 deletions(-)

New commits:
commit 762e406d138ac80854b6a23b1078b52f6581f0d8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Sep 22 01:34:37 2009 +0100

    Revert "8xx: Fallback for any non-affine transformation."
    
    This reverts commit 505025053d66d415e1c23ac858b9238fa8541d37.
    
    In theory, the non-affine paths work -- at least for the stated test case,
    so re-enable them and avoid the slow work-around.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_render.c b/src/i830_render.c
index c947699..4fa872b 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -396,17 +396,6 @@ i830_check_composite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
     if (!i830_get_dest_format(pDstPicture, &tmp1))
 	I830FALLBACK("Get Color buffer format\n");
 
-    /* There exists some code to handle non-affine transformations for
-     * 8xx, but from what we can tell, it just isn't correct. (An easy
-     * testcase is to run enlightenemt (e17), click the "e", then
-     * "settings", "settings panel", "advanced", "engine", and finally
-     * "XRender" and "Apply". After doing that, moving any window causes
-     * a GPU hang. */
-    if (!i830_transform_is_affine(pSrcPicture->transform) ||
-	!i830_transform_is_affine(pDstPicture->transform) ||
-	(pMaskPicture && !i830_transform_is_affine (pMaskPicture->transform)))
-	I830FALLBACK("Non-affine transformation\n");
-
     return TRUE;
 }
 
commit 2cc1f3cb6034dddd65b3781b0cde7dff4ac1e803
Author: Keith Packard <keithp at keithp.com>
Date:   Sat Sep 19 17:30:57 2009 -0700

    i8xx: Format projective texture coordinates correctly.
    
    Projective texture coordinates must be delivered as TEXCOORDFMT_3D
    using TEXCOORDTYPE_HOMOGENOUS. This meant selecting the correct type
    in i830_texture_setup, the correct format in i830_emit_composite_state
    and sending only 3 coordinates in i830_emit_composite_primitive.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    [ickle: tweaked to fix up a couple of use-before-initialised]
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_reg.h b/src/i830_reg.h
index 7a8df9f..a8b82a6 100644
--- a/src/i830_reg.h
+++ b/src/i830_reg.h
@@ -523,7 +523,7 @@
 #define VFT0_XYZW_MASK          (7<<1)
 
 /* _3DSTATE_VERTEX_FORMAT_2, p206 */
-#define _3DSTATE_VFT1_CMD	(CMD_3D|(0x0a<<24))
+#define _3DSTATE_VERTEX_FORMAT_2_CMD	(CMD_3D|(0x0a<<24))
 #define VFT1_TEX7_FMT(x)	((x)<<14)
 #define VFT1_TEX6_FMT(x)	((x)<<12)
 #define VFT1_TEX5_FMT(x)	((x)<<10)
diff --git a/src/i830_render.c b/src/i830_render.c
index 2c95601..c947699 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -276,12 +276,18 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
     I830Ptr pI830 = I830PTR(pScrn);
     uint32_t format, pitch, filter;
     uint32_t wrap_mode;
+    uint32_t texcoordtype;
 
     pitch = intel_get_pixmap_pitch(pPix);
     pI830->scale_units[unit][0] = pPix->drawable.width;
     pI830->scale_units[unit][1] = pPix->drawable.height;
     pI830->transform[unit] = pPict->transform;
 
+    if (i830_transform_is_affine(pI830->transform[unit]))
+	texcoordtype = TEXCOORDTYPE_CARTESIAN;
+    else
+	texcoordtype = TEXCOORDTYPE_HOMOGENEOUS;
+
     format = i8xx_get_card_format(pPict);
 
     switch (pPict->repeatType) {
@@ -334,7 +340,7 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
 	OUT_BATCH(0); /* default color */
 	OUT_BATCH(_3DSTATE_MAP_COORD_SET_CMD | TEXCOORD_SET(unit) |
 		  ENABLE_TEXCOORD_PARAMS | TEXCOORDS_ARE_NORMAL |
-		  TEXCOORDTYPE_CARTESIAN | ENABLE_ADDR_V_CNTL |
+		  texcoordtype | ENABLE_ADDR_V_CNTL |
 		  TEXCOORD_ADDR_V_MODE(wrap_mode) |
 		  ENABLE_ADDR_U_CNTL | TEXCOORD_ADDR_U_MODE(wrap_mode));
 	/* map texel stream */
@@ -537,13 +543,14 @@ i830_emit_composite_state(ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
     uint32_t vf2;
+    uint32_t texcoordfmt = 0;
 
     pI830->needs_render_state_emit = FALSE;
 
     IntelEmitInvarientState(pScrn);
     pI830->last_3d = LAST_3D_RENDER;
 
-    BEGIN_BATCH(22);
+    BEGIN_BATCH(21);
 
     OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
     OUT_BATCH(BUF_3D_ID_COLOR_BACK| BUF_3D_USE_FENCE |
@@ -570,19 +577,17 @@ i830_emit_composite_state(ScrnInfoPtr pScrn)
 	vf2 = 2 << 12; /* 2 texture coord sets */
     else
 	vf2 = 1 << 12;
-    OUT_BATCH(vf2); /* TEXCOORDFMT_2D */
+    OUT_BATCH(vf2); /* number of coordinate sets */
     OUT_BATCH(S3_CULLMODE_NONE | S3_VERTEXHAS_XY);
     OUT_BATCH(S8_ENABLE_COLOR_BLEND | S8_BLENDFUNC_ADD | pI830->s8_blendctl |
 	      S8_ENABLE_COLOR_BUFFER_WRITE);
 
     OUT_BATCH(_3DSTATE_INDPT_ALPHA_BLEND_CMD | DISABLE_INDPT_ALPHA_BLEND);
-    OUT_BATCH(0);
 
     OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
 	      LOAD_TEXTURE_BLEND_STAGE(0)|1);
     OUT_BATCH(pI830->cblend);
     OUT_BATCH(pI830->ablend);
-    OUT_BATCH(0);
 
     OUT_BATCH(_3DSTATE_ENABLES_1_CMD | DISABLE_LOGIC_OP |
 	      DISABLE_STENCIL_TEST | DISABLE_DEPTH_BIAS |
@@ -593,6 +598,19 @@ i830_emit_composite_state(ScrnInfoPtr pScrn)
 	      DISABLE_STENCIL_WRITE | ENABLE_TEX_CACHE |
 	      DISABLE_DITHER | ENABLE_COLOR_WRITE |
 	      DISABLE_DEPTH_WRITE);
+
+    if (i830_transform_is_affine(pI830->render_src_picture->transform))
+	texcoordfmt |= (TEXCOORDFMT_2D << 0);
+    else
+	texcoordfmt |= (TEXCOORDFMT_3D << 0);
+    if (pI830->render_mask) {
+	if (i830_transform_is_affine(pI830->render_mask_picture->transform))
+	    texcoordfmt |= (TEXCOORDFMT_2D << 2);
+	else
+	    texcoordfmt |= (TEXCOORDFMT_3D << 2);
+    }
+    OUT_BATCH(_3DSTATE_VERTEX_FORMAT_2_CMD | texcoordfmt);
+
     ADVANCE_BATCH();
 
     i830_texture_setup(pI830->render_src_picture, pI830->render_src, 0);
@@ -665,7 +683,7 @@ i830_emit_composite_primitive(PixmapPtr pDst,
 						     &src_w[2]))
 		return;
 
-	    per_vertex += 4;    /* src x/y/z/w */
+	    per_vertex += 3;    /* src x/y/w */
 	}
     }
 
@@ -713,7 +731,7 @@ i830_emit_composite_primitive(PixmapPtr pDst,
 						     &mask_w[2]))
 		return;
 
-	    per_vertex += 4;	/* mask x/y/z/w */
+	    per_vertex += 3;	/* mask x/y/w */
 	}
     }
 
@@ -727,14 +745,12 @@ i830_emit_composite_primitive(PixmapPtr pDst,
     OUT_BATCH_F(src_x[2] / pI830->scale_units[0][0]);
     OUT_BATCH_F(src_y[2] / pI830->scale_units[0][1]);
     if (!is_affine_src) {
-	OUT_BATCH_F(0.0);
 	OUT_BATCH_F(src_w[2]);
     }
     if (pI830->render_mask) {
 	OUT_BATCH_F(mask_x[2] / pI830->scale_units[1][0]);
 	OUT_BATCH_F(mask_y[2] / pI830->scale_units[1][1]);
 	if (!is_affine_mask) {
-	    OUT_BATCH_F(0.0);
 	    OUT_BATCH_F(mask_w[2]);
 	}
     }
@@ -744,14 +760,12 @@ i830_emit_composite_primitive(PixmapPtr pDst,
     OUT_BATCH_F(src_x[1] / pI830->scale_units[0][0]);
     OUT_BATCH_F(src_y[1] / pI830->scale_units[0][1]);
     if (!is_affine_src) {
-	OUT_BATCH_F(0.0);
 	OUT_BATCH_F(src_w[1]);
     }
     if (pI830->render_mask) {
 	OUT_BATCH_F(mask_x[1] / pI830->scale_units[1][0]);
 	OUT_BATCH_F(mask_y[1] / pI830->scale_units[1][1]);
 	if (!is_affine_mask) {
-	    OUT_BATCH_F(0.0);
 	    OUT_BATCH_F(mask_w[1]);
 	}
     }
@@ -761,14 +775,12 @@ i830_emit_composite_primitive(PixmapPtr pDst,
     OUT_BATCH_F(src_x[0] / pI830->scale_units[0][0]);
     OUT_BATCH_F(src_y[0] / pI830->scale_units[0][1]);
     if (!is_affine_src) {
-	OUT_BATCH_F(0.0);
 	OUT_BATCH_F(src_w[0]);
     }
     if (pI830->render_mask) {
 	OUT_BATCH_F(mask_x[0] / pI830->scale_units[1][0]);
 	OUT_BATCH_F(mask_y[0] / pI830->scale_units[1][1]);
 	if (!is_affine_mask) {
-	    OUT_BATCH_F(0.0);
 	    OUT_BATCH_F(mask_w[0]);
 	}
     }
commit 00e8de212b46a243f243b437b7eb866315ab89b3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Sep 21 22:14:21 2009 +0100

    Check the correct Picture for error during creation.

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 8eee6a6..4850185 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -361,7 +361,7 @@ uxa_picture_from_a1_pixman_image (ScreenPtr pScreen,
 			  PictureMatchFormat (pScreen, 1, PICT_a1),
 			  0, 0, serverClient, &error);
     FreeScratchPixmapHeader (pPixmap);
-    if (!pPicture) {
+    if (!pSrc) {
 	FreePicture (pPicture, 0);
 	return 0;
     }


More information about the xorg-commit mailing list