summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@redhat.com>2007-06-11 22:43:01 -0400
committerSøren Sandmann Pedersen <sandmann@redhat.com>2007-06-11 22:43:01 -0400
commiteb2d7fe02f9cbca57b462bba05498e2d59316fbc (patch)
treed7ea1879f6bd5d739ea132f319e95dd7d65e23c6
parentf52ae237d3eec79ccd64cdd77271aeacc37af70c (diff)
Replace fbFillmmx() with pixman_fill() and remove fbmmx.[ch]
-rw-r--r--configure.ac13
-rw-r--r--fb/Makefile.am21
-rw-r--r--fb/fbcopy.c1
-rw-r--r--fb/fbfill.c17
-rw-r--r--fb/fbmmx.c128
-rw-r--r--fb/fbmmx.h11
-rw-r--r--fb/fbpict.c201
-rw-r--r--fb/fbwindow.c26
8 files changed, 20 insertions, 398 deletions
diff --git a/configure.ac b/configure.ac
index 9890b9a1f..44064742a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -362,19 +362,6 @@ case $host_os in
esac
AM_CONDITIONAL(KDRIVE_HW, test "x$KDRIVE_HW" = xyes)
-AC_MSG_CHECKING(for MMX capable platform)
-if test "x$use_x86_asm" = xyes && test "x$GCC" = xyes ; then
- AC_PREPROC_IFELSE([
-#if (!defined (__GNUC__) || __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
- #error Not supported
-#endif
-], mmx_capable=yes, mmx_capable=no)
-else
- mmx_capable=no
-fi
-AC_MSG_RESULT([$mmx_capable])
-AM_CONDITIONAL(MMX_CAPABLE, [test "x$mmx_capable" = xyes])
-
DEFAULT_VENDOR_NAME="The X.Org Foundation"
DEFAULT_VENDOR_NAME_SHORT="X.Org"
DEFAULT_VERSION_MAJOR=7
diff --git a/fb/Makefile.am b/fb/Makefile.am
index 28c0cc703..75861a38d 100644
--- a/fb/Makefile.am
+++ b/fb/Makefile.am
@@ -1,4 +1,4 @@
-noinst_LTLIBRARIES = libfb.la libwfb.la libfbmmx.la
+noinst_LTLIBRARIES = libfb.la libwfb.la
INCLUDES = \
-I$(top_srcdir)/hw/xfree86/os-support \
@@ -12,25 +12,8 @@ endif
libfb_la_CFLAGS = $(AM_CFLAGS)
-if MMX_CAPABLE
-libfb_la_CFLAGS += -DUSE_MMX
-
-libfbmmx_la_CFLAGS = \
- $(DIX_CFLAGS) \
- -DUSE_MMX \
- -mmmx \
- -msse \
- -Winline \
- --param inline-unit-growth=10000 \
- --param large-function-growth=10000
-endif
-
libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
-libfbmmx_la_SOURCES = \
- fbmmx.c \
- fbmmx.h
-
libfb_la_SOURCES = \
fb.h \
fb24_32.c \
@@ -73,6 +56,4 @@ libfb_la_SOURCES = \
libwfb_la_SOURCES = $(libfb_la_SOURCES)
-libfb_la_LIBADD = libfbmmx.la
-
EXTRA_DIST = fbcmap.c fbcmap_mi.c
diff --git a/fb/fbcopy.c b/fb/fbcopy.c
index a4302037a..84053e70f 100644
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -29,7 +29,6 @@
#include <stdlib.h>
#include "fb.h"
-#include "fbmmx.h"
void
fbCopyNtoN (DrawablePtr pSrcDrawable,
diff --git a/fb/fbfill.c b/fb/fbfill.c
index 4f13a023a..0d624fdbd 100644
--- a/fb/fbfill.c
+++ b/fb/fbfill.c
@@ -27,7 +27,6 @@
#endif
#include "fb.h"
-#include "fbmmx.h"
void
fbFill (DrawablePtr pDrawable,
@@ -47,10 +46,10 @@ fbFill (DrawablePtr pDrawable,
switch (pGC->fillStyle) {
case FillSolid:
-#ifdef USE_MMX
- if (!pPriv->and && fbHaveMMX())
+#ifndef FB_ACCESS_WRAPPER
+ if (!pPriv->and)
{
- if (fbFillmmx (dst, dstStride, dstBpp, x + dstXoff, y + dstYoff, width, height, pPriv->xor))
+ if (pixman_fill (dst, dstStride, dstBpp, x + dstXoff, y + dstYoff, width, height, pPriv->xor))
{
fbFinishAccess (pDrawable);
return;
@@ -218,12 +217,12 @@ fbSolidBoxClipped (DrawablePtr pDrawable,
if (partY2 <= partY1)
continue;
-#ifdef USE_MMX
- if (!and && fbHaveMMX())
+#ifndef FB_ACCESS_WRAPPER
+ if (!and)
{
- if (fbFillmmx (dst, dstStride, dstBpp,
- partX1 + dstXoff, partX2 + dstYoff, (partX2 - partX1), (partY2 - partY1),
- xor))
+ if (pixman_fill (dst, dstStride, dstBpp,
+ partX1 + dstXoff, partX2 + dstYoff, (partX2 - partX1), (partY2 - partY1),
+ xor))
{
fbFinishAccess (pDrawable);
return;
diff --git a/fb/fbmmx.c b/fb/fbmmx.c
index 452769d8a..f962b66a9 100644
--- a/fb/fbmmx.c
+++ b/fb/fbmmx.c
@@ -73,133 +73,5 @@ typedef unsigned __int64 ullong;
typedef __m64 mmxdatafield;
#endif
-Bool
-fbFillmmx (FbBits *bits,
- FbStride stride,
- int bpp,
- int x,
- int y,
- int width,
- int height,
- FbBits xor)
-{
- ullong fill;
- __m64 vfill;
- CARD32 byte_width;
- CARD8 *byte_line;
-#ifdef __GNUC__
- __m64 v1, v2, v3, v4, v5, v6, v7;
-#endif
-
- if (bpp == 16 && (xor >> 16 != (xor & 0xffff)))
- return FALSE;
-
- if (bpp != 16 && bpp != 32)
- return FALSE;
-
- if (bpp == 16)
- {
- stride = stride * sizeof (FbBits) / 2;
- byte_line = (CARD8 *)(((CARD16 *)bits) + stride * y + x);
- byte_width = 2 * width;
- stride *= 2;
- }
- else
- {
- stride = stride * sizeof (FbBits) / 4;
- byte_line = (CARD8 *)(((CARD32 *)bits) + stride * y + x);
- byte_width = 4 * width;
- stride *= 4;
- }
-
- fill = ((ullong)xor << 32) | xor;
- vfill = (__m64)fill;
-
-#ifdef __GNUC__
- __asm__ (
- "movq %7, %0\n"
- "movq %7, %1\n"
- "movq %7, %2\n"
- "movq %7, %3\n"
- "movq %7, %4\n"
- "movq %7, %5\n"
- "movq %7, %6\n"
- : "=y" (v1), "=y" (v2), "=y" (v3),
- "=y" (v4), "=y" (v5), "=y" (v6), "=y" (v7)
- : "y" (vfill));
-#endif
-
- while (height--)
- {
- int w;
- CARD8 *d = byte_line;
- byte_line += stride;
- w = byte_width;
-
- while (w >= 2 && ((unsigned long)d & 3))
- {
- *(CARD16 *)d = xor;
- w -= 2;
- d += 2;
- }
-
- while (w >= 4 && ((unsigned long)d & 7))
- {
- *(CARD32 *)d = xor;
-
- w -= 4;
- d += 4;
- }
-
- while (w >= 64)
- {
-#ifdef __GNUC__
- __asm__ (
- "movq %1, (%0)\n"
- "movq %2, 8(%0)\n"
- "movq %3, 16(%0)\n"
- "movq %4, 24(%0)\n"
- "movq %5, 32(%0)\n"
- "movq %6, 40(%0)\n"
- "movq %7, 48(%0)\n"
- "movq %8, 56(%0)\n"
- :
- : "r" (d),
- "y" (vfill), "y" (v1), "y" (v2), "y" (v3),
- "y" (v4), "y" (v5), "y" (v6), "y" (v7)
- : "memory");
-#else
- *(__m64*) (d + 0) = vfill;
- *(__m64*) (d + 8) = vfill;
- *(__m64*) (d + 16) = vfill;
- *(__m64*) (d + 24) = vfill;
- *(__m64*) (d + 32) = vfill;
- *(__m64*) (d + 40) = vfill;
- *(__m64*) (d + 48) = vfill;
- *(__m64*) (d + 56) = vfill;
-#endif
- w -= 64;
- d += 64;
- }
-
- while (w >= 4)
- {
- *(CARD32 *)d = xor;
-
- w -= 4;
- d += 4;
- }
- if (w >= 2)
- {
- *(CARD16 *)d = xor;
- w -= 2;
- d += 2;
- }
- }
-
- _mm_empty();
- return TRUE;
-}
-
#endif /* RENDER */
#endif /* USE_MMX */
diff --git a/fb/fbmmx.h b/fb/fbmmx.h
index cd685ce54..06b079c5c 100644
--- a/fb/fbmmx.h
+++ b/fb/fbmmx.h
@@ -42,14 +42,3 @@ Bool fbHaveMMX(void);
#define fbHaveMMX() FALSE
#endif
-#ifdef USE_MMX
-
-Bool fbFillmmx (FbBits *bits,
- FbStride stride,
- int bpp,
- int x,
- int y,
- int width,
- int height,
- FbBits xor);
-#endif /* USE_MMX */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 0a42f12d9..ead84d735 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -36,7 +36,6 @@
#include "picturestr.h"
#include "mipict.h"
#include "fbpict.h"
-#include "fbmmx.h"
#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
@@ -468,203 +467,3 @@ fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
return TRUE;
}
-
-#ifdef USE_MMX
-/* The CPU detection code needs to be in a file not compiled with
- * "-mmmx -msse", as gcc would generate CMOV instructions otherwise
- * that would lead to SIGILL instructions on old CPUs that don't have
- * it.
- */
-#if !defined(__amd64__) && !defined(__x86_64__)
-
-#ifdef HAVE_GETISAX
-#include <sys/auxv.h>
-#endif
-
-enum CPUFeatures {
- NoFeatures = 0,
- MMX = 0x1,
- MMX_Extensions = 0x2,
- SSE = 0x6,
- SSE2 = 0x8,
- CMOV = 0x10
-};
-
-static unsigned int detectCPUFeatures(void) {
- unsigned int features = 0;
- unsigned int result = 0;
-
-#ifdef HAVE_GETISAX
- if (getisax(&result, 1)) {
- if (result & AV_386_CMOV)
- features |= CMOV;
- if (result & AV_386_MMX)
- features |= MMX;
- if (result & AV_386_AMD_MMX)
- features |= MMX_Extensions;
- if (result & AV_386_SSE)
- features |= SSE;
- if (result & AV_386_SSE2)
- features |= SSE2;
- }
-#else
- char vendor[13];
-#ifdef _MSC_VER
- int vendor0 = 0, vendor1, vendor2;
-#endif
- vendor[0] = 0;
- vendor[12] = 0;
-
-#ifdef __GNUC__
- /* see p. 118 of amd64 instruction set manual Vol3 */
- /* We need to be careful about the handling of %ebx and
- * %esp here. We can't declare either one as clobbered
- * since they are special registers (%ebx is the "PIC
- * register" holding an offset to global data, %esp the
- * stack pointer), so we need to make sure they have their
- * original values when we access the output operands.
- */
- __asm__ ("pushf\n"
- "pop %%eax\n"
- "mov %%eax, %%ecx\n"
- "xor $0x00200000, %%eax\n"
- "push %%eax\n"
- "popf\n"
- "pushf\n"
- "pop %%eax\n"
- "mov $0x0, %%edx\n"
- "xor %%ecx, %%eax\n"
- "jz 1f\n"
-
- "mov $0x00000000, %%eax\n"
- "push %%ebx\n"
- "cpuid\n"
- "mov %%ebx, %%eax\n"
- "pop %%ebx\n"
- "mov %%eax, %1\n"
- "mov %%edx, %2\n"
- "mov %%ecx, %3\n"
- "mov $0x00000001, %%eax\n"
- "push %%ebx\n"
- "cpuid\n"
- "pop %%ebx\n"
- "1:\n"
- "mov %%edx, %0\n"
- : "=r" (result),
- "=m" (vendor[0]),
- "=m" (vendor[4]),
- "=m" (vendor[8])
- :
- : "%eax", "%ecx", "%edx"
- );
-
-#elif defined (_MSC_VER)
-
- _asm {
- pushfd
- pop eax
- mov ecx, eax
- xor eax, 00200000h
- push eax
- popfd
- pushfd
- pop eax
- mov edx, 0
- xor eax, ecx
- jz nocpuid
-
- mov eax, 0
- push ebx
- cpuid
- mov eax, ebx
- pop ebx
- mov vendor0, eax
- mov vendor1, edx
- mov vendor2, ecx
- mov eax, 1
- push ebx
- cpuid
- pop ebx
- nocpuid:
- mov result, edx
- }
- memmove (vendor+0, &vendor0, 4);
- memmove (vendor+4, &vendor1, 4);
- memmove (vendor+8, &vendor2, 4);
-
-#else
-# error unsupported compiler
-#endif
-
- features = 0;
- if (result) {
- /* result now contains the standard feature bits */
- if (result & (1 << 15))
- features |= CMOV;
- if (result & (1 << 23))
- features |= MMX;
- if (result & (1 << 25))
- features |= SSE;
- if (result & (1 << 26))
- features |= SSE2;
- if ((features & MMX) && !(features & SSE) &&
- (strcmp(vendor, "AuthenticAMD") == 0 ||
- strcmp(vendor, "Geode by NSC") == 0)) {
- /* check for AMD MMX extensions */
-#ifdef __GNUC__
- __asm__("push %%ebx\n"
- "mov $0x80000000, %%eax\n"
- "cpuid\n"
- "xor %%edx, %%edx\n"
- "cmp $0x1, %%eax\n"
- "jge 2f\n"
- "mov $0x80000001, %%eax\n"
- "cpuid\n"
- "2:\n"
- "pop %%ebx\n"
- "mov %%edx, %0\n"
- : "=r" (result)
- :
- : "%eax", "%ecx", "%edx"
- );
-#elif defined _MSC_VER
- _asm {
- push ebx
- mov eax, 80000000h
- cpuid
- xor edx, edx
- cmp eax, 1
- jge notamd
- mov eax, 80000001h
- cpuid
- notamd:
- pop ebx
- mov result, edx
- }
-#endif
- if (result & (1<<22))
- features |= MMX_Extensions;
- }
- }
-#endif /* HAVE_GETISAX */
-
- return features;
-}
-
-Bool
-fbHaveMMX (void)
-{
- static Bool initialized = FALSE;
- static Bool mmx_present;
-
- if (!initialized)
- {
- unsigned int features = detectCPUFeatures();
- mmx_present = (features & (MMX|MMX_Extensions)) == (MMX|MMX_Extensions);
- initialized = TRUE;
- }
-
- return mmx_present;
-}
-#endif /* __amd64__ */
-#endif
diff --git a/fb/fbwindow.c b/fb/fbwindow.c
index 5b3f446b1..fc036d3bb 100644
--- a/fb/fbwindow.c
+++ b/fb/fbwindow.c
@@ -30,10 +30,6 @@
#include "fb.h"
-#ifdef USE_MMX
-#include "fbmmx.h"
-#endif
-
Bool
fbCreateWindow(WindowPtr pWin)
{
@@ -222,22 +218,22 @@ fbFillRegionSolid (DrawablePtr pDrawable,
int n = REGION_NUM_RECTS(pRegion);
BoxPtr pbox = REGION_RECTS(pRegion);
-#ifdef USE_MMX
- int has_mmx = 0;
- if (!and && fbHaveMMX())
- has_mmx = 1;
+#ifndef FB_ACCESS_WRAPPER
+ int try_mmx = 0;
+ if (!and)
+ try_mmx = 1;
#endif
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
while (n--)
{
-#ifdef USE_MMX
- if (!has_mmx || !fbFillmmx (dst, dstStride, dstBpp,
- pbox->x1 + dstXoff, pbox->y1 + dstYoff,
- (pbox->x2 - pbox->x1),
- (pbox->y2 - pbox->y1),
- xor))
+#ifndef FB_ACCESS_WRAPPER
+ if (!try_mmx || !pixman_fill (dst, dstStride, dstBpp,
+ pbox->x1 + dstXoff, pbox->y1 + dstYoff,
+ (pbox->x2 - pbox->x1),
+ (pbox->y2 - pbox->y1),
+ xor))
{
#endif
fbSolid (dst + (pbox->y1 + dstYoff) * dstStride,
@@ -247,7 +243,7 @@ fbFillRegionSolid (DrawablePtr pDrawable,
(pbox->x2 - pbox->x1) * dstBpp,
pbox->y2 - pbox->y1,
and, xor);
-#ifdef USE_MMX
+#ifndef FB_ACCESS_WRAPPER
}
#endif
fbValidateDrawable (pDrawable);