RGP will crash if we emit a layout transition marker outside a barrier.
If this happens, trigger an assertion if its enabled or silently discard
the marker otherwise to avoid traces that cannot be opened.
Also, guard against attempts to start barrier markers recursively, since
this will corrupt the internal start/end matching.
Closes: <https://gitlab.freedesktop.org/mesa/mesa/-/issues/7971>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21033>
if (likely(!cmd_buffer->device->sqtt.bo))
return;
+ if (cmd_buffer->state.in_barrier) {
+ assert(!"attempted to start a barrier while already in a barrier");
+ return;
+ }
+
radv_describe_barrier_end_delayed(cmd_buffer);
cmd_buffer->state.sqtt_flush_bits = 0;
+ cmd_buffer->state.in_barrier = true;
marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_BARRIER_START;
marker.cb_id = cmd_buffer->sqtt_cb_id;
void
radv_describe_barrier_end(struct radv_cmd_buffer *cmd_buffer)
{
+ cmd_buffer->state.in_barrier = false;
cmd_buffer->state.pending_sqtt_barrier_end = true;
}
if (likely(!cmd_buffer->device->sqtt.bo))
return;
+ if (!cmd_buffer->state.in_barrier) {
+ assert(!"layout transition marker should be only emitted inside a barrier marker");
+ return;
+ }
+
marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_LAYOUT_TRANSITION;
marker.depth_stencil_expand = barrier->layout_transitions.depth_stencil_expand;
marker.htile_hiz_range_expand = barrier->layout_transitions.htile_hiz_range_expand;
if (radv_layout_is_htile_compressed(cmd_buffer->device, dst_image, dst_image_layout,
queue_mask)) {
- radv_describe_barrier_start(cmd_buffer, RGP_BARRIER_UNKNOWN_REASON);
-
cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_CS_PARTIAL_FLUSH | RADV_CMD_FLAG_INV_VCACHE;
VkImageSubresourceRange range = {
uint32_t htile_value = radv_get_htile_initial_value(cmd_buffer->device, dst_image);
cmd_buffer->state.flush_bits |= radv_clear_htile(cmd_buffer, dst_image, &range, htile_value);
-
- radv_describe_barrier_end(cmd_buffer);
}
}
sample_locs_info->sampleLocationsCount);
}
- /* Implicit transitions only happens if traditional render passes are used.
- * Some meta shaders invoked during barrier handling could call CmdBeginRendering, and we need to
- * take care to not call radv_describe_barrier_start recursively.
+ /* Dynamic rendering does not have implicit transitions, so limit the marker to
+ * when a render pass is used.
+ * Additionally, some internal meta operations called inside a barrier may issue
+ * render calls (with dynamic rendering), so this makes sure those case don't
+ * create a nested barrier scope.
*/
if (cmd_buffer->vk.render_pass)
radv_describe_barrier_start(cmd_buffer, RGP_BARRIER_EXTERNAL_RENDER_PASS_SYNC);
uint32_t current_event_type;
uint32_t num_events;
uint32_t num_layout_transitions;
+ bool in_barrier;
bool pending_sqtt_barrier_end;
enum rgp_flush_bits sqtt_flush_bits;