From 3bb1a7959854253dfdca99f48d7226675a1267b9 Mon Sep 17 00:00:00 2001 From: Robert Tarasov Date: Thu, 20 May 2021 19:48:16 -0700 Subject: [PATCH] iris: Check data alignment for copy_mem_mem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check both source and destination offsets are aligned to 4. This patch fixes dEQP-GLES{2|3}.functional.buffer.write.random.* tests failures on guest side while trying to copy small (<16b) buffers via glBufferSubData() with offset which isn't aligned to 4. Fixes: 9b1b9714 ("iris: Use MI_COPY_MEM_MEM for tiny resource_copy_region calls.") Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Lionel Landwerlin lionel.g.landwerlin@intel.com Reviewed-by: Marcin Ĺšlusarz marcin.slusarz@intel.com Part-of: (cherry picked from commit a04d0a304ab9d7f84bd21643cd93584d1dc23adc) --- .pick_status.json | 2 +- src/gallium/drivers/iris/iris_blit.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 353409fec17..cdc2540803b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -526,7 +526,7 @@ "description": "iris: Check data alignment for copy_mem_mem", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "9b1b9714915c3e3d08582fd1d77f182cdf3e5090" }, diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c index 1dc07d883c0..eb70a834c77 100644 --- a/src/gallium/drivers/iris/iris_blit.c +++ b/src/gallium/drivers/iris/iris_blit.c @@ -752,7 +752,8 @@ iris_resource_copy_region(struct pipe_context *ctx, /* Use MI_COPY_MEM_MEM for tiny (<= 16 byte, % 4) buffer copies. */ if (p_src->target == PIPE_BUFFER && p_dst->target == PIPE_BUFFER && - (src_box->width % 4 == 0) && src_box->width <= 16) { + dstx % 4 == 0 && src_box->x % 4 == 0 && + src_box->width % 4 == 0 && src_box->width <= 16) { struct iris_bo *dst_bo = iris_resource_bo(p_dst); batch = get_preferred_batch(ice, dst_bo); iris_batch_maybe_flush(batch, 24 + 5 * (src_box->width / 4));