[Mesa-dev] [PATCH 28/29] i965: Drop random 32-bit assembly implementation of memcpy().
Ian Romanick
idr at freedesktop.org
Mon Sep 30 17:27:21 PDT 2013
On 09/27/2013 04:46 PM, Kenneth Graunke wrote:
> This was only used for uploading batchbuffer data, and only on 32-bit
> systems. If this is actually useful, we might want to use it more
> widely. But more than likely, it isn't.
This probably is still useful, alas. The glibc memcpy wants to do an
Atom-friendly backwards walk of the addresses. For some kinds of
mappings (uncached?), this breaks write combining and ruins performance.
We didn't need this for 64-bit because, at the time, there were no
64-bit Atoms. I don't know what glibc does for memcpy on 64-bit these days.
We should at least measure this in some 32-bit games on a couple platforms.
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/drivers/dri/i965/intel_batchbuffer.c | 2 +-
> src/mesa/drivers/dri/i965/intel_context.h | 28 ---------------------------
> 2 files changed, 1 insertion(+), 29 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> index 77f3ada..a1e5ffc 100644
> --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> @@ -343,7 +343,7 @@ intel_batchbuffer_data(struct brw_context *brw,
> {
> assert((bytes & 3) == 0);
> intel_batchbuffer_require_space(brw, bytes, is_blit);
> - __memcpy(brw->batch.map + brw->batch.used, data, bytes);
> + memcpy(brw->batch.map + brw->batch.used, data, bytes);
> brw->batch.used += bytes >> 2;
> }
>
> diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h
> index 58a6e86..89cbb7f 100644
> --- a/src/mesa/drivers/dri/i965/intel_context.h
> +++ b/src/mesa/drivers/dri/i965/intel_context.h
> @@ -97,34 +97,6 @@ struct intel_batchbuffer {
> };
>
> /* ================================================================
> - * 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
> -
> -
> -/* ================================================================
> * intel_context.c:
> */
>
>
More information about the mesa-dev
mailing list