diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2012-02-02 16:32:45 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2012-02-07 10:02:23 -0800 |
commit | cf4a7c41f6f2594ce4e8841ae1b268568f4ad1a7 (patch) | |
tree | 10ac68b3281522a3cb022c1685fb36606a710b9c | |
parent | 74a5f030664a9509664c91346f2cde7ed06cd3c9 (diff) | |
download | mesa-cf4a7c41f6f2594ce4e8841ae1b268568f4ad1a7.tar.gz |
intel: Avoid divide by zero for very small linear blits
If size is small (such as 1),
pitch = ROUND_DOWN_TO(MIN2(size, (1 << 15) - 1), 4);
makes pitch = 0. Then
height = size / pitch;
causes a division-by-zero exception. If pitch is zero, set height to
1 and avoid the division.
This fixes piglit's bin/getteximage-formats test and glean's
bufferObject test.
NOTE: This is a candidate for the 8.0 release branch.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44971
(cherry picked from commit d59466279e45a1e9c3f9081f72fedbdf961afbe1)
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_blit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index bafee4f740c..894e74ecd12 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -492,7 +492,7 @@ intel_emit_linear_blit(struct intel_context *intel, * rounding that down to the nearest DWORD is 1 << 15 - 4 */ pitch = ROUND_DOWN_TO(MIN2(size, (1 << 15) - 1), 4); - height = size / pitch; + height = (pitch == 0) ? 1 : size / pitch; ok = intelEmitCopyBlit(intel, 1, pitch, src_bo, src_offset, I915_TILING_NONE, pitch, dst_bo, dst_offset, I915_TILING_NONE, |