radv: Simplify IB2 workaround.
authorTimur Kristóf <timur.kristof@gmail.com>
Mon, 17 Apr 2023 14:13:16 +0000 (16:13 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 19 Apr 2023 09:27:52 +0000 (09:27 +0000)
Move compute IB2 check to the winsys, because IB2 only works on
GFX queues and not any other queue types.

Then, simplify the workaround condition in the cmd buffer.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22533>

src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c

index 5cc066e..6de52df 100644 (file)
@@ -7503,20 +7503,13 @@ radv_CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCou
 
    for (uint32_t i = 0; i < commandBufferCount; i++) {
       RADV_FROM_HANDLE(radv_cmd_buffer, secondary, pCmdBuffers[i]);
-      bool allow_ib2 = true;
 
-      if (secondary->device->physical_device->rad_info.gfx_level <= GFX7 &&
-          secondary->state.uses_draw_indirect_multi) {
-         /* Do not launch an IB2 for secondary command buffers that contain
-          * DRAW_{INDEX}_INDIRECT_MULTI on GFX7 because it's illegal and hang the GPU.
-          */
-         allow_ib2 = false;
-      }
-
-      if (secondary->qf == RADV_QUEUE_COMPUTE) {
-         /* IB2 packets are not supported on compute queues according to PAL. */
-         allow_ib2 = false;
-      }
+      /* Do not launch an IB2 for secondary command buffers that contain
+       * DRAW_{INDEX}_INDIRECT_MULTI on GFX7 because it's illegal and hang the GPU.
+       */
+      const bool allow_ib2 =
+         !secondary->state.uses_draw_indirect_multi ||
+         secondary->device->physical_device->rad_info.gfx_level >= GFX8;
 
       primary->scratch_size_per_wave_needed =
          MAX2(primary->scratch_size_per_wave_needed, secondary->scratch_size_per_wave_needed);
index 1b00755..ee2108b 100644 (file)
@@ -648,7 +648,7 @@ radv_amdgpu_cs_execute_secondary(struct radeon_cmdbuf *_parent, struct radeon_cm
    struct radv_amdgpu_cs *parent = radv_amdgpu_cs(_parent);
    struct radv_amdgpu_cs *child = radv_amdgpu_cs(_child);
    struct radv_amdgpu_winsys *ws = parent->ws;
-   bool use_ib2 = parent->use_ib && allow_ib2;
+   const bool use_ib2 = parent->use_ib && allow_ib2 && parent->hw_ip == AMD_IP_GFX;
 
    if (parent->status != VK_SUCCESS || child->status != VK_SUCCESS)
       return;