xf86-video-intel: Branch 'exa' - 6 commits - src/i830_exa.c src/i830_exa_render.c src/i915_exa_render.c

Eric Anholt anholt at kemper.freedesktop.org
Thu Jul 20 15:41:03 PDT 2006


 src/i830_exa.c        |   69 +++++++++++++++++++++-----------------------------
 src/i830_exa_render.c |    7 -----
 src/i915_exa_render.c |   55 ++++++++++++++++++---------------------
 3 files changed, 56 insertions(+), 75 deletions(-)

New commits:
diff-tree 914327f40d07a3f7c069752ce005bf8e21352b03 (from 45cb032e2b7ac1e4c765fc29a2e4dd0cef19066d)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Thu Jul 20 17:58:07 2006 -0400

    Disable drawing to PICT_a8, and turn on support for non-extended repeats.
    
    We don't know what COLOR_BUF_8BIT does, so it's disabled for now while we're
    stabilizing the code.
    
    The non-extended repeats appear to be working according to the rendercheck
    tests on a8 and a8r8g8b8 sources.  Masks continue to hang the card, as before
    this change.

diff --git a/src/i915_exa_render.c b/src/i915_exa_render.c
index 795c076..36e6c80 100644
--- a/src/i915_exa_render.c
+++ b/src/i915_exa_render.c
@@ -138,9 +138,16 @@ static Bool I915GetDestFormat(PicturePtr
     case PICT_x1r5g5b5:
         *dst_format = COLR_BUF_ARGB1555;
         break;
+    /* COLR_BUF_8BIT is special for YUV surfaces.  While we may end up being
+     * able to use it depending on how the hardware implements it, disable it
+     * for now while we don't know what exactly it does (what channel does it
+     * read from?
+     */
+    /*
     case PICT_a8:
         *dst_format = COLR_BUF_8BIT;
         break;
+    */
     case PICT_a4r4g4b4:
     case PICT_x4r4g4b4:
 	*dst_format = COLR_BUF_ARGB4444;
@@ -171,9 +178,9 @@ static Bool I915CheckCompositeTexture(Pi
         I830FALLBACK("Unsupported picture format 0x%x\n",
                          (int)pPict->format);
 
-    /* FIXME: fix repeat support */
-    if (pPict->repeat) 
-	I830FALLBACK("repeat not support now!\n");
+    if (pPict->repeat && pPict->repeatType != RepeatNormal)
+	I830FALLBACK("extended repeat (%d) not supported\n",
+		     pPict->repeatType);
 
     if (pPict->filter != PictFilterNearest &&
         pPict->filter != PictFilterBilinear)
diff-tree 45cb032e2b7ac1e4c765fc29a2e4dd0cef19066d (from fd6d825ae0780f3daf436f4224bf5f177cb8630e)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Thu Jul 20 17:34:50 2006 -0400

    Use MT_8BIT_A8 so PICT_a8 expands to (0,0,0,a) not (a,a,a,a)

diff --git a/src/i915_exa_render.c b/src/i915_exa_render.c
index a063d8f..795c076 100644
--- a/src/i915_exa_render.c
+++ b/src/i915_exa_render.c
@@ -88,7 +88,7 @@ static struct formatinfo I915TexFormats[
         {PICT_r5g6b5,   MT_16BIT_RGB565   },
         {PICT_a1r5g5b5, MT_16BIT_ARGB1555 },
         {PICT_x1r5g5b5, MT_16BIT_ARGB1555 },
-        {PICT_a8,       MT_8BIT_I8 	  },
+        {PICT_a8,       MT_8BIT_A8 	  },
 };
 
 static CARD32 I915GetBlendCntl(int op, PicturePtr pMask, CARD32 dst_format)
diff-tree fd6d825ae0780f3daf436f4224bf5f177cb8630e (from d6d6a44c66446f34b57394e5ea9a8e32917f7569)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Thu Jul 20 17:25:31 2006 -0400

    Move ss6 setting with other immediate state, and ensure that stencil is off.

diff --git a/src/i915_exa_render.c b/src/i915_exa_render.c
index deeac4a..a063d8f 100644
--- a/src/i915_exa_render.c
+++ b/src/i915_exa_render.c
@@ -348,7 +348,7 @@ ErrorF("i915 prepareComposite\n");
     {
 	CARD32 ss2;
 
-	BEGIN_LP_RING(24);
+	BEGIN_LP_RING(26);
 	/*color buffer*/
 	OUT_RING(_3DSTATE_BUF_INFO_CMD);
 	OUT_RING(BUF_3D_ID_COLOR_BACK| BUF_3D_PITCH(dst_pitch)); /* fence, tile? */
@@ -369,8 +369,8 @@ ErrorF("i915 prepareComposite\n");
 	OUT_RING(0);
 	
 	/* XXX:S3? define vertex format with tex coord sets number*/
-	OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(2) |
-		 I1_LOAD_S(3) | I1_LOAD_S(4) | 2);
+	OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(2) | 
+		 I1_LOAD_S(3) | I1_LOAD_S(4) | I1_LOAD_S(5) | I1_LOAD_S(6) | 4);
 	ss2 = S2_TEXCOORD_FMT(0, TEXCOORDFMT_2D);
 	if (pMask)
 		ss2 |= S2_TEXCOORD_FMT(1, TEXCOORDFMT_2D);
@@ -383,9 +383,13 @@ ErrorF("i915 prepareComposite\n");
 	ss2 |= S2_TEXCOORD_FMT(6, TEXCOORDFMT_NOT_PRESENT);
 	ss2 |= S2_TEXCOORD_FMT(7, TEXCOORDFMT_NOT_PRESENT);
 	OUT_RING(ss2);
-	OUT_RING(0x00000000); /*XXX: does ss3 needed? */
+	OUT_RING(0x00000000); /* Disable texture coordinate wrap-shortest */
 	OUT_RING((1<<S4_POINT_WIDTH_SHIFT)|S4_LINE_WIDTH_ONE| 
 		S4_CULLMODE_NONE| S4_VFMT_XY);  
+	blendctl = I915GetBlendCntl(op, pMaskPicture, pDstPicture->format);
+	OUT_RING(0x00000000); /* Disable stencil buffer */
+	OUT_RING(S6_CBUF_BLEND_ENABLE | S6_COLOR_WRITE_ENABLE |
+		 (BLENDFUNC_ADD << S6_CBUF_BLEND_FUNC_SHIFT) | blendctl);
 
 	/* issue a flush */
 	OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE);
@@ -445,17 +449,6 @@ ErrorF("i915 prepareComposite\n");
     }
     FS_END();
 
-    {
-	CARD32 ss6;
-	blendctl = I915GetBlendCntl(op, pMaskPicture, pDstPicture->format);
-
-	BEGIN_LP_RING(2);
-	OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(6) | 0);
-	ss6 = S6_CBUF_BLEND_ENABLE | S6_COLOR_WRITE_ENABLE;
-	OUT_RING(ss6 | (0 << S6_CBUF_BLEND_FUNC_SHIFT) | blendctl);
-	ADVANCE_LP_RING();
-    }
-
 #ifdef I830DEBUG
     ErrorF("try to sync to show any errors...");
     I830Sync(pScrn);
diff-tree d6d6a44c66446f34b57394e5ea9a8e32917f7569 (from 2b2173c618c080b1678990d65fe49b52bd8001b4)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Thu Jul 20 11:23:05 2006 -0400

    Try to fix up the basic RepeatNormal and RepeatNone support.
    
    With RepeatNone, access outside of the drawable should return 0 alpha values,
    which is done by using the border color.  For RepeatNormal, we use the wrap
    mode (which requires that we use normalized texture coordinates).

diff --git a/src/i915_exa_render.c b/src/i915_exa_render.c
index 6246136..deeac4a 100644
--- a/src/i915_exa_render.c
+++ b/src/i915_exa_render.c
@@ -221,7 +221,7 @@ I915TextureSetup(PicturePtr pPict, Pixma
     I830Ptr pI830 = I830PTR(pScrn);
     CARD32 format, offset, pitch, filter;
     int w, h, i;
-    CARD32 wrap_mode = TEXCOORDMODE_CLAMP_EDGE; 
+    CARD32 wrap_mode = TEXCOORDMODE_CLAMP_BORDER;
 
     offset = exaGetPixmapOffset(pPix);
     pitch = exaGetPixmapPitch(pPix);
@@ -239,8 +239,8 @@ I915TextureSetup(PicturePtr pPict, Pixma
     format = I915TexFormats[i].card_fmt;
 
     if (pPict->repeat) 
-	wrap_mode = TEXCOORDMODE_WRAP; /* XXX:correct ? */
-    
+	wrap_mode = TEXCOORDMODE_WRAP;
+
     switch (pPict->filter) {
     case PictFilterNearest:
         filter = (FILTER_NEAREST << SS2_MAG_FILTER_SHIFT) | 
@@ -289,12 +289,12 @@ I915TextureSetup(PicturePtr pPict, Pixma
 	ss2 |= filter;
 	OUT_RING(ss2);
 	/* repeat? */
-	ss3 = TEXCOORDMODE_WRAP << SS3_TCX_ADDR_MODE_SHIFT;
-	ss3 |= (TEXCOORDMODE_WRAP << SS3_TCY_ADDR_MODE_SHIFT);
+	ss3 = wrap_mode << SS3_TCX_ADDR_MODE_SHIFT;
+	ss3 |= wrap_mode << SS3_TCY_ADDR_MODE_SHIFT;
 	ss3 |= SS3_NORMALIZED_COORDS;
 	ss3 |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT);
 	OUT_RING(ss3);
-	OUT_RING(0x00000000); /* default color */
+	OUT_RING(0x00000000); /* border color */
 	OUT_RING(0);
 
 	ADVANCE_LP_RING();
diff-tree 2b2173c618c080b1678990d65fe49b52bd8001b4 (from 9f1cec83e0aef36c7d3482e62e8f01595f1fd076)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Thu Jul 20 11:15:18 2006 -0400

    The pixmap's drawable x/y coordinates are always 0, so don't bother using them.

diff --git a/src/i830_exa.c b/src/i830_exa.c
index f7c79c2..de12c33 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -56,7 +56,6 @@ do { 							\
 #endif
 
 float scale_units[2][2];
-int draw_coords[3][2];
 
 const int I830CopyROP[16] =
 {
@@ -431,13 +430,12 @@ IntelEXAComposite(PixmapPtr pDst, int sr
     int pMask = 1;
 
     DPRINTF(PFX, "Composite: srcX %d, srcY %d\n\t maskX %d, maskY %d\n\t"
-	     "dstX %d, dstY %d\n\twidth %d, height %d\n\t"
-	     "src_scale_x %f, src_scale_y %f, mask_scale_x %f, mask_scale_y %f\n""\tdx0 %d, dy0 %x, dx1 %d dy1 %x\n", 
-		srcX, srcY, maskX, maskY, dstX, dstY, w, h,
-		scale_units[0][0], scale_units[0][1], 
-		scale_units[1][0], scale_units[1][1],
-		draw_coords[0][0], draw_coords[0][1], 
-		draw_coords[1][0], draw_coords[1][1]);
+	    "dstX %d, dstY %d\n\twidth %d, height %d\n\t"
+	    "src_scale_x %f, src_scale_y %f, "
+	    "mask_scale_x %f, mask_scale_y %f\n",
+	    srcX, srcY, maskX, maskY, dstX, dstY, w, h,
+	    scale_units[0][0], scale_units[0][1],
+	    scale_units[1][0], scale_units[1][1]);
 
     if (scale_units[1][0] == -1 || scale_units[1][1] == -1) {
 	ErrorF("mask is null\n");
@@ -481,13 +479,6 @@ IntelEXAComposite(PixmapPtr pDst, int sr
 		"dstX %d, dstY %d\n", srcX, srcY, srcXend, srcYend,
 		maskX, maskY, maskXend, maskYend, dstX, dstY);
 
-    draw_coords[0][0] -= draw_coords[2][0];
-    draw_coords[0][1] -= draw_coords[2][1];
-    if (pMask) {
-	draw_coords[1][0] -= draw_coords[2][0];
-	draw_coords[1][1] -= draw_coords[2][1];
-    }
-
     {
 	int vertex_count; 
 
@@ -508,38 +499,38 @@ IntelEXAComposite(PixmapPtr pDst, int sr
 
 	OUT_RING_F(dstX);
 	OUT_RING_F(dstY);
-	OUT_RING_F(((srcX - draw_coords[0][0]) / scale_units[0][0]));
-	OUT_RING_F(((srcY - draw_coords[0][1]) / scale_units[0][1]));
+	OUT_RING_F(srcX / scale_units[0][0]);
+	OUT_RING_F(srcY / scale_units[0][1]);
 	if (pMask) {
-		OUT_RING_F(((maskX - draw_coords[1][0]) / scale_units[1][0]));
-		OUT_RING_F(((maskY - draw_coords[1][1]) / scale_units[1][1]));
+		OUT_RING_F(maskX / scale_units[1][0]);
+		OUT_RING_F(maskY / scale_units[1][1]);
 	}
 
 	OUT_RING_F(dstX);
-	OUT_RING_F((dstY+h));
-	OUT_RING_F(((srcX - draw_coords[0][0]) / scale_units[0][0]));
-	OUT_RING_F(((srcYend - draw_coords[0][1]) / scale_units[0][1]));
+	OUT_RING_F(dstY + h);
+	OUT_RING_F(srcX / scale_units[0][0]);
+	OUT_RING_F(srcYend / scale_units[0][1]);
 	if (pMask) {
-		OUT_RING_F(((maskX - draw_coords[1][0]) / scale_units[1][0]));
-		OUT_RING_F(((maskYend - draw_coords[1][1]) / scale_units[1][1]));
+		OUT_RING_F(maskX / scale_units[1][0]);
+		OUT_RING_F(maskYend / scale_units[1][1]);
 	}
 
-	OUT_RING_F((dstX+w));
-	OUT_RING_F((dstY+h));
-	OUT_RING_F(((srcXend - draw_coords[0][0]) / scale_units[0][0]));
-	OUT_RING_F(((srcYend - draw_coords[0][1]) / scale_units[0][1]));
+	OUT_RING_F(dstX + w);
+	OUT_RING_F(dstY + h);
+	OUT_RING_F(srcXend / scale_units[0][0]);
+	OUT_RING_F(srcYend / scale_units[0][1]);
 	if (pMask) {
-		OUT_RING_F(((maskXend - draw_coords[1][0]) / scale_units[1][0]));
-		OUT_RING_F(((maskYend - draw_coords[1][1]) / scale_units[1][1]));
+		OUT_RING_F(maskXend / scale_units[1][0]);
+		OUT_RING_F(maskYend / scale_units[1][1]);
 	}
 
-	OUT_RING_F((dstX+w));
-	OUT_RING_F((dstY));
-	OUT_RING_F(((srcXend - draw_coords[0][0]) / scale_units[0][0]));
-	OUT_RING_F(((srcY - draw_coords[0][1]) / scale_units[0][1]));
+	OUT_RING_F(dstX + w);
+	OUT_RING_F(dstY);
+	OUT_RING_F(srcXend / scale_units[0][0]);
+	OUT_RING_F(srcY / scale_units[0][1]);
 	if (pMask) {
-		OUT_RING_F(((maskXend - draw_coords[1][0]) / scale_units[1][0]));
-		OUT_RING_F(((maskY - draw_coords[1][1]) / scale_units[1][1]));
+		OUT_RING_F(maskXend / scale_units[1][0]);
+		OUT_RING_F(maskY / scale_units[1][1]);
 	}
 	ADVANCE_LP_RING();
     }
diff --git a/src/i830_exa_render.c b/src/i830_exa_render.c
index 7a22e7d..23a3c43 100644
--- a/src/i830_exa_render.c
+++ b/src/i830_exa_render.c
@@ -24,7 +24,6 @@ do { 							\
 #endif
 
 extern float scale_units[2][2];
-extern int draw_coords[3][2];
 extern Bool is_transform[2];
 extern PictTransform *transform[2];
 
@@ -249,8 +248,6 @@ I830TextureSetup(PicturePtr pPict, Pixma
     h = pPict->pDrawable->height;
     scale_units[unit][0] = pPix->drawable.width;
     scale_units[unit][1] = pPix->drawable.height;
-    draw_coords[unit][0] = pPix->drawable.x;
-    draw_coords[unit][1] = pPix->drawable.y;
 
     for (i = 0; i < sizeof(I830TexFormats) / sizeof(I830TexFormats[0]); i++) {
         if (I830TexFormats[i].fmt == pPict->format)
@@ -378,9 +375,7 @@ I830EXAPrepareComposite(int op, PictureP
     I830GetDestFormat(pDstPicture, &dst_format);
     dst_offset = exaGetPixmapOffset(pDst);
     dst_pitch = exaGetPixmapPitch(pDst);
-    draw_coords[2][0] = pDst->drawable.x;
-    draw_coords[2][1] = pDst->drawable.y;
-    
+
     if (!I830TextureSetup(pSrcPicture, pSrc, 0))
 	I830FALLBACK("fail to setup src texture\n");
     if (pMask != NULL) {
diff --git a/src/i915_exa_render.c b/src/i915_exa_render.c
index ba54d53..6246136 100644
--- a/src/i915_exa_render.c
+++ b/src/i915_exa_render.c
@@ -27,7 +27,6 @@ do { 							\
 #endif
 
 extern float scale_units[2][2];
-extern int draw_coords[3][2];
 extern Bool is_transform[2];
 extern PictTransform *transform[2];
 
@@ -230,8 +229,6 @@ I915TextureSetup(PicturePtr pPict, Pixma
     h = pPict->pDrawable->height;
     scale_units[unit][0] = pPix->drawable.width;
     scale_units[unit][1] = pPix->drawable.height;
-    draw_coords[unit][0] = pPix->drawable.x;
-    draw_coords[unit][1] = pPix->drawable.y;
 
     for (i = 0; i < sizeof(I915TexFormats) / sizeof(I915TexFormats[0]); i++) {
         if (I915TexFormats[i].fmt == pPict->format)
@@ -333,8 +330,6 @@ ErrorF("i915 prepareComposite\n");
     I915GetDestFormat(pDstPicture, &dst_format);
     dst_offset = exaGetPixmapOffset(pDst);
     dst_pitch = exaGetPixmapPitch(pDst);
-    draw_coords[2][0] = pDst->drawable.x;
-    draw_coords[2][1] = pDst->drawable.y;
     scale_units[2][0] = pDst->drawable.width;
     scale_units[2][1] = pDst->drawable.height;
     FS_LOCALS(20);
diff-tree 9f1cec83e0aef36c7d3482e62e8f01595f1fd076 (from 4737955a62c39177e7a7ce7749a2f20e111afc68)
Author: Eric Anholt <anholt at FreeBSD.org>
Date:   Thu Jul 20 11:05:49 2006 -0400

    The vertex data are all floats, so write the dest coords as floats.

diff --git a/src/i830_exa.c b/src/i830_exa.c
index 40f6868..f7c79c2 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -506,8 +506,8 @@ IntelEXAComposite(PixmapPtr pDst, int sr
 
 	OUT_RING(PRIM3D_INLINE | PRIM3D_TRIFAN | (vertex_count-1));
 
-	OUT_RING(dstX);
-	OUT_RING(dstY);
+	OUT_RING_F(dstX);
+	OUT_RING_F(dstY);
 	OUT_RING_F(((srcX - draw_coords[0][0]) / scale_units[0][0]));
 	OUT_RING_F(((srcY - draw_coords[0][1]) / scale_units[0][1]));
 	if (pMask) {
@@ -515,8 +515,8 @@ IntelEXAComposite(PixmapPtr pDst, int sr
 		OUT_RING_F(((maskY - draw_coords[1][1]) / scale_units[1][1]));
 	}
 
-	OUT_RING(dstX);
-	OUT_RING((dstY+h));
+	OUT_RING_F(dstX);
+	OUT_RING_F((dstY+h));
 	OUT_RING_F(((srcX - draw_coords[0][0]) / scale_units[0][0]));
 	OUT_RING_F(((srcYend - draw_coords[0][1]) / scale_units[0][1]));
 	if (pMask) {
@@ -524,8 +524,8 @@ IntelEXAComposite(PixmapPtr pDst, int sr
 		OUT_RING_F(((maskYend - draw_coords[1][1]) / scale_units[1][1]));
 	}
 
-	OUT_RING((dstX+w));
-	OUT_RING((dstY+h));
+	OUT_RING_F((dstX+w));
+	OUT_RING_F((dstY+h));
 	OUT_RING_F(((srcXend - draw_coords[0][0]) / scale_units[0][0]));
 	OUT_RING_F(((srcYend - draw_coords[0][1]) / scale_units[0][1]));
 	if (pMask) {
@@ -533,8 +533,8 @@ IntelEXAComposite(PixmapPtr pDst, int sr
 		OUT_RING_F(((maskYend - draw_coords[1][1]) / scale_units[1][1]));
 	}
 
-	OUT_RING((dstX+w));
-	OUT_RING((dstY));
+	OUT_RING_F((dstX+w));
+	OUT_RING_F((dstY));
 	OUT_RING_F(((srcXend - draw_coords[0][0]) / scale_units[0][0]));
 	OUT_RING_F(((srcY - draw_coords[0][1]) / scale_units[0][1]));
 	if (pMask) {



More information about the xorg-commit mailing list