xf86-video-intel: Branch 'exa' - 3 commits - src/i830_3d.c src/i830_exa_render.c src/i830_reg.h
Zhenyu Wang
zhen at kemper.freedesktop.org
Thu Jul 20 10:07:42 PDT 2006
src/i830_3d.c | 10 ++
src/i830_exa_render.c | 168 +++++++++++++++++---------------------------------
src/i830_reg.h | 16 ++++
3 files changed, 83 insertions(+), 111 deletions(-)
New commits:
diff-tree 4737955a62c39177e7a7ce7749a2f20e111afc68 (from a7e30bb051bc03063fe699473610a57054a64973)
Author: Wang Zhenyu <zhenyu.z.wang at intel.com>
Date: Fri Jul 21 01:02:38 2006 +0800
move i830 default coord set into I830EmitInvarientState
diff --git a/src/i830_3d.c b/src/i830_3d.c
index 0efd6e4..214beb6 100644
--- a/src/i830_3d.c
+++ b/src/i830_3d.c
@@ -33,13 +33,11 @@
#include "i830_reg.h"
-#define CMD_3D (0x3<<29)
-
void I830EmitInvarientState( ScrnInfoPtr pScrn )
{
I830Ptr pI830 = I830PTR(pScrn);
- BEGIN_LP_RING(38);
+ BEGIN_LP_RING(40);
OUT_RING(_3DSTATE_MAP_CUBE | MAP_UNIT(0));
OUT_RING(_3DSTATE_MAP_CUBE | MAP_UNIT(1));
@@ -98,6 +96,12 @@ void I830EmitInvarientState( ScrnInfoPtr
OUT_RING(_3DSTATE_MAP_COORD_TRANSFORM);
OUT_RING(DISABLE_TEX_TRANSFORM | TEXTURE_SET(3));
+ OUT_RING(_3DSTATE_MAP_COORD_SETBIND_CMD);
+ OUT_RING(TEXBIND_SET3(TEXCOORDSRC_VTXSET_3) |
+ TEXBIND_SET2(TEXCOORDSRC_VTXSET_2) |
+ TEXBIND_SET1(TEXCOORDSRC_VTXSET_1) |
+ TEXBIND_SET0(TEXCOORDSRC_VTXSET_0));
+
OUT_RING(_3DSTATE_RASTER_RULES_CMD |
ENABLE_POINT_RASTER_RULE |
OGL_POINT_RASTER_RULE |
diff --git a/src/i830_exa_render.c b/src/i830_exa_render.c
index f51e6a4..7a22e7d 100644
--- a/src/i830_exa_render.c
+++ b/src/i830_exa_render.c
@@ -365,25 +365,6 @@ I830EXACheckComposite(int op, PicturePtr
return TRUE;
}
-
-static void
-I830DefCtxSetup(ScrnInfoPtr pScrn)
-{
- /* coord binding */
- CARD32 mcb;
- I830Ptr pI830 = I830PTR(pScrn);
-
- BEGIN_LP_RING(2);
- OUT_RING(_3DSTATE_MAP_COORD_SETBIND_CMD);
- mcb = TEXBIND_SET3(TEXCOORDSRC_VTXSET_3);
- mcb |= TEXBIND_SET2(TEXCOORDSRC_VTXSET_2);
- mcb |= TEXBIND_SET1(TEXCOORDSRC_VTXSET_1);
- mcb |= TEXBIND_SET0(TEXCOORDSRC_VTXSET_0);
- OUT_RING(mcb);
- ADVANCE_LP_RING();
-}
-
-
Bool
I830EXAPrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture,
@@ -400,8 +381,6 @@ I830EXAPrepareComposite(int op, PictureP
draw_coords[2][0] = pDst->drawable.x;
draw_coords[2][1] = pDst->drawable.y;
- I830DefCtxSetup(pScrn);
-
if (!I830TextureSetup(pSrcPicture, pSrc, 0))
I830FALLBACK("fail to setup src texture\n");
if (pMask != NULL) {
diff-tree a7e30bb051bc03063fe699473610a57054a64973 (from ac34a37cb60d763cbd99b6e2f6fdcb639592b99b)
Author: Wang Zhenyu <zhenyu.z.wang at intel.com>
Date: Fri Jul 21 00:56:58 2006 +0800
Take from i915, blend ctl code cleanup.
diff --git a/src/i830_exa_render.c b/src/i830_exa_render.c
index cd5e69c..f51e6a4 100644
--- a/src/i830_exa_render.c
+++ b/src/i830_exa_render.c
@@ -31,7 +31,8 @@ extern PictTransform *transform[2];
struct blendinfo {
Bool dst_alpha;
Bool src_alpha;
- CARD32 blend_cntl;
+ CARD32 src_blend;
+ CARD32 dst_blend;
};
struct formatinfo {
@@ -48,41 +49,6 @@ I830EXAPrepareComposite(int op, PictureP
PicturePtr pMaskPicture, PicturePtr pDstPicture,
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst);
-/* I830's Blend factor definition, LOAD_STATE_IMMEDIATE_1 */
-/* move to header...*/
-#define I830_SRC_BLENDFACTOR_ZERO (1 << 4)
-#define I830_SRC_BLENDFACTOR_ONE (2 << 4)
-#define I830_SRC_BLENDFACTOR_SRC_COLOR (3 << 4)
-#define I830_SRC_BLENDFACTOR_INV_SRC_COLOR (4 << 4)
-#define I830_SRC_BLENDFACTOR_SRC_ALPHA (5 << 4)
-#define I830_SRC_BLENDFACTOR_INV_SRC_ALPHA (6 << 4)
-#define I830_SRC_BLENDFACTOR_DST_ALPHA (7 << 4)
-#define I830_SRC_BLENDFACTOR_INV_DST_ALPHA (8 << 4)
-#define I830_SRC_BLENDFACTOR_DST_COLOR (9 << 4)
-#define I830_SRC_BLENDFACTOR_INV_DST_COLOR (0xa << 4)
-#define I830_SRC_BLENDFACTOR_SRC_ALPHA_SATURATE (0xb << 4)
-#define I830_SRC_BLENDFACTOR_CONST_COLOR (0xc << 4)
-#define I830_SRC_BLENDFACTOR_INV_CONST_COLOR (0xd << 4)
-#define I830_SRC_BLENDFACTOR_CONST_ALPHA (0xe << 4)
-#define I830_SRC_BLENDFACTOR_INV_CONST_ALPHA (0xf << 4)
-#define I830_SRC_BLENDFACTOR_MASK (0xf << 4)
-
-#define I830_DST_BLENDFACTOR_ZERO (1)
-#define I830_DST_BLENDFACTOR_ONE (2)
-#define I830_DST_BLENDFACTOR_SRC_COLOR (3)
-#define I830_DST_BLENDFACTOR_INV_SRC_COLOR (4)
-#define I830_DST_BLENDFACTOR_SRC_ALPHA (5)
-#define I830_DST_BLENDFACTOR_INV_SRC_ALPHA (6)
-#define I830_DST_BLENDFACTOR_DST_ALPHA (7)
-#define I830_DST_BLENDFACTOR_INV_DST_ALPHA (8)
-#define I830_DST_BLENDFACTOR_DST_COLOR (9)
-#define I830_DST_BLENDFACTOR_INV_DST_COLOR (0xa)
-#define I830_DST_BLENDFACTOR_SRC_ALPHA_SATURATE (0xb)
-#define I830_DST_BLENDFACTOR_CONST_COLOR (0xc)
-#define I830_DST_BLENDFACTOR_INV_CONST_COLOR (0xd)
-#define I830_DST_BLENDFACTOR_CONST_ALPHA (0xe)
-#define I830_DST_BLENDFACTOR_INV_CONST_ALPHA (0xf)
-#define I830_DST_BLENDFACTOR_MASK (0xf)
#define TB0C_LAST_STAGE (1 << 31)
#define TB0C_RESULT_SCALE_1X (0 << 29)
@@ -132,38 +98,34 @@ I830EXAPrepareComposite(int op, PictureP
#define TB0A_ARG1_SEL_TEXEL1 (7 << 6)
#define TB0A_ARG1_SEL_TEXEL2 (8 << 6)
#define TB0A_ARG1_SEL_TEXEL3 (9 << 6)
-#define TB0A_ARG0_SEL_XXX
-
-/* end */
-
static struct blendinfo I830BlendOp[] = {
/* Clear */
- {0, 0, I830_SRC_BLENDFACTOR_ZERO | I830_DST_BLENDFACTOR_ZERO},
+ {0, 0, BLENDFACTOR_ZERO, BLENDFACTOR_ZERO},
/* Src */
- {0, 0, I830_SRC_BLENDFACTOR_ONE | I830_DST_BLENDFACTOR_ZERO},
+ {0, 0, BLENDFACTOR_ONE, BLENDFACTOR_ZERO},
/* Dst */
- {0, 0, I830_SRC_BLENDFACTOR_ZERO | I830_DST_BLENDFACTOR_ONE},
+ {0, 0, BLENDFACTOR_ZERO, BLENDFACTOR_ONE},
/* Over */
- {0, 1, I830_SRC_BLENDFACTOR_ONE | I830_DST_BLENDFACTOR_INV_SRC_ALPHA},
+ {0, 1, BLENDFACTOR_ONE, BLENDFACTOR_INV_SRC_ALPHA},
/* OverReverse */
- {1, 0, I830_SRC_BLENDFACTOR_INV_DST_ALPHA | I830_DST_BLENDFACTOR_ONE},
+ {1, 0, BLENDFACTOR_INV_DST_ALPHA, BLENDFACTOR_ONE},
/* In */
- {1, 0, I830_SRC_BLENDFACTOR_DST_ALPHA | I830_DST_BLENDFACTOR_ZERO},
+ {1, 0, BLENDFACTOR_DST_ALPHA, BLENDFACTOR_ZERO},
/* InReverse */
- {0, 1, I830_SRC_BLENDFACTOR_ZERO | I830_DST_BLENDFACTOR_SRC_ALPHA},
+ {0, 1, BLENDFACTOR_ZERO, BLENDFACTOR_SRC_ALPHA},
/* Out */
- {1, 0, I830_SRC_BLENDFACTOR_INV_DST_ALPHA | I830_DST_BLENDFACTOR_ZERO},
+ {1, 0, BLENDFACTOR_INV_DST_ALPHA, BLENDFACTOR_ZERO},
/* OutReverse */
- {0, 1, I830_SRC_BLENDFACTOR_ZERO | I830_DST_BLENDFACTOR_INV_SRC_ALPHA},
+ {0, 1, BLENDFACTOR_ZERO, BLENDFACTOR_INV_SRC_ALPHA},
/* Atop */
- {1, 1, I830_SRC_BLENDFACTOR_DST_ALPHA | I830_DST_BLENDFACTOR_INV_SRC_ALPHA},
+ {1, 1, BLENDFACTOR_DST_ALPHA, BLENDFACTOR_INV_SRC_ALPHA},
/* AtopReverse */
- {1, 1, I830_SRC_BLENDFACTOR_INV_DST_ALPHA | I830_DST_BLENDFACTOR_SRC_ALPHA},
+ {1, 1, BLENDFACTOR_INV_DST_ALPHA, BLENDFACTOR_SRC_ALPHA},
/* Xor */
- {1, 1, I830_SRC_BLENDFACTOR_INV_DST_ALPHA | I830_DST_BLENDFACTOR_INV_SRC_ALPHA},
+ {1, 1, BLENDFACTOR_INV_DST_ALPHA, BLENDFACTOR_INV_SRC_ALPHA},
/* Add */
- {0, 0, I830_SRC_BLENDFACTOR_ONE | I830_DST_BLENDFACTOR_ONE},
+ {0, 0, BLENDFACTOR_ONE, BLENDFACTOR_ONE},
};
@@ -213,17 +175,17 @@ static CARD32 I830GetBlendCntl(int op, P
{
CARD32 sblend, dblend;
- sblend = I830BlendOp[op].blend_cntl & I830_SRC_BLENDFACTOR_MASK;
- dblend = I830BlendOp[op].blend_cntl & I830_DST_BLENDFACTOR_MASK;
+ sblend = I830BlendOp[op].src_blend;
+ dblend = I830BlendOp[op].dst_blend;
/* If there's no dst alpha channel, adjust the blend op so that we'll treat
* it as always 1.
*/
if (PICT_FORMAT_A(dst_format) == 0 && I830BlendOp[op].dst_alpha) {
- if (sblend == I830_SRC_BLENDFACTOR_DST_ALPHA)
- sblend = I830_SRC_BLENDFACTOR_ONE;
- else if (sblend == I830_SRC_BLENDFACTOR_INV_DST_ALPHA)
- sblend = I830_SRC_BLENDFACTOR_ZERO;
+ if (sblend == BLENDFACTOR_DST_ALPHA)
+ sblend = BLENDFACTOR_ONE;
+ else if (sblend == BLENDFACTOR_INV_DST_ALPHA)
+ sblend = BLENDFACTOR_ZERO;
}
/* If the source alpha is being used, then we should only be in a case where
@@ -231,14 +193,15 @@ static CARD32 I830GetBlendCntl(int op, P
* channels multiplied by the source picture's alpha.
*/
if (pMask && pMask->componentAlpha && I830BlendOp[op].src_alpha) {
- if (dblend == I830_DST_BLENDFACTOR_SRC_ALPHA) {
- dblend = I830_DST_BLENDFACTOR_SRC_COLOR;
- } else if (dblend == I830_DST_BLENDFACTOR_INV_SRC_ALPHA) {
- dblend = I830_DST_BLENDFACTOR_INV_SRC_COLOR;
+ if (dblend == BLENDFACTOR_SRC_ALPHA) {
+ dblend = BLENDFACTOR_SRC_COLR;
+ } else if (dblend == BLENDFACTOR_INV_SRC_ALPHA) {
+ dblend = BLENDFACTOR_INV_SRC_COLR;
}
}
- return sblend | dblend;
+ return (sblend << S8_SRC_BLEND_FACTOR_SHIFT) |
+ (dblend << S8_DST_BLEND_FACTOR_SHIFT);
}
static Bool I830CheckCompositeTexture(PicturePtr pPict, int unit)
@@ -386,8 +349,7 @@ I830EXACheckComposite(int op, PicturePtr
* source value that we get to blend with.
*/
if (I830BlendOp[op].src_alpha &&
- (I830BlendOp[op].blend_cntl & I830_SRC_BLENDFACTOR_MASK) !=
- I830_SRC_BLENDFACTOR_ZERO)
+ (I830BlendOp[op].src_blend != BLENDFACTOR_ZERO))
I830FALLBACK("Component alpha not supported with source "
"alpha and source value blending.\n");
}
diff --git a/src/i830_reg.h b/src/i830_reg.h
index ae68a2e..f9c1df9 100644
--- a/src/i830_reg.h
+++ b/src/i830_reg.h
@@ -221,6 +221,22 @@
#define ENABLE_DST_ABLEND_FACTOR (1<<5)
#define DST_ABLEND_FACT(x) (x)
+#define BLENDFACTOR_ZERO 0x01
+#define BLENDFACTOR_ONE 0x02
+#define BLENDFACTOR_SRC_COLR 0x03
+#define BLENDFACTOR_INV_SRC_COLR 0x04
+#define BLENDFACTOR_SRC_ALPHA 0x05
+#define BLENDFACTOR_INV_SRC_ALPHA 0x06
+#define BLENDFACTOR_DST_ALPHA 0x07
+#define BLENDFACTOR_INV_DST_ALPHA 0x08
+#define BLENDFACTOR_DST_COLR 0x09
+#define BLENDFACTOR_INV_DST_COLR 0x0a
+#define BLENDFACTOR_SRC_ALPHA_SATURATE 0x0b
+#define BLENDFACTOR_CONST_COLOR 0x0c
+#define BLENDFACTOR_INV_CONST_COLOR 0x0d
+#define BLENDFACTOR_CONST_ALPHA 0x0e
+#define BLENDFACTOR_INV_CONST_ALPHA 0x0f
+#define BLENDFACTOR_MASK 0x0f
/* _3DSTATE_MAP_BLEND_ARG, p152 */
#define _3DSTATE_MAP_BLEND_ARG_CMD(stage) (CMD_3D|(0x0e<<24)|((stage)<<20))
diff-tree ac34a37cb60d763cbd99b6e2f6fdcb639592b99b (from 3e86bf4273241daa23645f5a8104913e4205a74b)
Author: Wang Zhenyu <zhenyu.z.wang at intel.com>
Date: Fri Jul 21 00:52:59 2006 +0800
Take instruction fixes into i830, with indent changes.
diff --git a/src/i830_exa_render.c b/src/i830_exa_render.c
index 9b4835b..cd5e69c 100644
--- a/src/i830_exa_render.c
+++ b/src/i830_exa_render.c
@@ -315,9 +315,9 @@ I830TextureSetup(PicturePtr pPict, Pixma
}
{
- if (pI830->cpp == 1)
+ if (pPix->drawable.bitsPerPixel == 8)
format |= MAP_SURFACE_8BIT;
- else if (pI830->cpp == 2)
+ else if (pPix->drawable.bitsPerPixel == 16)
format |= MAP_SURFACE_16BIT;
else
format |= MAP_SURFACE_32BIT;
@@ -325,9 +325,10 @@ I830TextureSetup(PicturePtr pPict, Pixma
BEGIN_LP_RING(6);
OUT_RING(_3DSTATE_MAP_INFO_CMD);
OUT_RING(format | TEXMAP_INDEX(unit) | MAP_FORMAT_2D);
- OUT_RING((pPix->drawable.height<<16)|pPix->drawable.width); /* height, width */
- OUT_RING(offset<<2); /* map address */
- OUT_RING(pitch<<2); /* map pitch */
+ OUT_RING(((pPix->drawable.height - 1) << 16) |
+ (pPix->drawable.width - 1)); /* height, width */
+ OUT_RING(offset); /* map address */
+ OUT_RING(((pitch / 4) - 1) << 2); /* map pitch */
OUT_RING(0);
ADVANCE_LP_RING();
}
@@ -336,8 +337,9 @@ I830TextureSetup(PicturePtr pPict, Pixma
BEGIN_LP_RING(2);
/* coord sets */
OUT_RING(_3DSTATE_MAP_COORD_SET_CMD | TEXCOORD_SET(unit) |
- ENABLE_TEXCOORD_PARAMS | TEXCOORDS_ARE_NORMAL | /*XXX, check this, and fix vertex tex coord*/
- TEXCOORDTYPE_CARTESIAN | ENABLE_ADDR_V_CNTL | TEXCOORD_ADDR_V_MODE(wrap_mode) |
+ ENABLE_TEXCOORD_PARAMS | TEXCOORDS_ARE_NORMAL |
+ TEXCOORDTYPE_CARTESIAN | ENABLE_ADDR_V_CNTL |
+ TEXCOORD_ADDR_V_MODE(wrap_mode) |
ENABLE_ADDR_U_CNTL | TEXCOORD_ADDR_U_MODE(wrap_mode));
OUT_RING(MI_NOOP);
@@ -453,7 +455,7 @@ I830EXAPrepareComposite(int op, PictureP
CARD32 cblend, ablend, blendctl, vf2;
- BEGIN_LP_RING(22);
+ BEGIN_LP_RING(22+6);
/*color buffer*/
OUT_RING(_3DSTATE_BUF_INFO_CMD);
@@ -464,6 +466,8 @@ I830EXAPrepareComposite(int op, PictureP
OUT_RING(_3DSTATE_DST_BUF_VARS_CMD);
OUT_RING(dst_format);
+ OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE);
+ OUT_RING(MI_NOOP); /* pad to quadword */
/* defaults */
OUT_RING(_3DSTATE_DFLT_Z_CMD);
OUT_RING(0);
@@ -474,18 +478,19 @@ I830EXAPrepareComposite(int op, PictureP
OUT_RING(_3DSTATE_DFLT_SPEC_CMD);
OUT_RING(0);
- OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1|I1_LOAD_S(3)|0);
- OUT_RING((1<<S3_POINT_WIDTH_SHIFT) | (2<<S3_LINE_WIDTH_SHIFT) | S3_CULLMODE_NONE| S3_VERTEXHAS_XY);
- OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1|I1_LOAD_S(2)|0);
+ OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | 0);
+ OUT_RING((1 << S3_POINT_WIDTH_SHIFT) | (2 << S3_LINE_WIDTH_SHIFT) |
+ S3_CULLMODE_NONE | S3_VERTEXHAS_XY);
+ OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(2) | 0);
if (pMask)
- vf2 = 2 << 12; /* 2 texture coord sets */
+ vf2 = 2 << 12; /* 2 texture coord sets */
else
- vf2 = 1 << 12;
+ vf2 = 1 << 12;
vf2 |= (TEXCOORDFMT_2D << 16);
if (pMask)
- vf2 |= (TEXCOORDFMT_2D << 18);
+ vf2 |= (TEXCOORDFMT_2D << 18);
else
- vf2 |= (TEXCOORDFMT_1D << 18);
+ vf2 |= (TEXCOORDFMT_1D << 18);
vf2 |= (TEXCOORDFMT_1D << 20);
vf2 |= (TEXCOORDFMT_1D << 22);
@@ -495,21 +500,24 @@ I830EXAPrepareComposite(int op, PictureP
vf2 |= (TEXCOORDFMT_1D << 30);
OUT_RING(vf2);
+ OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE);
+ OUT_RING(MI_NOOP); /* pad to quadword */
/* For (src In mask) operation */
/* IN operator: Multiply src by mask components or mask alpha.*/
/* TEXBLENDOP_MODULE: arg1*arg2 */
cblend = TB0C_LAST_STAGE | TB0C_RESULT_SCALE_1X | TB0C_OP_MODULE |
TB0C_OUTPUT_WRITE_CURRENT;
- ablend = TB0A_RESULT_SCALE_1X | TB0A_OP_MODULE | TB0A_OUTPUT_WRITE_CURRENT;
+ ablend = TB0A_RESULT_SCALE_1X | TB0A_OP_MODULE |
+ TB0A_OUTPUT_WRITE_CURRENT;
cblend |= TB0C_ARG1_SEL_TEXEL0;
ablend |= TB0A_ARG1_SEL_TEXEL0;
if (pMask) {
- if (pMaskPicture->componentAlpha && pDstPicture->format != PICT_a8)
- cblend |= TB0C_ARG2_SEL_TEXEL1;
- else
- cblend |= (TB0C_ARG2_SEL_TEXEL1 | TB0C_ARG2_REPLICATE_ALPHA);
- ablend |= TB0A_ARG2_SEL_TEXEL1;
+ if (pMaskPicture->componentAlpha && pDstPicture->format != PICT_a8)
+ cblend |= TB0C_ARG2_SEL_TEXEL1;
+ else
+ cblend |= (TB0C_ARG2_SEL_TEXEL1 | TB0C_ARG2_REPLICATE_ALPHA);
+ ablend |= TB0A_ARG2_SEL_TEXEL1;
} else {
cblend |= TB0C_ARG2_SEL_ONE;
ablend |= TB0A_ARG2_SEL_ONE;
@@ -520,6 +528,9 @@ I830EXAPrepareComposite(int op, PictureP
OUT_RING(ablend);
OUT_RING(0);
+ OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE);
+ OUT_RING(MI_NOOP); /* pad to quadword */
+
blendctl = I830GetBlendCntl(op, pMaskPicture, pDstPicture->format);
OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(8) | 0);
OUT_RING(S8_ENABLE_COLOR_BLEND | S8_BLENDFUNC_ADD |(blendctl<<4) |
More information about the xorg-commit
mailing list