When trying to blit larger tiled surfaces, the pitch can be larger than
32768 bytes, which means it won't fit in a GLshort.  Passing it in will
truncate the stride to 0, which has...surprising results.

For Y-tiled surfaces, pitches can be up to 128KB, as we divide by 4 and
program the pitch as a number of tiles.  So, this is actually legal and
works out if we don't botch things here.

Fixes GL45-CTS.gtf30.GL3Tests.depth_texture.depth_texture_copyteximage
at widths greater than 8192.

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
---
 src/mesa/drivers/dri/i965/intel_blit.c | 4 ++--
 src/mesa/drivers/dri/i965/intel_blit.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

XXX: This patch needs proper testing.  The test lab is having issues
     this weekend, so I'll plan to test it more thoroughly on Monday.

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c 
b/src/mesa/drivers/dri/i965/intel_blit.c
index 21a16e18c38..6ab06b10fd9 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -577,12 +577,12 @@ xy_blit_cmd(uint32_t src_tiling, uint32_t src_tr_mode,
 bool
 intelEmitCopyBlit(struct brw_context *brw,
                  GLuint cpp,
-                 GLshort src_pitch,
+                 uint32_t src_pitch,
                  drm_intel_bo *src_buffer,
                  GLuint src_offset,
                  uint32_t src_tiling,
                  uint32_t src_tr_mode,
-                 GLshort dst_pitch,
+                 uint32_t dst_pitch,
                  drm_intel_bo *dst_buffer,
                  GLuint dst_offset,
                  uint32_t dst_tiling,
diff --git a/src/mesa/drivers/dri/i965/intel_blit.h 
b/src/mesa/drivers/dri/i965/intel_blit.h
index 6925795656a..ae78dfe56dc 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.h
+++ b/src/mesa/drivers/dri/i965/intel_blit.h
@@ -31,12 +31,12 @@
 bool
 intelEmitCopyBlit(struct brw_context *brw,
                   GLuint cpp,
-                  GLshort src_pitch,
+                  uint32_t src_pitch,
                   drm_intel_bo *src_buffer,
                   GLuint src_offset,
                   uint32_t src_tiling,
                   uint32_t src_tr_mode,
-                  GLshort dst_pitch,
+                  uint32_t dst_pitch,
                   drm_intel_bo *dst_buffer,
                   GLuint dst_offset,
                   uint32_t dst_tiling,
-- 
2.11.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to