From 49b433d5e7227e05e9b2f9103263a6dba55e9f7a Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Thu, 18 Jul 2024 23:35:40 -0700 Subject: [PATCH] iris: Pin pixel hashing table BO from iris_batch submission instead of from iris_state. This fixes sporadic rendering corruption reported on MTL with ChromeOS in cases where multiple processes including Chrome were utilizing the GPU concurrently, and one of the processes happened to submit a BLORP-only batch buffer right after a switch from a different context. In such a scenario we would fail to add the BO that holds the pixel hashing tables to the execbuf IOCTL for the BLORP batch, because it was being pinned from iris_restore_render_saved_bos() which isn't called for BLORP operations, potentially causing it to use garbage as pixel pipe hashing tables, which led to corruption of the BLORP rendering. Technically this could have affected DG2 as well, but it has only been reported on MTL so far. Cc: mesa-stable Reviewed-by: Lionel Landwerlin Tested-by: Sushma Venkatesh Reddy Part-of: --- src/gallium/drivers/iris/iris_batch.c | 14 ++++++++++++++ src/gallium/drivers/iris/iris_state.c | 7 ------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index 354cccbf8be..01c180eb644 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -626,6 +626,19 @@ add_aux_map_bos_to_batch(struct iris_batch *batch) } } +static void +add_pixel_hash_table_bo_to_batch(struct iris_batch *batch) +{ + + if (batch->ice->state.pixel_hashing_tables && + batch->name == IRIS_BATCH_RENDER) { + struct iris_bo *bo = iris_resource_bo( + batch->ice->state.pixel_hashing_tables); + ensure_exec_obj_space(batch, 1); + add_bo_to_batch(batch, bo, false); + } +} + static void finish_seqno(struct iris_batch *batch) { @@ -658,6 +671,7 @@ iris_finish_batch(struct iris_batch *batch) } add_aux_map_bos_to_batch(batch); + add_pixel_hash_table_bo_to_batch(batch); finish_seqno(batch); diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index d9c8d6d04c4..96613485e65 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -5971,13 +5971,6 @@ iris_restore_render_saved_bos(struct iris_context *ice, IRIS_DOMAIN_VF_READ); } } - -#if GFX_VERx10 == 125 - iris_use_pinned_bo(batch, iris_resource_bo(ice->state.pixel_hashing_tables), - false, IRIS_DOMAIN_NONE); -#else - assert(!ice->state.pixel_hashing_tables); -#endif } static void