diff options
author | Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> | 2007-05-15 14:57:14 -0400 |
---|---|---|
committer | Soren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com> | 2007-05-15 14:57:14 -0400 |
commit | 3da842bf930d7875599ca0c06cb4a09cfa987ac5 (patch) | |
tree | 03b27367870baaabe16438f6c01f8bec815cc9b8 /fb | |
parent | 1568b6b6a0d7337f29c7b87cc46ae64b3b0f8fdf (diff) |
Revert various fast path functions to their pre-pixman-merge state
since they fail rendercheck. Remove their associated macros.
See bug 10903.
Diffstat (limited to 'fb')
-rw-r--r-- | fb/fbpict.c | 551 |
1 files changed, 36 insertions, 515 deletions
diff --git a/fb/fbpict.c b/fb/fbpict.c index 7d94d00a2..1146e99ca 100644 --- a/fb/fbpict.c +++ b/fb/fbpict.c @@ -78,64 +78,6 @@ fbIn (CARD32 x, CARD8 y) return m|n|o|p; } -#define genericCombine24(a,b,c,d) (((a)*(c)+(b)*(d))) - -/* - * This macro does src IN mask OVER dst when src and dst are 0888. - * If src has alpha, this will not work - */ -#define inOver0888(alpha, source, destval, dest) { \ - CARD32 dstrb=destval&0xFF00FF; CARD32 dstag=(destval>>8)&0xFF00FF; \ - CARD32 drb=((source&0xFF00FF)-dstrb)*alpha; CARD32 dag=(((source>>8)&0xFF00FF)-dstag)*alpha; \ - WRITE(dest, ((((drb>>8) + dstrb) & 0x00FF00FF) | ((((dag>>8) + dstag) << 8) & 0xFF00FF00))); \ - } - -/* - * This macro does src IN mask OVER dst when src and dst are 0565 and - * mask is a 5-bit alpha value. Again, if src has alpha, this will not - * work. - */ -#define inOver0565(alpha, source, destval, dest) { \ - CARD16 dstrb = destval & 0xf81f; CARD16 dstg = destval & 0x7e0; \ - CARD32 drb = ((source&0xf81f)-dstrb)*alpha; CARD32 dg=((source & 0x7e0)-dstg)*alpha; \ - WRITE(dest, ((((drb>>5) + dstrb)&0xf81f) | (((dg>>5) + dstg) & 0x7e0))); \ - } - - -#define inOver2x0565(alpha, source, destval, dest) { \ - CARD32 dstrb = destval & 0x07e0f81f; CARD32 dstg = (destval & 0xf81f07e0)>>5; \ - CARD32 drb = ((source&0x07e0f81f)-dstrb)*alpha; CARD32 dg=(((source & 0xf81f07e0)>>5)-dstg)*alpha; \ - WRITE(dest, ((((drb>>5) + dstrb)&0x07e0f81f) | ((((dg>>5) + dstg)<<5) & 0xf81f07e0))); \ - } - - -#if IMAGE_BYTE_ORDER == LSBFirst -#define setupPackedReader(count,temp,where,workingWhere,workingVal) count=(long)where; \ - temp=count&3; \ - where-=temp; \ - workingWhere=(CARD32 *)where; \ - workingVal=READ(workingWhere++); \ - count=4-temp; \ - workingVal>>=(8*temp) - #define readPacked(where,x,y,z) {if(!(x)) { (x)=4; y = READ(z++); } where=(y)&0xff; (y)>>=8; (x)--;} - #define readPackedSource(where) readPacked(where,ws,workingSource,wsrc) - #define readPackedDest(where) readPacked(where,wd,workingiDest,widst) - #define writePacked(what) workingoDest>>=8; workingoDest|=(what<<24); ww--; if(!ww) { ww=4; WRITE (wodst++, workingoDest); } -#else - #warning "I havn't tested fbCompositeTrans_0888xnx0888() on big endian yet!" - #define setupPackedReader(count,temp,where,workingWhere,workingVal) count=(long)where; \ - temp=count&3; \ - where-=temp; \ - workingWhere=(CARD32 *)where; \ - workingVal=READ(workingWhere++); \ - count=4-temp; \ - workingVal<<=(8*temp) - #define readPacked(where,x,y,z) {if(!(x)) { (x)=4; y = READ(z++); } where=(y)>>24; (y)<<=8; (x)--;} - #define readPackedSource(where) readPacked(where,ws,workingSource,wsrc) - #define readPackedDest(where) readPacked(where,wd,workingiDest,widst) - #define writePacked(what) workingoDest<<=8; workingoDest|=what; ww--; if(!ww) { ww=4; WRITE(wodst++, workingoDest); } -#endif - /* * Naming convention: * @@ -279,7 +221,6 @@ fbCompositeSolidMask_nx8888x8888C (CARD8 op, fbFinishAccess (pDst->pDrawable); } -#define srcAlphaCombine24(a,b) genericCombine24(a,b,srca,srcia) void fbCompositeSolidMask_nx8x0888 (CARD8 op, PicturePtr pSrc, @@ -294,86 +235,53 @@ fbCompositeSolidMask_nx8x0888 (CARD8 op, CARD16 width, CARD16 height) { - CARD32 src, srca, srcia; - CARD8 *dstLine, *dst, *edst; + CARD32 src, srca; + CARD8 *dstLine, *dst; + CARD32 d; CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; CARD16 w; - CARD32 rs,gs,bs,rd,gd,bd; fbComposeGetSolid(pSrc, src, pDst->format); srca = src >> 24; - srcia = 255-srca; if (src == 0) return; - rs=src&0xff; - gs=(src>>8)&0xff; - bs=(src>>16)&0xff; - fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { - /* fixme: cleanup unused */ - unsigned long wt, wd; - CARD32 workingiDest; - CARD32 *widst; - - edst = dst = dstLine; + dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; - -#ifndef NO_MASKED_PACKED_READ - setupPackedReader(wd,wt,edst,widst,workingiDest); -#endif - + while (w--) { -#ifndef NO_MASKED_PACKED_READ - readPackedDest(rd); - readPackedDest(gd); - readPackedDest(bd); -#else - rd = READ(edst++); - gd = READ(edst++); - bd = READ(edst++); -#endif m = READ(mask++); if (m == 0xff) { if (srca == 0xff) - { - WRITE(dst++, rs); - WRITE(dst++, gs); - WRITE(dst++, bs); - } + d = src; else { - WRITE(dst++, (srcAlphaCombine24(rs, rd)>>8)); - WRITE(dst++, (srcAlphaCombine24(gs, gd)>>8)); - WRITE(dst++, (srcAlphaCombine24(bs, bd)>>8)); + d = Fetch24(dst); + d = fbOver24 (src, d); } + Store24(dst,d); } else if (m) { - int na=(srca*(int)m)>>8; - int nia=255-na; - WRITE(dst++, (genericCombine24(rs, rd, na, nia)>>8)); - WRITE(dst++, (genericCombine24(gs, gd, na, nia)>>8)); - WRITE(dst++, (genericCombine24(bs, bd, na, nia)>>8)); - } - else - { - dst+=3; + d = fbOver24 (fbIn(src,m), Fetch24(dst)); + Store24(dst,d); } + dst += 3; } } - + fbFinishAccess (pMask->pDrawable); fbFinishAccess (pDst->pDrawable); } @@ -392,105 +300,21 @@ fbCompositeSolidMask_nx8x0565 (CARD8 op, CARD16 width, CARD16 height) { - CARD32 src, srca8, srca5; + CARD32 src, srca; CARD16 *dstLine, *dst; - CARD16 d; - CARD32 t; + CARD32 d; CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; - CARD16 w,src16; - - fbComposeGetSolid(pSrc, src, pDst->format); - - if (src == 0) - return; - - srca8 = (src >> 24); - srca5 = (srca8 >> 3); - src16 = cvt8888to0565(src); - - fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - m = READ(mask++); - if (m == 0) - dst++; - else if (srca5 == (0xff >> 3)) - { - if (m == 0xff) - WRITE(dst++, src16); - else - { - d = READ(dst); - m >>= 3; - inOver0565 (m, src16, d, dst++); - } - } - else - { - d = READ(dst); - if (m == 0xff) - { - t = fbOver24 (src, cvt0565to0888 (d)); - } - else - { - t = fbIn (src, m); - t = fbOver (t, cvt0565to0888 (d)); - } - WRITE(dst++, cvt8888to0565 (t)); - } - } - } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); -} - -static void -fbCompositeSolidMask_nx8888x0565 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD32 src, srca8, srca5; - CARD16 *dstLine, *dst; - CARD16 d; - CARD32 *maskLine, *mask; - CARD32 t; - CARD8 m; - FbStride dstStride, maskStride; - CARD16 w, src16; + CARD16 w; fbComposeGetSolid(pSrc, src, pDst->format); + srca = src >> 24; if (src == 0) return; - srca8 = src >> 24; - srca5 = srca8 >> 3; - src16 = cvt8888to0565(src); - fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { @@ -502,38 +326,30 @@ fbCompositeSolidMask_nx8888x0565 (CARD8 op, while (w--) { - m = READ(mask++) >> 24; - if (m == 0) - dst++; - else if (srca5 == (0xff >> 3)) + m = READ(mask++); + if (m == 0xff) { - if (m == 0xff) - WRITE(dst++, src16); + if (srca == 0xff) + d = src; else { d = READ(dst); - m >>= 3; - inOver0565 (m, src16, d, dst++); + d = fbOver24 (src, cvt0565to0888(d)); } + WRITE(dst, cvt8888to0565(d)); } - else + else if (m) { - if (m == 0xff) - { - d = READ(dst); - t = fbOver24 (src, cvt0565to0888 (d)); - WRITE(dst++, cvt8888to0565 (t)); - } - else - { - d = READ(dst); - t = fbIn (src, m); - t = fbOver (t, cvt0565to0888 (d)); - WRITE(dst++, cvt8888to0565 (t)); - } + d = READ(dst); + d = fbOver24 (fbIn(src,m), cvt0565to0888(d)); + WRITE(dst, cvt8888to0565(d)); } + dst++; } } + + fbFinishAccess (pMask->pDrawable); + fbFinishAccess (pDst->pDrawable); } void @@ -1060,295 +876,6 @@ fbCompositeSrcSrc_nxn (CARD8 op, CARD16 width, CARD16 height); -static void -fbCompositeTrans_0565xnx0565(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD16 *dstLine, *dst; - CARD16 *srcLine, *src; - FbStride dstStride, srcStride; - CARD16 w; - FbBits mask; - CARD8 maskAlpha; - CARD16 s_16, d_16; - CARD32 s_32, d_32; - - fbComposeGetSolid (pMask, mask, pDst->format); - maskAlpha = mask >> 27; - - if (!maskAlpha) - return; - if (maskAlpha == 0xff) - { - fbCompositeSrcSrc_nxn (PictOpSrc, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height); - return; - } - - fbComposeGetStart (pSrc, xSrc, ySrc, CARD16, srcStride, srcLine, 1); - fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); - - while (height--) - { - CARD32 *isrc, *idst; - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - if(((long)src&1)==1) - { - s_16 = READ(src++); - d_16 = READ(dst); - inOver0565(maskAlpha, s_16, d_16, dst++); - w--; - } - isrc=(CARD32 *)src; - if(((long)dst&1)==0) - { - idst=(CARD32 *)dst; - while (w>1) - { - s_32 = READ(isrc++); - d_32 = READ(idst); - inOver2x0565(maskAlpha, s_32, d_32, idst++); - w-=2; - } - dst=(CARD16 *)idst; - } - else - { - while (w > 1) - { - s_32 = READ(isrc++); -#if IMAGE_BYTE_ORDER == LSBFirst - s_16=s_32&0xffff; -#else - s_16=s_32>>16; -#endif - d_16 = READ(dst); - inOver0565 (maskAlpha, s_16, d_16, dst++); -#if IMAGE_BYTE_ORDER == LSBFirst - s_16=s_32>>16; -#else - s_16=s_32&0xffff; -#endif - d_16 = READ(dst); - inOver0565(maskAlpha, s_16, d_16, dst++); - w-=2; - } - } - src=(CARD16 *)isrc; - if(w!=0) - { - s_16 = READ(src); - d_16 = READ(dst); - inOver0565(maskAlpha, s_16, d_16, dst); - } - } - - fbFinishAccess (pSrc->pDrawable); - fbFinishAccess (pDst->pDrawable); -} - -/* macros for "i can't believe it's not fast" packed pixel handling */ -#define alphamaskCombine24(a,b) genericCombine24(a,b,maskAlpha,maskiAlpha) - -static void -fbCompositeTrans_0888xnx0888(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD8 *dstLine, *dst,*idst; - CARD8 *srcLine, *src; - FbStride dstStride, srcStride; - CARD16 w; - FbBits mask; - CARD16 maskAlpha,maskiAlpha; - - fbComposeGetSolid (pMask, mask, pDst->format); - maskAlpha = mask >> 24; - maskiAlpha= 255-maskAlpha; - - if (!maskAlpha) - return; - /* - if (maskAlpha == 0xff) - { - fbCompositeSrc_0888x0888 (op, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height); - return; - } - */ - - fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 3); - fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); - - { - unsigned long ws,wt; - CARD32 workingSource; - CARD32 *wsrc, *wdst, *widst; - CARD32 rs, rd, nd; - CARD8 *isrc; - - - /* are xSrc and xDst at the same alignment? if not, we need to be complicated :) */ - /* if(0==0) */ - if ((((xSrc * 3) & 3) != ((xDst * 3) & 3)) || - ((srcStride & 3) != (dstStride & 3))) - { - while (height--) - { - dst = dstLine; - dstLine += dstStride; - isrc = src = srcLine; - srcLine += srcStride; - w = width*3; - - setupPackedReader(ws,wt,isrc,wsrc,workingSource); - - /* get to word aligned */ - switch(~(long)dst&3) - { - case 1: - readPackedSource(rs); - /* *dst++=alphamaskCombine24(rs, *dst)>>8; */ - rd = READ(dst); /* make gcc happy. hope it doens't cost us too much performance*/ - WRITE(dst++, alphamaskCombine24(rs, rd) >> 8); - w--; if(w==0) break; - case 2: - readPackedSource(rs); - rd = READ(dst); - WRITE(dst++, alphamaskCombine24(rs, rd) >> 8); - w--; if(w==0) break; - case 3: - readPackedSource(rs); - rd = READ(dst); - WRITE(dst++,alphamaskCombine24(rs, rd) >> 8); - w--; if(w==0) break; - } - wdst=(CARD32 *)dst; - while (w>3) - { - rs=READ(wsrc++); - /* FIXME: write a special readPackedWord macro, which knows how to - * halfword combine - */ -#if IMAGE_BYTE_ORDER == LSBFirst - rd=READ(wdst); - readPackedSource(nd); - readPackedSource(rs); - nd|=rs<<8; - readPackedSource(rs); - nd|=rs<<16; - readPackedSource(rs); - nd|=rs<<24; -#else - readPackedSource(nd); - nd<<=24; - readPackedSource(rs); - nd|=rs<<16; - readPackedSource(rs); - nd|=rs<<8; - readPackedSource(rs); - nd|=rs; -#endif - inOver0888(maskAlpha, nd, rd, wdst++); - w-=4; - } - src=(CARD8 *)wdst; - switch(w) - { - case 3: - readPackedSource(rs); - rd=READ(dst); - WRITE(dst++,alphamaskCombine24(rs, rd)>>8); - case 2: - readPackedSource(rs); - rd = READ(dst); - WRITE(dst++, alphamaskCombine24(rs, rd)>>8); - case 1: - readPackedSource(rs); - rd = READ(dst); - WRITE(dst++, alphamaskCombine24(rs, rd)>>8); - } - } - } - else - { - while (height--) - { - idst=dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width*3; - /* get to word aligned */ - switch(~(long)src&3) - { - case 1: - rd=alphamaskCombine24(READ(src++), READ(dst))>>8; - WRITE(dst++, rd); - w--; if(w==0) break; - case 2: - rd=alphamaskCombine24(READ(src++), READ(dst))>>8; - WRITE(dst++, rd); - w--; if(w==0) break; - case 3: - rd=alphamaskCombine24(READ(src++), READ(dst))>>8; - WRITE(dst++, rd); - w--; if(w==0) break; - } - wsrc=(CARD32 *)src; - widst=(CARD32 *)dst; - while(w>3) - { - rs = READ(wsrc++); - rd = READ(widst); - inOver0888 (maskAlpha, rs, rd, widst++); - w-=4; - } - src=(CARD8 *)wsrc; - dst=(CARD8 *)widst; - switch(w) - { - case 3: - rd=alphamaskCombine24(READ(src++), READ(dst))>>8; - WRITE(dst++, rd); - case 2: - rd=alphamaskCombine24(READ(src++), READ(dst))>>8; - WRITE(dst++, rd); - case 1: - rd=alphamaskCombine24(READ(src++), READ(dst))>>8; - WRITE(dst++, rd); - } - } - } - } -} - /* * Simple bitblt */ @@ -1687,6 +1214,7 @@ fbComposite (CARD8 op, break; } } +#if 0 else { switch (pDst->format) { @@ -1697,6 +1225,7 @@ fbComposite (CARD8 op, break; } } +#endif break; case PICT_a8b8g8r8: if (pMask->componentAlpha) { @@ -1722,6 +1251,7 @@ fbComposite (CARD8 op, break; } } +#if 0 else { switch (pDst->format) { @@ -1732,6 +1262,7 @@ fbComposite (CARD8 op, break; } } +#endif break; case PICT_a1: switch (pDst->format) { @@ -1833,16 +1364,6 @@ fbComposite (CARD8 op, pMask->pDrawable->height == 1) { switch (pSrc->format) { - case PICT_r5g6b5: - case PICT_b5g6r5: - if (pDst->format == pSrc->format) - func = fbCompositeTrans_0565xnx0565; - break; - case PICT_r8g8b8: - case PICT_b8g8r8: - if (pDst->format == pSrc->format) - func = fbCompositeTrans_0888xnx0888; - break; #ifdef USE_MMX case PICT_x8r8g8b8: if ((pDst->format == PICT_a8r8g8b8 || |