summaryrefslogtreecommitdiffstats
path: root/src/intel/blorp
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-10-25 22:47:21 -0700
committerEmil Velikov <emil.l.velikov@gmail.com>2016-11-01 12:31:43 +0000
commit875534e14c1ceccc22fbf18003ad2a5b44407a38 (patch)
treea127e26d70caa202ffa3d5b5e254d185be20d8d8 /src/intel/blorp
parent06baf2cd864dd9ca88644843b8f08a4e7a93331a (diff)
downloadexternal_mesa3d-875534e14c1ceccc22fbf18003ad2a5b44407a38.zip
external_mesa3d-875534e14c1ceccc22fbf18003ad2a5b44407a38.tar.gz
external_mesa3d-875534e14c1ceccc22fbf18003ad2a5b44407a38.tar.bz2
intel/blorp: Fix a couple asserts around image copy rectangles
With dealing with rectangles in compressed images, you can have a width or height that isn't a multiple of the corresponding compression block dimension but only if that edge of your rectangle is on the edge of the image. When we call convert_to_single_slice, it creates an 2-D image and a set of tile offsets into that image. When detecting the right-edge and bottom-edge cases, we weren't including the tile offsets so the assert would misfire. This caused crashes in a few UE4 demos Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reported-by: "Eero Tamminen" <eero.t.tamminen@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98431 Cc: "13.0" <mesa-stable@lists.freedesktop.org> Tested-by: "Eero Tamminen" <eero.t.tamminen@intel.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (cherry picked from commit 4964a5149b7776ce27aaeab2be0c2ebf41ded740)
Diffstat (limited to 'src/intel/blorp')
-rw-r--r--src/intel/blorp/blorp_blit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 0c3ee72..9357a72 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -1761,10 +1761,14 @@ surf_convert_to_uncompressed(const struct isl_device *isl_dev,
surf_convert_to_single_slice(isl_dev, info);
if (width || height) {
+#ifndef NDEBUG
+ uint32_t right_edge_px = info->tile_x_sa + *x + *width;
+ uint32_t bottom_edge_px = info->tile_y_sa + *y + *height;
assert(*width % fmtl->bw == 0 ||
- *x + *width == info->surf.logical_level0_px.width);
+ right_edge_px == info->surf.logical_level0_px.width);
assert(*height % fmtl->bh == 0 ||
- *y + *height == info->surf.logical_level0_px.height);
+ bottom_edge_px == info->surf.logical_level0_px.height);
+#endif
*width = DIV_ROUND_UP(*width, fmtl->bw);
*height = DIV_ROUND_UP(*height, fmtl->bh);
}