diff options
author | Dave Airlie <airlied@redhat.com> | 2007-08-02 10:50:01 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2007-08-05 09:51:36 +1000 |
commit | e717eb82dc2e55f852919312d04f5cfc8ee55bc8 (patch) | |
tree | 5c63b13aceb6598519ffe6f8a24c8d64d3482ec2 | |
parent | 600ef07113caa7a901c7d486bc8ebd1ae47f885c (diff) |
xserver: stop bcopy from going really slow
The outport is most likely unnecessary on any currently used hardware,
the byte copy is necessary from what I know on IA64 and friends so leave it.
Add a new API entry point which lets a driver select the old behaviour if
such a needs is ever found.
This gives me ~20% speed up on startup on 945 hardware.
-rw-r--r-- | hw/xfree86/loader/xf86sym.c | 1 | ||||
-rw-r--r-- | hw/xfree86/os-support/misc/SlowBcopy.c | 30 | ||||
-rw-r--r-- | hw/xfree86/os-support/xf86_OSproc.h | 1 |
3 files changed, 25 insertions, 7 deletions
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index d925bedc0..8a2768d80 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -259,6 +259,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86UDelay) SYMFUNC(xf86IODelay) SYMFUNC(xf86SlowBcopy) + SYMFUNC(xf86SetReallySlowBcopy) #ifdef __alpha__ SYMFUNC(xf86SlowBCopyToBus) SYMFUNC(xf86SlowBCopyFromBus) diff --git a/hw/xfree86/os-support/misc/SlowBcopy.c b/hw/xfree86/os-support/misc/SlowBcopy.c index 7694eaa23..5cd716823 100644 --- a/hw/xfree86/os-support/misc/SlowBcopy.c +++ b/hw/xfree86/os-support/misc/SlowBcopy.c @@ -22,21 +22,37 @@ #include "xf86_OSlib.h" #include "compiler.h" -/* The outb() isn't needed on my machine, but who knows ... -- ost */ +static int really_slow_bcopy; + _X_EXPORT void -xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len) +xf86SetReallySlowBcopy(void) +{ + really_slow_bcopy = 1; +} + +#if defined(__i386__) || defined(__x86_64__) +static void xf86_really_slow_bcopy(unsigned char *src, unsigned char *dst, int len) { while(len--) { *dst++ = *src++; -#if !defined(__sparc__) && \ - !defined(__powerpc__) && \ - !defined(__mips__) && \ - !defined(__ia64__) && \ - !defined(__arm__) outb(0x80, 0x00); + } +} #endif + +/* The outb() isn't needed on my machine, but who knows ... -- ost */ +_X_EXPORT void +xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len) +{ +#if defined(__i386__) || defined(__x86_64__) + if (really_slow_bcopy) { + xf86_really_slow_bcopy(src, dst, len); + return; } +#endif + while(len--) + *dst++ = *src++; } #ifdef __alpha__ diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h index 1bbbf5656..6f0391dc7 100644 --- a/hw/xfree86/os-support/xf86_OSproc.h +++ b/hw/xfree86/os-support/xf86_OSproc.h @@ -159,6 +159,7 @@ extern void xf86BusToMem(unsigned char *, unsigned char *, int); extern void xf86MemToBus(unsigned char *, unsigned char *, int); extern void xf86IODelay(void); extern void xf86UDelay(long usec); +extern void xf86SetReallySlowBcopy(void); extern void xf86SlowBcopy(unsigned char *, unsigned char *, int); extern int xf86OpenSerial(pointer options); extern int xf86SetSerial(int fd, pointer options); |