xserver/fb fbmmx.c,1.9,1.10 fbpict.c,1.39,1.40

Billy Biggs xserver-commit at pdx.freedesktop.org
Tue Aug 16 16:34:21 PDT 2005


Committed by: vektor

Update of /cvs/xserver/xserver/fb
In directory gabe:/tmp/cvs-serv13649/fb

Modified Files:
	fbmmx.c fbpict.c 
Log Message:
	reviewed by: ssp, keithp

	* fb/fbmmx.c (pix_add_mul): Fix rounding errors.  If we don't
	have enough bits, the MMX instructions saturate anyway.
	(mmxCombineSaturateU): Shift the division result so that
	it gets correctly loaded as the alpha value.

	* fb/fbpict.c: (fbComposite): fbCompositeCopyAreammx is only
	implemented for 16 and 32 bits per pixel.



Index: fbmmx.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbmmx.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- fbmmx.c	12 Aug 2005 16:11:51 -0000	1.9
+++ fbmmx.c	16 Aug 2005 23:34:18 -0000	1.10
@@ -357,14 +357,12 @@
 static __inline__ __m64
 pix_add_mul (__m64 x, __m64 a, __m64 y, __m64 b)
 {
-    x = _mm_mullo_pi16 (x, a);                  
-    y = _mm_mullo_pi16 (y, b);                  
-    x = _mm_srli_pi16(x, 1);                    
-    y = _mm_srli_pi16(y, 1);                    
-    x = _mm_adds_pu16 (x, y);                    
-    x = _mm_adds_pu16 (x, _mm_srli_pi16 (x, 8)); 
+    x = _mm_mullo_pi16 (x, a);
+    y = _mm_mullo_pi16 (y, b);
     x = _mm_adds_pu16 (x, MC(4x0080));
-    x = _mm_srli_pi16 (x, 7);
+    x = _mm_adds_pu16 (x, y);
+    x = _mm_adds_pu16 (x, _mm_srli_pi16 (x, 8));
+    x = _mm_srli_pi16 (x, 8);
 
     return x;
 }
@@ -586,7 +584,7 @@
         CARD32 da = ~d >> 24;
 
         if (sa > da) {
-            __m64 msa = load8888(FbIntDiv(da, sa));
+            __m64 msa = load8888(FbIntDiv(da, sa)<<24);
             msa = expand_alpha(msa);
             ms = pix_multiply(ms, msa);
         }

Index: fbpict.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbpict.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- fbpict.c	12 Jul 2005 09:57:00 -0000	1.39
+++ fbpict.c	16 Aug 2005 23:34:18 -0000	1.40
@@ -1794,7 +1794,9 @@
 	    if (pSrc->format == pDst->format)
 	    {
 #ifdef USE_MMX
-		if (pSrc->pDrawable != pDst->pDrawable)
+		if (pSrc->pDrawable != pDst->pDrawable &&
+		    (PICT_FORMAT_BPP (pSrc->format) == 16 ||
+		     PICT_FORMAT_BPP (pSrc->format) == 32))
 		    func = fbCompositeCopyAreammx;
 		else
 #endif



More information about the xserver-commit mailing list