From 5acb291f319a0b32d9701b3e6c8624175f1a80e7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 3 Dec 2011 10:04:18 -0700 Subject: [PATCH] mesa: remove TextureMemCpy driver hook There's probably no reason to use a special version of memcpy() anymore. --- src/mesa/drivers/common/driverfuncs.c | 1 - src/mesa/main/dd.h | 13 ------- src/mesa/main/texstore.c | 5 +-- src/mesa/state_tracker/st_cb_texture.c | 52 -------------------------- 4 files changed, 2 insertions(+), 69 deletions(-) diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 5e25d7fda34..17281de58c3 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -119,7 +119,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->UnmapTextureImage = _swrast_unmap_teximage; driver->MapTexture = NULL; driver->UnmapTexture = NULL; - driver->TextureMemCpy = memcpy; driver->IsTextureResident = NULL; driver->DrawTex = _mesa_meta_DrawTex; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 9842540dae0..a068397ef87 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -532,19 +532,6 @@ struct dd_function_table { void (*UnmapRenderbuffer)(struct gl_context *ctx, struct gl_renderbuffer *rb); - /** - * Note: no context argument. This function doesn't initially look - * like it belongs here, except that the driver is the only entity - * that knows for sure how the texture memory is allocated - via - * the above callbacks. There is then an argument that the driver - * knows what memcpy paths might be fast. Typically this is invoked with - * - * to -- a pointer into texture memory allocated by NewTextureImage() above. - * from -- a pointer into client memory or a mesa temporary. - * sz -- nr bytes to copy. - */ - void* (*TextureMemCpy)( void *to, const void *from, size_t sz ); - /** * Called by glAreTextureResident(). */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 37fea2156e6..14d24844975 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -954,8 +954,7 @@ memcpy_texture(struct gl_context *ctx, GLubyte *dstImage = dstSlices[dstZoffset + img] + dstYoffset * dstRowStride + dstXoffset * texelBytes; - ctx->Driver.TextureMemCpy(dstImage, srcImage, - bytesPerRow * srcHeight); + memcpy(dstImage, srcImage, bytesPerRow * srcHeight); srcImage += srcImageStride; } } @@ -968,7 +967,7 @@ memcpy_texture(struct gl_context *ctx, + dstYoffset * dstRowStride + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { - ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow); + memcpy(dstRow, srcRow, bytesPerRow); dstRow += dstRowStride; srcRow += srcRowStride; } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 86d5935c114..52f654d7da8 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -213,56 +213,6 @@ st_UnmapTextureImage(struct gl_context *ctx, } -/** - * 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(PIPE_CC_GCC) && defined(PIPE_ARCH_X86) -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. - * - * The x86 __memcpy is immune to this but is slightly slower - * (10%-ish) than the system memcpy. - * - * The sse_memcpy seems to have a slight cliff at 64/32 bytes, but - * isn't much faster than x86_memcpy for agp copies. - * - * TODO: switch dynamically. - */ -static void * -do_memcpy(void *dest, const void *src, size_t n) -{ - if ((((unsigned long) src) & 63) || (((unsigned long) dest) & 63)) { - return __memcpy(dest, src, n); - } - else - return memcpy(dest, src, n); -} - - /** * Return default texture resource binding bitmask for the given format. */ @@ -1945,8 +1895,6 @@ st_init_texture_functions(struct dd_function_table *functions) functions->MapTextureImage = st_MapTextureImage; functions->UnmapTextureImage = st_UnmapTextureImage; - functions->TextureMemCpy = do_memcpy; - /* XXX Temporary until we can query pipe's texture sizes */ functions->TestProxyTexImage = _mesa_test_proxy_teximage; -- 2.30.2