Mesa (main): crocus/blt: add pitch/offset checks to fix blt corruption

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 11 19:33:08 UTC 2021


Module: Mesa
Branch: main
Commit: 58e95f99bd5dde83eb2a7ab6d1ee2735eed432d9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=58e95f99bd5dde83eb2a7ab6d1ee2735eed432d9

Author: Dave Airlie <airlied at gmail.com>
Date:   Wed Aug 11 13:32:41 2021 -0400

crocus/blt: add pitch/offset checks to fix blt corruption

I lost these in my conversion from i965 but they are necessary.

This should fix corruption in qt fonts at seen in the minecraft
launcher.

Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12329>

---

 src/gallium/drivers/crocus/crocus_blt.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/crocus/crocus_blt.c b/src/gallium/drivers/crocus/crocus_blt.c
index fd318a8dce8..fb194657a9b 100644
--- a/src/gallium/drivers/crocus/crocus_blt.c
+++ b/src/gallium/drivers/crocus/crocus_blt.c
@@ -188,6 +188,13 @@ static bool emit_copy_blt(struct crocus_batch *batch,
       }
    }
 
+   /* Blit pitch must be dword-aligned.  Otherwise, the hardware appears to drop
+    * the low bits.  Offsets must be naturally aligned.
+    */
+   if (src_pitch % 4 != 0 || src_offset % cpp != 0 ||
+       dst_pitch % 4 != 0 || dst_offset % cpp != 0)
+     return false;
+
    /* For tiled source and destination, pitch value should be specified
     * as a number of Dwords.
     */



More information about the mesa-commit mailing list