From 58e95f99bd5dde83eb2a7ab6d1ee2735eed432d9 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 11 Aug 2021 13:32:41 -0400 Subject: [PATCH] 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: --- 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. */