[Mesa-dev] RFC: remove ctx->Driver.TextureMemCpy() hook

Eric Anholt eric at anholt.net
Sun Dec 4 14:39:15 PST 2011


On Fri, 02 Dec 2011 08:14:56 -0700, Brian Paul <brianp at vmware.com> wrote:
> 
> This hook was added many years ago to allow using an alternative 
> implementation of memcpy() for glTexImage() that was faster under some 
> circumstances.
> 
> The code is still present in the state tracker in st_cb_texture.c
> 
> The hook is only used in texstore.c in the memcpy_texture() helper. 
> It's not used for glCompressedTex[Sub]Image nor a few other places 
> where it could have been used.
> 
> The non-gallium drivers just set ctx->Driver.TextureMemCpy = memcpy so 
> it's really not utilized there.
> 
> If we think that using regular memcpy() everywhere is OK, I'd like to 
> remove this hook.  I haven't done any investigation into whether the 
> assembly __memcpy() function in st_cb_teximage.c is really any faster 
> nowadays.  But if there really is a benefit to this function, we could 
> use it in more places.

I'm suspicious that with the backwards glibc memcpy these days (sigh),
we may end up tricking write combining and getting uncached performance.
Probably not on desktop CPUs, but I fear for Atom.

That said, this hook is obviously not being consistently used, nor does
the callsite know whether something is write-combined memory or not (but
the performance difference from these optimized memcpys is usually
negligible, unless you manage to anger write combining somehow).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111204/78c2b617/attachment.pgp>


More information about the mesa-dev mailing list