Mesa (staging/22.1): radv: Skip setting empty index buffers to avoid hang

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 27 22:16:31 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 1aa9acc68b32da033f672a506379d05a87107c76
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1aa9acc68b32da033f672a506379d05a87107c76

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Sun Jan 30 01:54:12 2022 +0100

radv: Skip setting empty index buffers to avoid hang

In the direct path we already skipped draws, but in DGC I noticed
that just emitting these packets can cause issues ...

Cc: mesa-stable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17269>
(cherry picked from commit 82c2e99102343f1538ae2ccdb15a0747d9510ca3)

---

 .pick_status.json                |  2 +-
 src/amd/vulkan/radv_cmd_buffer.c | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index d5edab9f315..56312ec4590 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -5575,7 +5575,7 @@
         "description": "radv: Skip setting empty index buffers to avoid hang",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index f318f0e50f4..27a75896589 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2631,12 +2631,15 @@ radv_emit_index_buffer(struct radv_cmd_buffer *cmd_buffer, bool indirect)
    if (!indirect)
       return;
 
-   radeon_emit(cs, PKT3(PKT3_INDEX_BASE, 1, 0));
-   radeon_emit(cs, state->index_va);
-   radeon_emit(cs, state->index_va >> 32);
+   if (state->max_index_count ||
+       !cmd_buffer->device->physical_device->rad_info.has_zero_index_buffer_bug) {
+      radeon_emit(cs, PKT3(PKT3_INDEX_BASE, 1, 0));
+      radeon_emit(cs, state->index_va);
+      radeon_emit(cs, state->index_va >> 32);
 
-   radeon_emit(cs, PKT3(PKT3_INDEX_BUFFER_SIZE, 0, 0));
-   radeon_emit(cs, state->max_index_count);
+      radeon_emit(cs, PKT3(PKT3_INDEX_BUFFER_SIZE, 0, 0));
+      radeon_emit(cs, state->max_index_count);
+   }
 
    cmd_buffer->state.dirty &= ~RADV_CMD_DIRTY_INDEX_BUFFER;
 }



More information about the mesa-commit mailing list