iris: Check data alignment for copy_mem_mem

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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10910>
This commit is contained in:
Robert Tarasov 2021-05-20 19:48:16 -07:00 committed by Marge Bot
parent 43abed919e
commit a04d0a304a
1 changed files with 2 additions and 1 deletions

View File

@ -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));