From 237233d14346604488785a9899f01df044245949 Mon Sep 17 00:00:00 2001
From: Jared McNeill <jmcneill@NetBSD.org>
Date: Mon, 3 Jun 2013 20:52:47 +0200
Subject: [PATCH 02/38] Remove a couple '#ifdef linux's to let the driver use
 optimized memcpy functions on NetBSD for video copy. Gives nearly 2x
 performance on my test system (previously "kernel" memcpy was always used):

CHROME(0): Benchmarking video copy.  Less time is better.
CHROME(0): Timed   libc YUV420 copy... 3000272. Throughput: 315.6 MiB/s.
CHROME(0): Timed kernel YUV420 copy... 3024946. Throughput: 313.0 MiB/s.
CHROME(0): Timed    SSE YUV420 copy... 1591352. Throughput: 595.0 MiB/s.
CHROME(0): Timed    MMX YUV420 copy... 2566279. Throughput: 369.0 MiB/s.
CHROME(0): Ditching 3DNow! YUV420 copy. Not supported by CPU.
CHROME(0): Timed   MMX2 YUV420 copy... 1696662. Throughput: 558.1 MiB/s.
CHROME(0): Using SSE YUV42X copy for video.
---
 src/via_memcpy.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/src/via_memcpy.c b/src/via_memcpy.c
index d4eb804..8ef0e9f 100644
--- a/src/via_memcpy.c
+++ b/src/via_memcpy.c
@@ -309,8 +309,6 @@
     }
 
 
-#if !defined(__i386__) || (defined(linux) && defined(__i386__))
-
 static void
 libc_YUV42X(unsigned char *dst, const unsigned char *src,
             int dstPitch, int w, int h, int yuv422)
@@ -348,8 +346,6 @@ libc_YUV42X(unsigned char *dst, const unsigned char *src,
         }
     }
 }
-#endif
-
 
 #ifdef __i386__
 
@@ -415,7 +411,6 @@ kernel_YUV42X(unsigned char *dst, const unsigned char *src,
     }
 }
 
-#ifdef linux
 PREFETCH_FUNC(sse, SSE, SSE,, FENCE)
 PREFETCH_FUNC(mmxext, MMXEXT, SSE, EMMS, FENCEMMS)
 PREFETCH_FUNC(now, MMX, NOW, FEMMS, FEMMS)
@@ -515,7 +510,6 @@ cpuValid(const char *cpuinfo, char **flags)
     }
     return 0;
 }
-#endif /* linux */
 
 /*
  * Benchmark the video copy routines and choose the fastest.
@@ -525,7 +519,6 @@ viaVidCopyInit(char *copyType, ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 
-#ifdef linux
     char buf[BSIZ];
     unsigned char *buf1, *buf2, *buf3;
     char *tmpBuf, *endBuf;
@@ -641,11 +634,6 @@ viaVidCopyInit(char *copyType, ScreenPtr pScreen)
                "Using %s YUV42X copy for %s.\n",
                mcFunctions[bestSoFar].mName, copyType);
     return mcFunctions[bestSoFar].mFunc;
-#else
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-               "Using Linux kernel memcpy for video.\n");
-    return kernel_YUV42X;
-#endif /* linux */
 }
 
 #else
-- 
2.3.0

