xserver/fb fbcompose.c, 1.20, 1.21 fbpict.c, 1.29, 1.30 fbpict.h, 1.16, 1.17

Eric Anholt xserver-commit at pdx.freedesktop.org
Thu May 13 14:09:32 PDT 2004


Committed by: anholt

Update of /cvs/xserver/xserver/fb
In directory pdx:/home/anholt/xserver/fb

Modified Files:
	fbcompose.c fbpict.c fbpict.h 
Log Message:
Fix problems in render fb implementation found by rendercheck:
- fbCombineSaturate was pointed at fbCombineDisjointOver, instead of
  fbCombineDisjointOverReverse as it should.  Instead, point
  fbCombineDisjointOverReverse at fbCombineSaturate (which is likely
  to be faster).
- fix previously-unused fbCombineSaturate implementation.
- fbCombineMaskAlphaC was just a copy of fbCombineMaskValueC.  Make
  it do what it's supposed to (return a cs.alpha).
- fbCombineAtopC didn't invert the source alpha value.
- fix copy'n'paste errors in fbCombine(Dis/Con)jointGeneralC, also
  source alpha wasn't treated in a component fashion.
- fbCompositeSrc_8888* didn't handle when the source lacks an alpha
  channel.  Rather than adding that and possilby slowing down the
  (normal) alpha case, don't let x8r8g8b8/x8b8g8r8 Pictures be used
  in fbCompositeSrc_8888* because Over with one of these is just Src.


Index: fbcompose.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbcompose.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- a/fbcompose.c	26 Feb 2004 05:33:21 -0000	1.20
+++ b/fbcompose.c	13 May 2004 21:09:30 -0000	1.21
@@ -193,15 +193,15 @@
     a = (*msk->fetcha) (msk);
     if (!a)
 	return 0;
-    
-    x = (*src->fetcha) (src);
-    if (a == 0xffffffff)
-	return x;
-    
-    m = FbInC(x,0,a,t);
-    n = FbInC(x,8,a,t);
-    o = FbInC(x,16,a,t);
-    p = FbInC(x,24,a,t);
+
+    x = (*src->fetch) (src) >> 24;
+    if (x == 0xff)
+	return a;
+
+    m = FbInU(a,0,x,t);
+    n = FbInU(a,8,x,t);
+    o = FbInU(a,16,x,t);
+    p = FbInU(a,24,x,t);
     return m|n|o|p;
 }
 
@@ -610,7 +610,7 @@
     cs = fbCombineMaskC (src, msk);
     d = (*dst->fetch) (dst);
     s = cs.value;
-    ad = cs.alpha;
+    ad = ~cs.alpha;
     as = d >> 24;
     m = FbGen(s,d,0,as,FbGet8(ad,0),t,u,v);
     n = FbGen(s,d,8,as,FbGet8(ad,8),t,u,v);
@@ -700,10 +700,10 @@
     s = cs.value;
     ad = ~cs.alpha;
     as = ~d >> 24;
-    m = FbGen(s,d,0,as,ad,t,u,v);
-    n = FbGen(s,d,8,as,ad,t,u,v);
-    o = FbGen(s,d,16,as,ad,t,u,v);
-    p = FbGen(s,d,24,as,ad,t,u,v);
+    m = FbGen(s,d,0,as,FbGet8(ad,0),t,u,v);
+    n = FbGen(s,d,8,as,FbGet8(ad,8),t,u,v);
+    o = FbGen(s,d,16,as,FbGet8(ad,16),t,u,v);
+    p = FbGen(s,d,24,as,FbGet8(ad,24),t,u,v);
     (*dst->store) (dst, m|n|o|p);
 }
 
@@ -765,10 +765,9 @@
 		    FbCompositeOperand   *dst)
 {
     CARD32  s = fbCombineMaskU (src, msk), d;
-#if 0
     CARD16  sa, da;
     CARD16  ad, as;
-    CARD16  t;
+    CARD16  t, u, v;
     CARD32  m,n,o,p;
     
     d = (*dst->fetch) (dst);
@@ -791,16 +790,6 @@
 	p = FbGen(s,d,24,as,ad,t,u,v);
     }
     (*dst->store) (dst, m|n|o|p);
-#else
-    if ((s >> 24) == 0xff)
-	(*dst->store) (dst, s);
-    else
-    {
-	d = (*dst->fetch) (dst);
-	if ((s >> 24) > (d >> 24))
-	    (*dst->store) (dst, s);
-    }
-#endif
 }
 
 void
@@ -833,7 +822,7 @@
     else
 	n = FbGen (s, d, 8, (da << 8) / sg, 0xff, t, u, v);
     
-    if (sr < da)
+    if (sr <= da)
 	o = FbAdd(s,d,16,t);
     else
 	o = FbGen (s, d, 16, (da << 8) / sr, 0xff, t, u, v);
@@ -974,8 +963,8 @@
     FbCompSrc	cs;
     CARD32  s, d;
     CARD32  m,n,o,p;
-    CARD32  Fa;
-    CARD16  Fb, t, u, v;
+    CARD32  Fa, Fb;
+    CARD16  t, u, v;
     CARD32  sa;
     CARD8   da;
 
@@ -998,10 +987,10 @@
 	Fa = m|n|o|p;
 	break;
     case CombineAIn:
-	m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da);
-	n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8;
-	o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16;
-	p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24;
+	m = fbCombineDisjointInPart ((CARD8) (sa >> 0), da);
+	n = fbCombineDisjointInPart ((CARD8) (sa >> 8), da) << 8;
+	o = fbCombineDisjointInPart ((CARD8) (sa >> 16), da) << 16;
+	p = fbCombineDisjointInPart ((CARD8) (sa >> 24), da) << 24;
 	Fa = m|n|o|p;
 	break;
     case CombineA:
@@ -1014,19 +1003,27 @@
 	Fb = 0;
 	break;
     case CombineBOut:
-	Fb = fbCombineDisjointOutPart (da, sa);
+	m = fbCombineDisjointOutPart (da, (CARD8) (sa >> 0));
+	n = fbCombineDisjointOutPart (da, (CARD8) (sa >> 8)) << 8;
+	o = fbCombineDisjointOutPart (da, (CARD8) (sa >> 16)) << 16;
+	p = fbCombineDisjointOutPart (da, (CARD8) (sa >> 24)) << 24;
+	Fb = m|n|o|p;
 	break;
     case CombineBIn:
-	Fb = fbCombineDisjointInPart (da, sa);
+	m = fbCombineDisjointInPart (da, (CARD8) (sa >> 0));
+	n = fbCombineDisjointInPart (da, (CARD8) (sa >> 8)) << 8;
+	o = fbCombineDisjointInPart (da, (CARD8) (sa >> 16)) << 16;
+	p = fbCombineDisjointInPart (da, (CARD8) (sa >> 24)) << 24;
+	Fb = m|n|o|p;
 	break;
     case CombineB:
-	Fb = 0xff;
+	Fb = 0xffffffff;
 	break;
     }
-    m = FbGen (s,d,0,FbGet8(Fa,0),Fb,t,u,v);
-    n = FbGen (s,d,8,FbGet8(Fa,8),Fb,t,u,v);
-    o = FbGen (s,d,16,FbGet8(Fa,16),Fb,t,u,v);
-    p = FbGen (s,d,24,FbGet8(Fa,24),Fb,t,u,v);
+    m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t,u,v);
+    n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t,u,v);
+    o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t,u,v);
+    p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t,u,v);
     s = m|n|o|p;
     (*dst->store) (dst, s);
 }
@@ -1067,21 +1064,6 @@
     fbCombineDisjointGeneralC (src, msk, dst, CombineAOver);
 }
 
-void
-fbCombineDisjointOverReverseU (FbCompositeOperand    *src,
-			       FbCompositeOperand    *msk,
-			       FbCompositeOperand    *dst)
-{
-    fbCombineDisjointGeneralU (src, msk, dst, CombineBOver);
-}
-
-void
-fbCombineDisjointOverReverseC (FbCompositeOperand    *src,
-			       FbCompositeOperand    *msk,
-			       FbCompositeOperand    *dst)
-{
-    fbCombineDisjointGeneralC (src, msk, dst, CombineBOver);
-}
 
 void
 fbCombineDisjointInU (FbCompositeOperand	    *src,
@@ -1283,8 +1265,8 @@
     FbCompSrc	cs;
     CARD32  s, d;
     CARD32  m,n,o,p;
-    CARD32  Fa;
-    CARD16  Fb, t, u, v;
+    CARD32  Fa, Fb;
+    CARD16  t, u, v;
     CARD32  sa;
     CARD8   da;
 
@@ -1307,10 +1289,10 @@
 	Fa = m|n|o|p;
 	break;
     case CombineAIn:
-	m = fbCombineConjointOutPart ((CARD8) (sa >> 0), da);
-	n = fbCombineConjointOutPart ((CARD8) (sa >> 8), da) << 8;
-	o = fbCombineConjointOutPart ((CARD8) (sa >> 16), da) << 16;
-	p = fbCombineConjointOutPart ((CARD8) (sa >> 24), da) << 24;
+	m = fbCombineConjointInPart ((CARD8) (sa >> 0), da);
+	n = fbCombineConjointInPart ((CARD8) (sa >> 8), da) << 8;
+	o = fbCombineConjointInPart ((CARD8) (sa >> 16), da) << 16;
+	p = fbCombineConjointInPart ((CARD8) (sa >> 24), da) << 24;
 	Fa = m|n|o|p;
 	break;
     case CombineA:
@@ -1323,19 +1305,27 @@
 	Fb = 0;
 	break;
     case CombineBOut:
-	Fb = fbCombineConjointOutPart (da, sa);
+	m = fbCombineConjointOutPart (da, (CARD8) (sa >> 0));
+	n = fbCombineConjointOutPart (da, (CARD8) (sa >> 8)) << 8;
+	o = fbCombineConjointOutPart (da, (CARD8) (sa >> 16)) << 16;
+	p = fbCombineConjointOutPart (da, (CARD8) (sa >> 24)) << 24;
+	Fb = m|n|o|p;
 	break;
     case CombineBIn:
-	Fb = fbCombineConjointInPart (da, sa);
+	m = fbCombineConjointInPart (da, (CARD8) (sa >> 0));
+	n = fbCombineConjointInPart (da, (CARD8) (sa >> 8)) << 8;
+	o = fbCombineConjointInPart (da, (CARD8) (sa >> 16)) << 16;
+	p = fbCombineConjointInPart (da, (CARD8) (sa >> 24)) << 24;
+	Fb = m|n|o|p;
 	break;
     case CombineB:
-	Fb = 0xff;
+	Fb = 0xffffffff;
 	break;
     }
-    m = FbGen (s,d,0,FbGet8(Fa,0),Fb,t,u,v);
-    n = FbGen (s,d,8,FbGet8(Fa,8),Fb,t,u,v);
-    o = FbGen (s,d,16,FbGet8(Fa,16),Fb,t,u,v);
-    p = FbGen (s,d,24,FbGet8(Fa,24),Fb,t,u,v);
+    m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t,u,v);
+    n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t,u,v);
+    o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t,u,v);
+    p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t,u,v);
     s = m|n|o|p;
     (*dst->store) (dst, s);
 }
@@ -1521,14 +1511,14 @@
     fbCombineAtopReverseU,
     fbCombineXorU,
     fbCombineAddU,
-    fbCombineDisjointOverU, /* Saturate */
+    fbCombineSaturateU,
     0,
     0,
     fbCombineClear,
     fbCombineSrcU,
     fbCombineDst,
     fbCombineDisjointOverU,
-    fbCombineDisjointOverReverseU,
+    fbCombineSaturateU, /* DisjointOverReverse */
     fbCombineDisjointInU,
     fbCombineDisjointInReverseU,
     fbCombineDisjointOutU,
@@ -1568,14 +1558,14 @@
     fbCombineAtopReverseC,
     fbCombineXorC,
     fbCombineAddC,
-    fbCombineDisjointOverC, /* Saturate */
+    fbCombineSaturateC,
     0,
     0,
     fbCombineClear,	    /* 0x10 */
     fbCombineSrcC,
     fbCombineDst,
     fbCombineDisjointOverC,
-    fbCombineDisjointOverReverseC,
+    fbCombineSaturateC, /* DisjointOverReverse */
     fbCombineDisjointInC,
     fbCombineDisjointInReverseC,
     fbCombineDisjointOutC,

Index: fbpict.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbpict.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- a/fbpict.c	15 Jan 2004 09:09:29 -0000	1.29
+++ b/fbpict.c	13 May 2004 21:09:30 -0000	1.30
@@ -1576,7 +1576,6 @@
 	    }
 	    else switch (pSrc->format) {
 	    case PICT_a8r8g8b8:
-	    case PICT_x8r8g8b8:
 		switch (pDst->format) {
 		case PICT_a8r8g8b8:
 		case PICT_x8r8g8b8:
@@ -1591,7 +1590,6 @@
 		}
 		break;
 	    case PICT_a8b8g8r8:
-	    case PICT_x8b8g8r8:
 		switch (pDst->format) {
 		case PICT_a8b8g8r8:
 		case PICT_x8b8g8r8:

Index: fbpict.h
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbpict.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- a/fbpict.h	15 Jan 2004 09:09:29 -0000	1.16
+++ b/fbpict.h	13 May 2004 21:09:30 -0000	1.17
@@ -333,15 +333,8 @@
 			FbCompositeOperand   *msk,
 			FbCompositeOperand   *dst);
 
-void
-fbCombineDisjointOverReverseU (FbCompositeOperand    *src,
-			       FbCompositeOperand    *msk,
-			       FbCompositeOperand    *dst);
-
-void
-fbCombineDisjointOverReverseC (FbCompositeOperand    *src,
-			       FbCompositeOperand    *msk,
-			       FbCompositeOperand    *dst);
+#define fbCombineDisjointOverReverseU fbCombineSaturateU
+#define fbCombineDisjointOverReverseC fbCombineSaturateC
 
 void
 fbCombineDisjointInU (FbCompositeOperand	    *src,




More information about the xserver-commit mailing list