summaryrefslogtreecommitdiff
path: root/fb
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@daimi.au.dk>2005-03-26 23:50:24 +0000
committerSøren Sandmann Pedersen <sandmann@daimi.au.dk>2005-03-26 23:50:24 +0000
commit476ae15640d2b97cb0ebccab8255ccf728596c62 (patch)
tree5527c223dabfcc704358163c6edad46dca9730de /fb
parent0d33b588376a4d86d50ed8b7e06eaf0dbd8c5ba5 (diff)
Sat Mar 26 18:49:21 2005 Soeren Sandmann <sandmann@redhat.com>
programs/Xserver/fb/fbmmx.h New function. Hook it up here
Diffstat (limited to 'fb')
-rw-r--r--fb/fbmmx.c80
-rw-r--r--fb/fbmmx.h12
-rw-r--r--fb/fbpict.c14
-rw-r--r--fb/fbpict.h13
4 files changed, 117 insertions, 2 deletions
diff --git a/fb/fbmmx.c b/fb/fbmmx.c
index 485fa4a7c..ead28405e 100644
--- a/fb/fbmmx.c
+++ b/fb/fbmmx.c
@@ -732,6 +732,86 @@ fbCompositeSrc_8888x8x8888mmx (CARD8 op,
}
void
+fbCompositeSrc_8888x8888mmx (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 *dstLine, *dst;
+ CARD32 *srcLine, *src;
+ FbStride dstStride, srcStride;
+ CARD16 w;
+ __m64 srca;
+
+ CHECKPOINT();
+
+ fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
+ fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
+
+ srca = MC (4x00ff);
+
+ while (height--)
+ {
+ dst = dstLine;
+ dstLine += dstStride;
+ src = srcLine;
+ srcLine += srcStride;
+ w = width;
+
+ while (w && (unsigned long)dst & 7)
+ {
+ __m64 s = load8888 (*src);
+ __m64 d = load8888 (*dst);
+
+ *dst = (ullong)pack8888 (over (s, expand_alpha (s), d), (__m64)_mm_setzero_si64());
+
+ w--;
+ dst++;
+ src++;
+ }
+
+ while (w >= 2)
+ {
+ __m64 vd = *(__m64 *)(dst + 0);
+ __m64 vs = *(__m64 *)(src + 0);
+ __m64 vs0 = expand8888 (vs, 0);
+ __m64 vs1 = expand8888 (vs, 1);
+
+ *(__m64 *)dst = (__m64)pack8888 (
+ over (vs0, expand_alpha (vs0), expand8888 (vd, 0)),
+ over (vs1, expand_alpha (vs1), expand8888 (vd, 1)));
+
+ w -= 2;
+ dst += 2;
+ src += 2;
+ }
+
+ while (w)
+ {
+ __m64 s = load8888 (*src);
+ __m64 d = load8888 (*dst);
+
+ *dst = (ullong)pack8888 (over (s, expand_alpha (s), d),
+ (__m64)_mm_setzero_si64());
+
+ w--;
+ dst++;
+ src++;
+ }
+ }
+
+ _mm_empty();
+}
+
+void
fbCompositeSolidMask_nx8x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
diff --git a/fb/fbmmx.h b/fb/fbmmx.h
index c0333a344..39e8d1e9c 100644
--- a/fb/fbmmx.h
+++ b/fb/fbmmx.h
@@ -60,6 +60,18 @@ void fbCompositeSrcAdd_8888x8888mmx (CARD8 op,
INT16 yDst,
CARD16 width,
CARD16 height);
+void fbCompositeSrc_8888x8888mmx (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
void fbCompositeSolidMask_nx8888x8888Cmmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 4843eb2a1..67db2e1c1 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -1088,7 +1088,12 @@ fbComposite (CARD8 op,
switch (pDst->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
- func = fbCompositeSrc_8888x8888;
+#ifdef USE_MMX
+ if (fbHaveMMX())
+ func = fbCompositeSrc_8888x8888mmx;
+ else
+#endif
+ func = fbCompositeSrc_8888x8888;
break;
case PICT_r8g8b8:
func = fbCompositeSrc_8888x0888;
@@ -1123,7 +1128,12 @@ fbComposite (CARD8 op,
switch (pDst->format) {
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
- func = fbCompositeSrc_8888x8888;
+#ifdef USE_MMX
+ if (fbHaveMMX())
+ func = fbCompositeSrc_8888x8888mmx;
+ else
+#endif
+ func = fbCompositeSrc_8888x8888;
break;
case PICT_b8g8r8:
func = fbCompositeSrc_8888x0888;
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 3b88bfa37..4e8c95c30 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -1029,6 +1029,19 @@ fbCompositeSolidMask_nx1xn (CARD8 op,
INT16 yDst,
CARD16 width,
CARD16 height);
+void
+fbCompositeSrc_8888x8888mmx (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
void
fbComposite (CARD8 op,