i965: Tell intel_get_memcpy() which direction the memcpy() is going.
authorMatt Turner <mattst88@gmail.com>
Wed, 4 Mar 2015 23:21:53 +0000 (15:21 -0800)
committerMatt Turner <mattst88@gmail.com>
Thu, 5 Mar 2015 18:18:28 +0000 (10:18 -0800)
commit2e4c95dfe2cb205c327ceaa12b44a9273bdb20dc
treebbf37b168d4470c516825f212030f0f54ac72837
parent5f9ee6a02f54864df166e5dcc7303771d4eac9b3
i965: Tell intel_get_memcpy() which direction the memcpy() is going.

The SSSE3 swizzling code was written for fast uploads to the GPU and
assumed the destination was always 16-byte aligned. When we began using
this code for fast downloads as well we didn't do anything to account
for the fact that the destination pointer given by glReadPixels() or
glGetTexImage() is not guaranteed to be suitably aligned.

With SSSE3 enabled (at compile-time), some applications would crash when
an SSE aligned-store instruction tried to store to an unaligned
destination (or an assertion that the destination is aligned would
trigger).

To remedy this, tell intel_get_memcpy() whether we're uploading or
downloading so that it can select whether to assume the destination or
source is aligned, respectively.

Cc: 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89416
Tested-by: Uriy Zhuravlev <stalkerg@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/mesa/drivers/dri/i965/intel_pixel_read.c
src/mesa/drivers/dri/i965/intel_tex_image.c
src/mesa/drivers/dri/i965/intel_tex_subimage.c
src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
src/mesa/drivers/dri/i965/intel_tiled_memcpy.h