summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2017-01-26 01:27:42 -0800
committerEmil Velikov <emil.l.velikov@gmail.com>2017-03-14 00:13:13 +0000
commit6a6da8886898bcb97ca9ac23b8ce9c780b33b0ca (patch)
tree76ccf47b8e02db51b580627f6986db0285299f41 /src
parentccff7fcc172ec003b3a0f77297c679010e83b4ff (diff)
i965: Fix check for negative pitch in can_do_fast_copy_blit().
At this point, the pitch is in bytes. We haven't yet divided the pitch by 4 for tiled surfaces, so abs(pitch) may be larger than 32K. This means the bit 15 trick won't work. The caller now has signed integers anyway, so just pass those through and do the obvious check. Cc: "17.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (cherry picked from commit 02216a1ddf2bcafb86fda352e514f27ab6f7a4fa)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/intel_blit.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
index b7a9cc951cb..35f0269f638 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -333,11 +333,11 @@ static bool
can_fast_copy_blit(struct brw_context *brw,
drm_intel_bo *src_buffer,
int16_t src_x, int16_t src_y,
- uintptr_t src_offset, uint32_t src_pitch,
+ uintptr_t src_offset, int32_t src_pitch,
uint32_t src_tiling, uint32_t src_tr_mode,
drm_intel_bo *dst_buffer,
int16_t dst_x, int16_t dst_y,
- uintptr_t dst_offset, uint32_t dst_pitch,
+ uintptr_t dst_offset, int32_t dst_pitch,
uint32_t dst_tiling, uint32_t dst_tr_mode,
int16_t w, int16_t h, uint32_t cpp,
GLenum logic_op)
@@ -373,10 +373,8 @@ can_fast_copy_blit(struct brw_context *brw,
if (!_mesa_is_pow_two(cpp) || cpp > 16)
return false;
- /* For Fast Copy Blits the pitch cannot be a negative number. So, bit 15
- * of the destination pitch must be zero.
- */
- if ((src_pitch >> 15 & 1) != 0 || (dst_pitch >> 15 & 1) != 0)
+ /* For Fast Copy Blits the pitch cannot be a negative number. */
+ if (src_pitch < 0 || dst_pitch < 0)
return false;
/* For Linear surfaces, the pitch has to be an OWord (16byte) multiple. */