anv: force MEDIA_INTERFACE_DESCRIPTOR_LOAD reemit after 3D->GPGPU switch
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sun, 12 Jun 2022 20:59:05 +0000 (23:59 +0300)
committerMarge Bot <emma+marge@anholt.net>
Wed, 8 Mar 2023 23:09:36 +0000 (23:09 +0000)
Seems to fix a hang in the following titles :
   - Age of Empire 4
   - Monster Hunter Rise

where the HW is hung on a PIPE_CONTROL after a GPGPU_WALKER but no
MEDIA_INTERFACE_DESCRIPTOR_LOAD was emitted since the switch from 3D
to GPGPU.

This would happen in the following case :

   vkCmdBindPipeline(COMPUTE, cs_pipeline);
   vkCmdDispatch(...);
   vkCmdBindPipeline(GRAPHICS, gfx_pipeline);
   vkCmdDraw(...);
   vkCmdDispatch(...);

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17247>

src/intel/vulkan/genX_cmd_buffer.c

index 19cb294..d28852d 100644 (file)
@@ -6470,6 +6470,20 @@ genX(flush_pipeline_select)(struct anv_cmd_buffer *cmd_buffer,
       anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CC_STATE_POINTERS), t);
 #endif
 
+#if GFX_VERx10 == 120
+   /* Undocumented workaround to force the re-emission of
+    * MEDIA_INTERFACE_DESCRIPTOR_LOAD when switching from 3D to Compute
+    * pipeline without rebinding a pipeline :
+    *    vkCmdBindPipeline(COMPUTE, cs_pipeline);
+    *    vkCmdDispatch(...);
+    *    vkCmdBindPipeline(GRAPHICS, gfx_pipeline);
+    *    vkCmdDraw(...);
+    *    vkCmdDispatch(...);
+    */
+   if (pipeline == _3D)
+      cmd_buffer->state.compute.pipeline_dirty = true;
+#endif
+
 #if GFX_VER >= 12
    /* From Tigerlake PRM, Volume 2a, PIPELINE_SELECT:
     *