From e717eb82dc2e55f852919312d04f5cfc8ee55bc8 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 2 Aug 2007 10:50:01 +1000 Subject: [PATCH] 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. --- hw/xfree86/loader/xf86sym.c | 1 + hw/xfree86/os-support/misc/SlowBcopy.c | 32 +++++++++++++++++++------- hw/xfree86/os-support/xf86_OSproc.h | 1 + 3 files changed, 26 insertions(+), 8 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,22 +22,38 @@ #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 } } +#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);