<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 10, 2019 at 6:21 AM Ville Syrjala <<a href="mailto:ville.syrjala@linux.intel.com">ville.syrjala@linux.intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Ville Syrjälä <<a href="mailto:ville.syrjala@linux.intel.com" target="_blank">ville.syrjala@linux.intel.com</a>><br>
<br>
Modern DXVK requires event support [1], but looks like it only<br>
uses vkCmdSetEvent() + vkGetEventStatus(). So we can just<br>
borrow the relevant code from gen8, leaving CmdWaitEvents still<br>
unimplemented.<br>
<br>
[1] <a href="https://github.com/doitsujin/dxvk/commit/8c3900c533d83d12c970b905183d17a1d3e8df1f" rel="noreferrer" target="_blank">https://github.com/doitsujin/dxvk/commit/8c3900c533d83d12c970b905183d17a1d3e8df1f</a><br>
<br>
v2: Also move CmdWaitEvents into genX_cmd_buffer.c (Jason)<br>
<br>
Signed-off-by: Ville Syrjälä <<a href="mailto:ville.syrjala@linux.intel.com" target="_blank">ville.syrjala@linux.intel.com</a>><br>
---<br>
 src/intel/vulkan/gen7_cmd_buffer.c |  38 ----------<br>
 src/intel/vulkan/gen8_cmd_buffer.c | 102 ---------------------------<br>
 src/intel/vulkan/genX_cmd_buffer.c | 107 +++++++++++++++++++++++++++++<br>
 3 files changed, 107 insertions(+), 140 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/gen7_cmd_buffer.c b/src/intel/vulkan/gen7_cmd_buffer.c<br>
index 380283bdd563..115d12b35362 100644<br>
--- a/src/intel/vulkan/gen7_cmd_buffer.c<br>
+++ b/src/intel/vulkan/gen7_cmd_buffer.c<br>
@@ -286,41 +286,3 @@ genX(cmd_buffer_enable_pma_fix)(struct anv_cmd_buffer *cmd_buffer,<br>
 {<br>
    /* The NP PMA fix doesn't exist on gen7 */<br>
 }<br>
-<br>
-void genX(CmdSetEvent)(<br>
-    VkCommandBuffer                             commandBuffer,<br>
-    VkEvent                                     event,<br>
-    VkPipelineStageFlags                        stageMask)<br>
-{<br>
-   anv_finishme("Implement events on gen7");<br>
-}<br>
-<br>
-void genX(CmdResetEvent)(<br>
-    VkCommandBuffer                             commandBuffer,<br>
-    VkEvent                                     event,<br>
-    VkPipelineStageFlags                        stageMask)<br>
-{<br>
-   anv_finishme("Implement events on gen7");<br>
-}<br>
-<br>
-void genX(CmdWaitEvents)(<br>
-    VkCommandBuffer                             commandBuffer,<br>
-    uint32_t                                    eventCount,<br>
-    const VkEvent*                              pEvents,<br>
-    VkPipelineStageFlags                        srcStageMask,<br>
-    VkPipelineStageFlags                        destStageMask,<br>
-    uint32_t                                    memoryBarrierCount,<br>
-    const VkMemoryBarrier*                      pMemoryBarriers,<br>
-    uint32_t                                    bufferMemoryBarrierCount,<br>
-    const VkBufferMemoryBarrier*                pBufferMemoryBarriers,<br>
-    uint32_t                                    imageMemoryBarrierCount,<br>
-    const VkImageMemoryBarrier*                 pImageMemoryBarriers)<br>
-{<br>
-   anv_finishme("Implement events on gen7");<br>
-<br>
-   genX(CmdPipelineBarrier)(commandBuffer, srcStageMask, destStageMask,<br>
-                            false, /* byRegion */<br>
-                            memoryBarrierCount, pMemoryBarriers,<br>
-                            bufferMemoryBarrierCount, pBufferMemoryBarriers,<br>
-                            imageMemoryBarrierCount, pImageMemoryBarriers);<br>
-}<br>
diff --git a/src/intel/vulkan/gen8_cmd_buffer.c b/src/intel/vulkan/gen8_cmd_buffer.c<br>
index 6568d2c75113..2e6d9de9f4a8 100644<br>
--- a/src/intel/vulkan/gen8_cmd_buffer.c<br>
+++ b/src/intel/vulkan/gen8_cmd_buffer.c<br>
@@ -565,105 +565,3 @@ void genX(CmdBindIndexBuffer)(<br>
<br>
    cmd_buffer->state.gfx.dirty |= ANV_CMD_DIRTY_INDEX_BUFFER;<br>
 }<br>
-<br>
-/* Set of stage bits for which are pipelined, i.e. they get queued by the<br>
- * command streamer for later execution.<br>
- */<br>
-#define ANV_PIPELINE_STAGE_PIPELINED_BITS \<br>
-   (VK_PIPELINE_STAGE_VERTEX_INPUT_BIT | \<br>
-    VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | \<br>
-    VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | \<br>
-    VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | \<br>
-    VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | \<br>
-    VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | \<br>
-    VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | \<br>
-    VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | \<br>
-    VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | \<br>
-    VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | \<br>
-    VK_PIPELINE_STAGE_TRANSFER_BIT | \<br>
-    VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT | \<br>
-    VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | \<br>
-    VK_PIPELINE_STAGE_ALL_COMMANDS_BIT)<br>
-<br>
-void genX(CmdSetEvent)(<br>
-    VkCommandBuffer                             commandBuffer,<br>
-    VkEvent                                     _event,<br>
-    VkPipelineStageFlags                        stageMask)<br>
-{<br>
-   ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);<br>
-   ANV_FROM_HANDLE(anv_event, event, _event);<br>
-<br>
-   anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {<br>
-      if (stageMask & ANV_PIPELINE_STAGE_PIPELINED_BITS) {<br>
-         pc.StallAtPixelScoreboard = true;<br>
-         pc.CommandStreamerStallEnable = true;<br>
-      }<br>
-<br>
-      pc.DestinationAddressType  = DAT_PPGTT,<br>
-      pc.PostSyncOperation       = WriteImmediateData,<br>
-      pc.Address = (struct anv_address) {<br>
-         cmd_buffer->device-><a href="http://dynamic_state_pool.block_pool.bo" rel="noreferrer" target="_blank">dynamic_state_pool.block_pool.bo</a>,<br>
-         event->state.offset<br>
-      };<br>
-      pc.ImmediateData           = VK_EVENT_SET;<br>
-   }<br>
-}<br>
-<br>
-void genX(CmdResetEvent)(<br>
-    VkCommandBuffer                             commandBuffer,<br>
-    VkEvent                                     _event,<br>
-    VkPipelineStageFlags                        stageMask)<br>
-{<br>
-   ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);<br>
-   ANV_FROM_HANDLE(anv_event, event, _event);<br>
-<br>
-   anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {<br>
-      if (stageMask & ANV_PIPELINE_STAGE_PIPELINED_BITS) {<br>
-         pc.StallAtPixelScoreboard = true;<br>
-         pc.CommandStreamerStallEnable = true;<br>
-      }<br>
-<br>
-      pc.DestinationAddressType  = DAT_PPGTT;<br>
-      pc.PostSyncOperation       = WriteImmediateData;<br>
-      pc.Address = (struct anv_address) {<br>
-         cmd_buffer->device-><a href="http://dynamic_state_pool.block_pool.bo" rel="noreferrer" target="_blank">dynamic_state_pool.block_pool.bo</a>,<br>
-         event->state.offset<br>
-      };<br>
-      pc.ImmediateData           = VK_EVENT_RESET;<br>
-   }<br>
-}<br>
-<br>
-void genX(CmdWaitEvents)(<br>
-    VkCommandBuffer                             commandBuffer,<br>
-    uint32_t                                    eventCount,<br>
-    const VkEvent*                              pEvents,<br>
-    VkPipelineStageFlags                        srcStageMask,<br>
-    VkPipelineStageFlags                        destStageMask,<br>
-    uint32_t                                    memoryBarrierCount,<br>
-    const VkMemoryBarrier*                      pMemoryBarriers,<br>
-    uint32_t                                    bufferMemoryBarrierCount,<br>
-    const VkBufferMemoryBarrier*                pBufferMemoryBarriers,<br>
-    uint32_t                                    imageMemoryBarrierCount,<br>
-    const VkImageMemoryBarrier*                 pImageMemoryBarriers)<br>
-{<br>
-   ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);<br>
-   for (uint32_t i = 0; i < eventCount; i++) {<br>
-      ANV_FROM_HANDLE(anv_event, event, pEvents[i]);<br>
-<br>
-      anv_batch_emit(&cmd_buffer->batch, GENX(MI_SEMAPHORE_WAIT), sem) {<br>
-         sem.WaitMode            = PollingMode,<br>
-         sem.CompareOperation    = COMPARE_SAD_EQUAL_SDD,<br>
-         sem.SemaphoreDataDword  = VK_EVENT_SET,<br>
-         sem.SemaphoreAddress = (struct anv_address) {<br>
-            cmd_buffer->device-><a href="http://dynamic_state_pool.block_pool.bo" rel="noreferrer" target="_blank">dynamic_state_pool.block_pool.bo</a>,<br>
-            event->state.offset<br>
-         };<br>
-      }<br>
-   }<br>
-<br>
-   genX(CmdPipelineBarrier)(commandBuffer, srcStageMask, destStageMask,<br>
-                            false, /* byRegion */<br>
-                            memoryBarrierCount, pMemoryBarriers,<br>
-                            bufferMemoryBarrierCount, pBufferMemoryBarriers,<br>
-                            imageMemoryBarrierCount, pImageMemoryBarriers);<br>
-}<br>
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c<br>
index f171d02dab72..c57c02a08da7 100644<br>
--- a/src/intel/vulkan/genX_cmd_buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_buffer.c<br>
@@ -4729,3 +4729,110 @@ void genX(CmdEndConditionalRenderingEXT)(<br>
    cmd_state->conditional_render_enabled = false;<br>
 }<br>
 #endif<br>
+<br>
+/* Set of stage bits for which are pipelined, i.e. they get queued by the<br>
+ * command streamer for later execution.<br>
+ */<br>
+#define ANV_PIPELINE_STAGE_PIPELINED_BITS \<br>
+   (VK_PIPELINE_STAGE_VERTEX_INPUT_BIT | \<br>
+    VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | \<br>
+    VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT | \<br>
+    VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT | \<br>
+    VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | \<br>
+    VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | \<br>
+    VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | \<br>
+    VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT | \<br>
+    VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | \<br>
+    VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | \<br>
+    VK_PIPELINE_STAGE_TRANSFER_BIT | \<br>
+    VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT | \<br>
+    VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | \<br>
+    VK_PIPELINE_STAGE_ALL_COMMANDS_BIT)<br>
+<br>
+void genX(CmdSetEvent)(<br>
+    VkCommandBuffer                             commandBuffer,<br>
+    VkEvent                                     _event,<br>
+    VkPipelineStageFlags                        stageMask)<br>
+{<br>
+   ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);<br>
+   ANV_FROM_HANDLE(anv_event, event, _event);<br>
+<br>
+   anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {<br>
+      if (stageMask & ANV_PIPELINE_STAGE_PIPELINED_BITS) {<br>
+         pc.StallAtPixelScoreboard = true;<br>
+         pc.CommandStreamerStallEnable = true;<br>
+      }<br>
+<br>
+      pc.DestinationAddressType  = DAT_PPGTT,<br>
+      pc.PostSyncOperation       = WriteImmediateData,<br>
+      pc.Address = (struct anv_address) {<br>
+         cmd_buffer->device-><a href="http://dynamic_state_pool.block_pool.bo" rel="noreferrer" target="_blank">dynamic_state_pool.block_pool.bo</a>,<br>
+         event->state.offset<br>
+      };<br>
+      pc.ImmediateData           = VK_EVENT_SET;<br>
+   }<br>
+}<br>
+<br>
+void genX(CmdResetEvent)(<br>
+    VkCommandBuffer                             commandBuffer,<br>
+    VkEvent                                     _event,<br>
+    VkPipelineStageFlags                        stageMask)<br>
+{<br>
+   ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);<br>
+   ANV_FROM_HANDLE(anv_event, event, _event);<br>
+<br>
+   anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {<br>
+      if (stageMask & ANV_PIPELINE_STAGE_PIPELINED_BITS) {<br>
+         pc.StallAtPixelScoreboard = true;<br>
+         pc.CommandStreamerStallEnable = true;<br>
+      }<br>
+<br>
+      pc.DestinationAddressType  = DAT_PPGTT;<br>
+      pc.PostSyncOperation       = WriteImmediateData;<br>
+      pc.Address = (struct anv_address) {<br>
+         cmd_buffer->device-><a href="http://dynamic_state_pool.block_pool.bo" rel="noreferrer" target="_blank">dynamic_state_pool.block_pool.bo</a>,<br>
+         event->state.offset<br>
+      };<br>
+      pc.ImmediateData           = VK_EVENT_RESET;<br>
+   }<br>
+}<br>
+<br>
+void genX(CmdWaitEvents)(<br>
+    VkCommandBuffer                             commandBuffer,<br>
+    uint32_t                                    eventCount,<br>
+    const VkEvent*                              pEvents,<br>
+    VkPipelineStageFlags                        srcStageMask,<br>
+    VkPipelineStageFlags                        destStageMask,<br>
+    uint32_t                                    memoryBarrierCount,<br>
+    const VkMemoryBarrier*                      pMemoryBarriers,<br>
+    uint32_t                                    bufferMemoryBarrierCount,<br>
+    const VkBufferMemoryBarrier*                pBufferMemoryBarriers,<br>
+    uint32_t                                    imageMemoryBarrierCount,<br>
+    const VkImageMemoryBarrier*                 pImageMemoryBarriers)<br>
+{<br>
+#if GEN_GEN >= 8<br>
+   ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);<br>
+<br>
+   for (uint32_t i = 0; i < eventCount; i++) {<br>
+      ANV_FROM_HANDLE(anv_event, event, pEvents[i]);<br>
+<br>
+      anv_batch_emit(&cmd_buffer->batch, GENX(MI_SEMAPHORE_WAIT), sem) {<br>
+         sem.WaitMode            = PollingMode,<br>
+         sem.CompareOperation    = COMPARE_SAD_EQUAL_SDD,<br>
+         sem.SemaphoreDataDword  = VK_EVENT_SET,<br>
+         sem.SemaphoreAddress = (struct anv_address) {<br>
+            cmd_buffer->device-><a href="http://dynamic_state_pool.block_pool.bo" rel="noreferrer" target="_blank">dynamic_state_pool.block_pool.bo</a>,<br>
+            event->state.offset<br>
+         };<br>
+      }<br>
+   }<br>
+#else<br>
+   anv_finishme("Implement events on gen7");<br></blockquote></div><div class="gmail_quote"><br></div><div class="gmail_quote">Maybe change this to "implement event GPU waits on host signals on gen7" to be more specific.  Assuming you did your copy+paste correctly,</div><div class="gmail_quote"><br></div><div class="gmail_quote">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+#endif<br>
+<br>
+   genX(CmdPipelineBarrier)(commandBuffer, srcStageMask, destStageMask,<br>
+                            false, /* byRegion */<br>
+                            memoryBarrierCount, pMemoryBarriers,<br>
+                            bufferMemoryBarrierCount, pBufferMemoryBarriers,<br>
+                            imageMemoryBarrierCount, pImageMemoryBarriers);<br>
+}<br>
-- <br>
2.21.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a></blockquote></div></div>