Mesa (master): freedreno/a6xx: compressed blit fixes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 7 00:34:54 UTC 2020


Module: Mesa
Branch: master
Commit: 193560c44bfe35655a111870773a8ff5f08ee5dd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=193560c44bfe35655a111870773a8ff5f08ee5dd

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu Feb 27 10:16:43 2020 -0800

freedreno/a6xx: compressed blit fixes

width/height are not necessarily aligned to block boundaries, so we need
to round up.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4868>

---

 src/gallium/drivers/freedreno/a6xx/fd6_blitter.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
index 21d5249451b..ce423af3684 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
@@ -801,15 +801,26 @@ handle_compressed_blit(struct fd_context *ctx, const struct pipe_blit_info *info
 	int bw = util_format_get_blockwidth(info->src.format);
 	int bh = util_format_get_blockheight(info->src.format);
 
+	/* NOTE: x/y *must* be aligned to block boundary (ie. in
+	 * glCompressedTexSubImage2D()) but width/height may not
+	 * be:
+	 */
+
+	debug_assert((blit.src.box.x % bw) == 0);
+	debug_assert((blit.src.box.y % bh) == 0);
+
 	blit.src.box.x /= bw;
 	blit.src.box.y /= bh;
-	blit.src.box.width /= bw;
-	blit.src.box.height /= bh;
+	blit.src.box.width  = DIV_ROUND_UP(blit.src.box.width, bw);
+	blit.src.box.height = DIV_ROUND_UP(blit.src.box.height, bh);
+
+	debug_assert((blit.dst.box.x % bw) == 0);
+	debug_assert((blit.dst.box.y % bh) == 0);
 
 	blit.dst.box.x /= bw;
 	blit.dst.box.y /= bh;
-	blit.dst.box.width /= bw;
-	blit.dst.box.height /= bh;
+	blit.dst.box.width  = DIV_ROUND_UP(blit.dst.box.width, bw);
+	blit.dst.box.height = DIV_ROUND_UP(blit.dst.box.height, bh);
 
 	return do_rewritten_blit(ctx, &blit);
 }



More information about the mesa-commit mailing list