pvr: fixup transfer primary sub-command list
authorLuigi Santivetti <luigi.santivetti@imgtec.com>
Mon, 3 Apr 2023 14:08:43 +0000 (15:08 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 30 Jun 2023 08:33:08 +0000 (08:33 +0000)
When we allocate a new primary sub-command of type
PVR_SUB_CMD_TYPE_TRANSFER we need to make sure the list backing
transfer sub-commands can be shared and managed by both the
secondary and primary sub-command. Do this by always using a
pointer to maintain the list.

Found with:
  dEQP-VK.memory.pipeline_barrier.host_write_transfer_src.8192

Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reported-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23918>

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

index 36e8349..b534b91 100644 (file)
@@ -110,7 +110,7 @@ static void pvr_cmd_buffer_free_sub_cmd(struct pvr_cmd_buffer *cmd_buffer,
       case PVR_SUB_CMD_TYPE_TRANSFER:
          list_for_each_entry_safe (struct pvr_transfer_cmd,
                                    transfer_cmd,
-                                   &sub_cmd->transfer.transfer_cmds,
+                                   sub_cmd->transfer.transfer_cmds,
                                    link) {
             list_del(&transfer_cmd->link);
             if (!transfer_cmd->is_deferred_clear)
@@ -2346,7 +2346,8 @@ VkResult pvr_cmd_buffer_start_sub_cmd(struct pvr_cmd_buffer *cmd_buffer,
       break;
 
    case PVR_SUB_CMD_TYPE_TRANSFER:
-      list_inithead(&sub_cmd->transfer.transfer_cmds);
+      sub_cmd->transfer.transfer_cmds = &sub_cmd->transfer.transfer_cmds_priv;
+      list_inithead(sub_cmd->transfer.transfer_cmds);
       break;
 
    case PVR_SUB_CMD_TYPE_EVENT:
@@ -3255,7 +3256,7 @@ VkResult pvr_cmd_buffer_add_transfer_cmd(struct pvr_cmd_buffer *cmd_buffer,
 
    sub_cmd = &cmd_buffer->state.current_sub_cmd->transfer;
 
-   list_addtail(&transfer_cmd->link, &sub_cmd->transfer_cmds);
+   list_addtail(&transfer_cmd->link, sub_cmd->transfer_cmds);
 
    return VK_SUCCESS;
 }
index e7fc5e5..1dbe9aa 100644 (file)
@@ -5878,7 +5878,7 @@ VkResult pvr_transfer_job_submit(struct pvr_transfer_ctx *ctx,
 {
    list_for_each_entry_safe (struct pvr_transfer_cmd,
                              transfer_cmd,
-                             &sub_cmd->transfer_cmds,
+                             sub_cmd->transfer_cmds,
                              link) {
       /* The fw guarantees that any kick on the same context will be
        * synchronized in submission order. This means only the first kick must
@@ -5888,13 +5888,13 @@ VkResult pvr_transfer_job_submit(struct pvr_transfer_ctx *ctx,
       struct vk_sync *last_cmd_signal_sync = NULL;
       VkResult result;
 
-      if (list_first_entry(&sub_cmd->transfer_cmds,
-                          struct pvr_transfer_cmd,
-                          link) == transfer_cmd) {
+      if (list_first_entry(sub_cmd->transfer_cmds,
+                           struct pvr_transfer_cmd,
+                           link) == transfer_cmd) {
          first_cmd_wait_sync = wait_sync;
       }
 
-      if (list_last_entry(&sub_cmd->transfer_cmds,
+      if (list_last_entry(sub_cmd->transfer_cmds,
                           struct pvr_transfer_cmd,
                           link) == transfer_cmd) {
          last_cmd_signal_sync = signal_sync;
index 19e7507..37a84c8 100644 (file)
@@ -523,8 +523,15 @@ struct pvr_sub_cmd_compute {
 struct pvr_sub_cmd_transfer {
    bool serialize_with_frag;
 
-   /* List of pvr_transfer_cmd type structures. */
-   struct list_head transfer_cmds;
+   /* Pointer to the actual transfer command list, allowing primary and
+    * secondary sub-commands to share the same list.
+    */
+   struct list_head *transfer_cmds;
+
+   /* List of pvr_transfer_cmd type structures. Do not access the list
+    * directly, but always use the transfer_cmds pointer above.
+    */
+   struct list_head transfer_cmds_priv;
 };
 
 struct pvr_sub_cmd_event {