summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@redhat.com>2007-06-11 13:14:50 -0400
committerSøren Sandmann Pedersen <sandmann@redhat.com>2007-06-11 14:10:33 -0400
commit3210902a7334f3d8d6c18a34a3cb3f55803b0043 (patch)
treeb17d44346327c7561af27d7b28f8bdc4f63f33ab
parent8d5f4368eac1b259db3e61f877a4cc10f04efa2f (diff)
Split fbCopyAreammx() into a new fbBltmmx() function; call this
function from fbCopyNToN().
-rw-r--r--fb/fbcopy.c18
-rw-r--r--fb/fbmmx.c72
-rw-r--r--fb/fbmmx.h9
3 files changed, 61 insertions, 38 deletions
diff --git a/fb/fbcopy.c b/fb/fbcopy.c
index 164cd3d67..74ff35848 100644
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -64,17 +64,13 @@ fbCopyNtoN (DrawablePtr pSrcDrawable,
if (pm == FB_ALLONES && alu == GXcopy && !reverse &&
!upsidedown && fbHaveMMX())
{
- if (!fbCopyAreammx (pSrcDrawable,
- pDstDrawable,
-
- (pbox->x1 + dx),
- (pbox->y1 + dy),
-
- (pbox->x1),
- (pbox->y1),
-
- (pbox->x2 - pbox->x1),
- (pbox->y2 - pbox->y1)))
+ if (!fbBltmmx (src, dst, srcStride, dstStride, srcBpp, dstBpp,
+ (pbox->x1 + dx + srcXoff),
+ (pbox->y1 + dy + srcYoff),
+ (pbox->x1 + srcXoff),
+ (pbox->y1 + srcYoff),
+ (pbox->x2 - pbox->x1),
+ (pbox->y2 - pbox->y1)))
goto fallback;
else
goto next;
diff --git a/fb/fbmmx.c b/fb/fbmmx.c
index b2fe94bc0..7fb4b15d5 100644
--- a/fb/fbmmx.c
+++ b/fb/fbmmx.c
@@ -208,34 +208,20 @@ fbSolidFillmmx (DrawablePtr pDraw,
}
Bool
-fbCopyAreammx (DrawablePtr pSrc,
- DrawablePtr pDst,
- int src_x,
- int src_y,
- int dst_x,
- int dst_y,
- int width,
- int height)
+fbBltmmx (FbBits *src_bits,
+ FbBits *dst_bits,
+ FbStride src_stride,
+ FbStride dst_stride,
+ int src_bpp,
+ int dst_bpp,
+ int src_x, int src_y,
+ int dst_x, int dst_y,
+ int width, int height)
{
- FbBits * src_bits;
- FbStride src_stride;
- int src_bpp;
- int src_xoff;
- int src_yoff;
-
- FbBits * dst_bits;
- FbStride dst_stride;
- int dst_bpp;
- int dst_xoff;
- int dst_yoff;
-
CARD8 * src_bytes;
CARD8 * dst_bytes;
int byte_width;
- fbGetDrawable(pSrc, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
- fbGetDrawable(pDst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff);
-
if (src_bpp != dst_bpp)
return FALSE;
@@ -243,16 +229,16 @@ fbCopyAreammx (DrawablePtr pSrc,
{
src_stride = src_stride * sizeof (FbBits) / 2;
dst_stride = dst_stride * sizeof (FbBits) / 2;
- src_bytes = (CARD8 *)(((CARD16 *)src_bits) + src_stride * (src_y + src_yoff) + (src_x + src_xoff));
- dst_bytes = (CARD8 *)(((CARD16 *)dst_bits) + dst_stride * (dst_y + dst_yoff) + (dst_x + dst_xoff));
+ src_bytes = (CARD8 *)(((CARD16 *)src_bits) + src_stride * (src_y) + (src_x));
+ dst_bytes = (CARD8 *)(((CARD16 *)dst_bits) + dst_stride * (dst_y) + (dst_x));
byte_width = 2 * width;
src_stride *= 2;
dst_stride *= 2;
} else if (src_bpp == 32) {
src_stride = src_stride * sizeof (FbBits) / 4;
dst_stride = dst_stride * sizeof (FbBits) / 4;
- src_bytes = (CARD8 *)(((CARD32 *)src_bits) + src_stride * (src_y + src_yoff) + (src_x + src_xoff));
- dst_bytes = (CARD8 *)(((CARD32 *)dst_bits) + dst_stride * (dst_y + dst_yoff) + (dst_x + dst_xoff));
+ src_bytes = (CARD8 *)(((CARD32 *)src_bits) + src_stride * (src_y) + (src_x));
+ dst_bytes = (CARD8 *)(((CARD32 *)dst_bits) + dst_stride * (dst_y) + (dst_x));
byte_width = 4 * width;
src_stride *= 4;
dst_stride *= 4;
@@ -353,8 +339,40 @@ fbCopyAreammx (DrawablePtr pSrc,
}
_mm_empty();
+
return TRUE;
}
+Bool
+fbCopyAreammx (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int src_x,
+ int src_y,
+ int dst_x,
+ int dst_y,
+ int width,
+ int height)
+{
+ FbBits * src_bits;
+ FbStride src_stride;
+ int src_bpp;
+ int src_xoff;
+ int src_yoff;
+
+ FbBits * dst_bits;
+ FbStride dst_stride;
+ int dst_bpp;
+ int dst_xoff;
+ int dst_yoff;
+
+ fbGetDrawable(pSrc, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
+ fbGetDrawable(pDst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff);
+
+ return fbBltmmx (src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
+ src_x + src_xoff, src_y + src_yoff,
+ dst_x + dst_xoff, dst_y + dst_yoff,
+ width, height);
+}
+
#endif /* RENDER */
#endif /* USE_MMX */
diff --git a/fb/fbmmx.h b/fb/fbmmx.h
index 47964389a..a529526c5 100644
--- a/fb/fbmmx.h
+++ b/fb/fbmmx.h
@@ -44,6 +44,15 @@ Bool fbHaveMMX(void);
#ifdef USE_MMX
+Bool fbBltmmx (FbBits *src_bits,
+ FbBits *dst_bits,
+ FbStride src_stride,
+ FbStride dst_stride,
+ int src_bpp,
+ int dst_bpp,
+ int src_x, int src_y,
+ int dst_x, int dst_y,
+ int width, int height);
Bool fbCopyAreammx (DrawablePtr pSrc,
DrawablePtr pDst,
int src_x,