mesa: remove TextureMemCpy driver hook

There's probably no reason to use a special version of memcpy() anymore.
This commit is contained in:
Brian Paul
2011-12-03 10:04:18 -07:00
parent d958202663
commit 5acb291f31
4 changed files with 2 additions and 69 deletions
-1
View File
@@ -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;
-13
View File
@@ -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().
*/
+2 -3
View File
@@ -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;
}
-52
View File
@@ -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;