v3dv: don't emit the subpass RCL for jobs that have emitted their own
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 25 Mar 2020 11:09:12 +0000 (12:09 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 13 Oct 2020 21:21:28 +0000 (21:21 +0000)
This fixes multi-layer vkCmdClearAttachments CTS tests. The underlying
problem here is that even though this command runs inside a render pass,
it is implemented as a separate job that emits its own RCL to program
render target color clears, so we should not emit the subpass RCL for it.

Fixes 250+ CTS tests (all but a1r5g5b5) in:
dEQP-VK.api.image_clearing.core.clear_color_attachment.cube_layers.*
dEQP-VK.api.image_clearing.core.clear_color_attachment.multiple_layers.*
dEQP-VK.api.image_clearing.core.clear_depth_stencil_attachment.multiple_layers.*

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>

src/broadcom/vulkan/v3dv_cmd_buffer.c
src/broadcom/vulkan/v3dv_meta_clear.c

index ac75c2b..af3f6d1 100644 (file)
@@ -465,7 +465,18 @@ static void
 cmd_buffer_end_render_pass_frame(struct v3dv_cmd_buffer *cmd_buffer)
 {
    assert(cmd_buffer->state.job);
-   cmd_buffer_emit_render_pass_rcl(cmd_buffer);
+
+   /* Typically, we have a single job for each subpass and we emit the job's RCL
+    * here when we are ending the frame for the subpass. However, some commands
+    * such as vkCmdClearAttachments need to run in their own separate job and
+    * they emit their own RCL even if they execute inside a subpass. In this
+    * scenario, we don't want to emit subpass RCL when we end the frame for
+    * those jobs, so we only emit the subpass RCL if the job has not recorded
+    * any RCL commands of its own.
+    */
+   if (v3dv_cl_offset(&cmd_buffer->state.job->rcl) == 0)
+      cmd_buffer_emit_render_pass_rcl(cmd_buffer);
+
    v3dv_job_emit_binning_flush(cmd_buffer->state.job);
 }
 
index 00ef277..03c8867 100644 (file)
@@ -418,7 +418,9 @@ emit_tlb_clear(struct v3dv_cmd_buffer *cmd_buffer,
                       base_layer, layer_count);
 
    /* Since vkCmdClearAttachments executes inside a render pass command, this
-    * will emit the binner FLUSH packet.
+    * will emit the binner FLUSH packet. Notice that this won't emit the
+    * subpass RCL for this job though because it will see that the job has
+    * recorded its own RCL.
     */
    v3dv_cmd_buffer_finish_job(cmd_buffer);