summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i915pipe/intel_tex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/i915pipe/intel_tex.c')
-rw-r--r--src/mesa/drivers/dri/i915pipe/intel_tex.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i915pipe/intel_tex.c b/src/mesa/drivers/dri/i915pipe/intel_tex.c
index b08dee43bc..9e494d21ba 100644
--- a/src/mesa/drivers/dri/i915pipe/intel_tex.c
+++ b/src/mesa/drivers/dri/i915pipe/intel_tex.c
@@ -75,6 +75,34 @@ intelFreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage)
}
+
+
+/* ================================================================
+ * From linux kernel i386 header files, copes with odd sizes better
+ * than COPY_DWORDS would:
+ * XXX Put this in src/mesa/main/imports.h ???
+ */
+#if defined(i386) || defined(__i386__)
+static INLINE void *
+__memcpy(void *to, const void *from, size_t n)
+{
+ int d0, d1, d2;
+ __asm__ __volatile__("rep ; movsl\n\t"
+ "testb $2,%b4\n\t"
+ "je 1f\n\t"
+ "movsw\n"
+ "1:\ttestb $1,%b4\n\t"
+ "je 2f\n\t"
+ "movsb\n" "2:":"=&c"(d0), "=&D"(d1), "=&S"(d2)
+ :"0"(n / 4), "q"(n), "1"((long) to), "2"((long) from)
+ :"memory");
+ return (to);
+}
+#else
+#define __memcpy(a,b,c) memcpy(a,b,c)
+#endif
+
+
/* The system memcpy (at least on ubuntu 5.10) has problems copying
* to agp (writecombined) memory from a source which isn't 64-byte
* aligned - there is a 4x performance falloff.