pvr: fix infinite recursion in pvr_cmd_buffer_{start,end}_sub_cmd
authorSoroushIMG <soroush.kashani@imgtec.com>
Tue, 16 May 2023 13:22:15 +0000 (14:22 +0100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 8 Jun 2023 08:14:04 +0000 (08:14 +0000)
Reported-by: James Glanville <james.glanville@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23463>

src/imagination/vulkan/pvr_cmd_buffer.c

index fcdf20b..4eacf92 100644 (file)
@@ -1201,6 +1201,8 @@ pvr_sub_cmd_gfx_align_ds_subtiles(struct pvr_cmd_buffer *const cmd_buffer,
    };
 
    if (ds->load) {
+      cmd_buffer->state.current_sub_cmd = NULL;
+
       result =
          pvr_cmd_buffer_start_sub_cmd(cmd_buffer, PVR_SUB_CMD_TYPE_TRANSFER);
       if (result != VK_SUCCESS)
@@ -1226,9 +1228,13 @@ pvr_sub_cmd_gfx_align_ds_subtiles(struct pvr_cmd_buffer *const cmd_buffer,
        */
       list_move_to(&cmd_buffer->state.current_sub_cmd->link,
                    &prev_sub_cmd->link);
+
+      cmd_buffer->state.current_sub_cmd = prev_sub_cmd;
    }
 
    if (ds->store) {
+      cmd_buffer->state.current_sub_cmd = NULL;
+
       result =
          pvr_cmd_buffer_start_sub_cmd(cmd_buffer, PVR_SUB_CMD_TYPE_TRANSFER);
       if (result != VK_SUCCESS)
@@ -1249,6 +1255,8 @@ pvr_sub_cmd_gfx_align_ds_subtiles(struct pvr_cmd_buffer *const cmd_buffer,
       result = pvr_cmd_buffer_end_sub_cmd(cmd_buffer);
       if (result != VK_SUCCESS)
          return result;
+
+      cmd_buffer->state.current_sub_cmd = prev_sub_cmd;
    }
 
    /* Finally, patch up the target graphics sub_cmd to use the correctly-strided