diff options
author | Wang Zhenyu <zhenyu.z.wang@intel.com> | 2006-07-18 17:00:50 +0800 |
---|---|---|
committer | Wang Zhenyu <zhenyu.z.wang@intel.com> | 2006-07-18 17:00:50 +0800 |
commit | 433cb6ba82698676f6f72e09834aba4d64611d54 (patch) | |
tree | 2fa959ab23f35c860536c344a5be55fde3ceaff8 | |
parent | 855a9f13cb7fd4f6c489ff280bf389475bbd9bbe (diff) |
Fix several size error with STATE3D_LOAD_STATE_IMMEDIATE cmd.
Issue texture coord set with proper scale value.
-rw-r--r-- | src/i830_exa.c | 58 | ||||
-rw-r--r-- | src/i915_exa_render.c | 6 |
2 files changed, 36 insertions, 28 deletions
diff --git a/src/i830_exa.c b/src/i830_exa.c index 40f68683..3975e6df 100644 --- a/src/i830_exa.c +++ b/src/i830_exa.c @@ -55,7 +55,7 @@ do { \ } while(0) #endif -float scale_units[2][2]; +float scale_units[3][2]; int draw_coords[3][2]; const int I830CopyROP[16] = @@ -101,7 +101,7 @@ const int I830PatternROP[16] = /* move to common.h */ union intfloat { float f; - unsigned int ui; + CARD32 ui; }; #define OUT_RING_F(x) do { \ @@ -429,6 +429,7 @@ IntelEXAComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, int srcXend, srcYend, maskXend, maskYend; PictVector v; int pMask = 1; + float src_scale_x, src_scale_y, mask_scale_x, mask_scale_y; 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" @@ -483,9 +484,14 @@ IntelEXAComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, draw_coords[0][0] -= draw_coords[2][0]; draw_coords[0][1] -= draw_coords[2][1]; + src_scale_x = (float)scale_units[0][0] / (float)scale_units[2][0]; + src_scale_y = (float)scale_units[0][1] / (float)scale_units[2][1]; + if (pMask) { draw_coords[1][0] -= draw_coords[2][0]; draw_coords[1][1] -= draw_coords[2][1]; + mask_scale_x = (float)scale_units[1][0] / (float)scale_units[2][0]; + mask_scale_y = (float)scale_units[1][1] / (float)scale_units[2][1]; } { @@ -506,40 +512,40 @@ IntelEXAComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, OUT_RING(PRIM3D_INLINE | PRIM3D_TRIFAN | (vertex_count-1)); - OUT_RING(dstX); - OUT_RING(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(dstX); + OUT_RING_F(dstY); + OUT_RING_F(((srcX - draw_coords[0][0]) * src_scale_x)); + OUT_RING_F(((srcY - draw_coords[0][1]) * src_scale_y)); 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 - draw_coords[1][0]) * mask_scale_x)); + OUT_RING_F(((maskY - draw_coords[1][1]) * mask_scale_y)); } - OUT_RING(dstX); - OUT_RING((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(dstX); + OUT_RING_F((dstY+h)); + OUT_RING_F(((srcX - draw_coords[0][0]) * src_scale_x)); + OUT_RING_F(((srcYend - draw_coords[0][1]) * src_scale_y)); 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 - draw_coords[1][0]) * mask_scale_x)); + OUT_RING_F(((maskYend - draw_coords[1][1]) * mask_scale_y)); } - OUT_RING((dstX+w)); - OUT_RING((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 - draw_coords[0][0]) * src_scale_x)); + OUT_RING_F(((srcYend - draw_coords[0][1]) * src_scale_y)); 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 - draw_coords[1][0]) * mask_scale_x)); + OUT_RING_F(((maskYend - draw_coords[1][1]) * mask_scale_y)); } - OUT_RING((dstX+w)); - OUT_RING((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 - draw_coords[0][0]) * src_scale_x)); + OUT_RING_F(((srcY - draw_coords[0][1]) * src_scale_y)); 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 - draw_coords[1][0]) * mask_scale_x)); + OUT_RING_F(((maskY - draw_coords[1][1]) * mask_scale_y)); } ADVANCE_LP_RING(); } diff --git a/src/i915_exa_render.c b/src/i915_exa_render.c index acec69f3..60b8125e 100644 --- a/src/i915_exa_render.c +++ b/src/i915_exa_render.c @@ -408,6 +408,8 @@ ErrorF("i915 prepareComposite\n"); 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; I915DefCtxSetup(pScrn); @@ -446,7 +448,7 @@ ErrorF("i915 prepareComposite\n"); /* 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)|1); + I1_LOAD_S(4)|3); ss2 = S2_TEXCOORD_FMT(0, TEXCOORDFMT_2D); if (pMask) ss2 |= S2_TEXCOORD_FMT(1, TEXCOORDFMT_2D); @@ -538,7 +540,7 @@ ErrorF("i915 prepareComposite\n"); blendctl = I915GetBlendCntl(op, pMaskPicture, pDstPicture->format); BEGIN_LP_RING(2); - OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(6) | 0); + OUT_RING(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(6) | 1); ss6 = S6_CBUF_BLEND_ENABLE | S6_COLOR_WRITE_ENABLE; OUT_RING(ss6 | (0 << S6_CBUF_BLEND_FUNC_SHIFT) | blendctl); ADVANCE_LP_RING(); |