pvr: Handle PVR_SUB_COMMAND_FLAG_TRANSFER_SERIALIZE_WITH_FRAG.
authorKarmjit Mahil <Karmjit.Mahil@imgtec.com>
Wed, 16 Nov 2022 16:38:18 +0000 (16:38 +0000)
committerMarge Bot <emma+marge@anholt.net>
Thu, 1 Dec 2022 14:55:55 +0000 (14:55 +0000)
The flag was previously named PVR_SUB_COMMAND_FLAG_WAIT_ON_PREVIOUS_FRAG.
Since the next fragment job is also made to wait for the transfer
job to complete, the previous name might have been a bit misleading.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19957>

src/imagination/vulkan/pvr_cmd_buffer.c
src/imagination/vulkan/pvr_private.h
src/imagination/vulkan/pvr_queue.c

index f89c8de4d7ccaaacdc33d4c9f32c9c2df5d805fb..0adcff92c6f1e003d6ef4a771ce9ffbb05b1d853 100644 (file)
@@ -5604,7 +5604,7 @@ pvr_resolve_unemitted_resolve_attachments(struct pvr_cmd_buffer *cmd_buffer,
       dst_view->vk.image->format = dst_format;
 
       state->current_sub_cmd->flags |=
-         PVR_SUB_COMMAND_FLAG_WAIT_ON_PREVIOUS_FRAG;
+         PVR_SUB_COMMAND_FLAG_TRANSFER_SERIALIZE_WITH_FRAG;
 
       if (result != VK_SUCCESS)
          return result;
index 21c6a1f31ce12418ac4026169f8a1f64831bf1c3..71470d94bfbd75bd97f17cf4580198b0613c0fe1 100644 (file)
@@ -118,7 +118,7 @@ enum pvr_event_type {
 };
 
 enum pvr_sub_command_flags {
-   PVR_SUB_COMMAND_FLAG_WAIT_ON_PREVIOUS_FRAG = BITFIELD_BIT(0),
+   PVR_SUB_COMMAND_FLAG_TRANSFER_SERIALIZE_WITH_FRAG = BITFIELD_BIT(0),
    PVR_SUB_COMMAND_FLAG_OCCLUSION_QUERY = BITFIELD_BIT(1),
 };
 
index b22d1d21beea61648101565fcaec00b7c8f76b31..884bb0b121033ab3ed5a3069e8270ca5dc0b1fa8 100644 (file)
@@ -429,6 +429,8 @@ static VkResult pvr_process_event_cmd_barrier(
    uint32_t src_syncobj_count = 0;
    VkResult result;
 
+   assert(sub_cmd->type == PVR_EVENT_TYPE_BARRIER);
+
    assert(!(src_mask & ~PVR_PIPELINE_STAGE_ALL_BITS));
    assert(!(dst_mask & ~PVR_PIPELINE_STAGE_ALL_BITS));
 
@@ -726,9 +728,7 @@ static VkResult pvr_process_cmd_buffer(
                              sub_cmd,
                              &cmd_buffer->sub_cmds,
                              link) {
-      /* TODO: Process PVR_SUB_COMMAND_FLAG_WAIT_ON_PREVIOUS_FRAG and
-       * PVR_SUB_COMMAND_FLAG_OCCLUSION_QUERY flags.
-       */
+      /* TODO: Process  PVR_SUB_COMMAND_FLAG_OCCLUSION_QUERY flag. */
 
       switch (sub_cmd->type) {
       case PVR_SUB_CMD_TYPE_GRAPHICS:
@@ -755,7 +755,30 @@ static VkResult pvr_process_cmd_buffer(
                                           per_cmd_buffer_syncobjs);
          break;
 
-      case PVR_SUB_CMD_TYPE_TRANSFER:
+      case PVR_SUB_CMD_TYPE_TRANSFER: {
+         const bool serialize_with_frag =
+            sub_cmd->flags & PVR_SUB_COMMAND_FLAG_TRANSFER_SERIALIZE_WITH_FRAG;
+
+         if (serialize_with_frag) {
+            struct pvr_sub_cmd_event frag_to_transfer_barrier = {
+               .type = PVR_EVENT_TYPE_BARRIER,
+               .barrier = {
+                  .wait_for_stage_mask = PVR_PIPELINE_STAGE_FRAG_BIT,
+                  .wait_at_stage_mask = PVR_PIPELINE_STAGE_TRANSFER_BIT,
+               },
+            };
+
+            result = pvr_process_event_cmd_barrier(device,
+                                                   &frag_to_transfer_barrier,
+                                                   barriers,
+                                                   per_cmd_buffer_syncobjs,
+                                                   per_submit_syncobjs,
+                                                   queue_syncobjs,
+                                                   previous_queue_syncobjs);
+            if (result != VK_SUCCESS)
+               break;
+         }
+
          result = pvr_process_transfer_cmds(device,
                                             queue,
                                             &sub_cmd->transfer,
@@ -764,7 +787,30 @@ static VkResult pvr_process_cmd_buffer(
                                             wait_count,
                                             stage_flags,
                                             per_cmd_buffer_syncobjs);
+
+         if (serialize_with_frag) {
+            struct pvr_sub_cmd_event transfer_to_frag_barrier = {
+               .type = PVR_EVENT_TYPE_BARRIER,
+               .barrier = {
+                  .wait_for_stage_mask = PVR_PIPELINE_STAGE_TRANSFER_BIT,
+                  .wait_at_stage_mask = PVR_PIPELINE_STAGE_FRAG_BIT,
+               },
+            };
+
+            if (result != VK_SUCCESS)
+               break;
+
+            result = pvr_process_event_cmd_barrier(device,
+                                                   &transfer_to_frag_barrier,
+                                                   barriers,
+                                                   per_cmd_buffer_syncobjs,
+                                                   per_submit_syncobjs,
+                                                   queue_syncobjs,
+                                                   previous_queue_syncobjs);
+         }
+
          break;
+      }
 
       case PVR_SUB_CMD_TYPE_OCCLUSION_QUERY:
          result = pvr_process_occlusion_query_cmd(