v3dv: ensure we apply binning syncs to secondary command buffers

Currently, we postpone binning syncs until we record draw calls
and can validate if any of them require accessing protected
resources in the binning stage, however, if the draw calls are
recorded in a secondary command buffer and the barriers have
been recorded in the primary command buffer, we won't apply the
binning sync in the secondary when we record the draw calls
and so we must apply it when we execute the secondary in the
primary.

Fixes flakyness in:
dEQP-VK.api.command_buffers.record_many_draws_secondary_2

cc: mesa-stable

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21162>
This commit is contained in:
Iago Toral Quiroga
2023-02-07 13:06:48 +01:00
parent c2601f0690
commit fec15a225f
4 changed files with 22 additions and 6 deletions
-2
View File
@@ -14,8 +14,6 @@ spec@egl 1.4@largest possible eglcreatepbuffersurface and then glclear
# This test works alone, but fails when executing all the tests together
dEQP-GLES3.functional.texture.specification.teximage2d_pbo.rgba32ui_2d
dEQP-VK.api.command_buffers.record_many_draws_secondary_2
dEQP-VK.api.external.fence.opaque_fd.reset_permanent
dEQP-VK.api.external.fence.opaque_fd.reset_temporary
+4 -3
View File
@@ -2809,8 +2809,9 @@ cmd_buffer_binning_sync_required(struct v3dv_cmd_buffer *cmd_buffer,
return false;
}
static void
consume_bcl_sync(struct v3dv_cmd_buffer *cmd_buffer, struct v3dv_job *job)
void
v3dv_cmd_buffer_consume_bcl_sync(struct v3dv_cmd_buffer *cmd_buffer,
struct v3dv_job *job)
{
job->needs_bcl_sync = true;
cmd_buffer->state.barrier.bcl_buffer_access = 0;
@@ -2910,7 +2911,7 @@ v3dv_cmd_buffer_emit_pre_draw(struct v3dv_cmd_buffer *cmd_buffer,
assert(!job->needs_bcl_sync);
if (cmd_buffer_binning_sync_required(cmd_buffer, pipeline,
indexed, indirect)) {
consume_bcl_sync(cmd_buffer, job);
v3dv_cmd_buffer_consume_bcl_sync(cmd_buffer, job);
}
}
+3
View File
@@ -1796,6 +1796,9 @@ void v3dv_cmd_buffer_add_private_obj(struct v3dv_cmd_buffer *cmd_buffer,
void v3dv_cmd_buffer_merge_barrier_state(struct v3dv_barrier_state *dst,
struct v3dv_barrier_state *src);
void v3dv_cmd_buffer_consume_bcl_sync(struct v3dv_cmd_buffer *cmd_buffer,
struct v3dv_job *job);
bool v3dv_cmd_buffer_check_needs_load(const struct v3dv_cmd_buffer_state *state,
VkImageAspectFlags aspect,
uint32_t first_subpass_idx,
+15 -1
View File
@@ -1657,6 +1657,20 @@ v3dX(cmd_buffer_execute_inside_pass)(struct v3dv_cmd_buffer *primary,
{
assert(primary->state.job);
/* Typically we postpone applying binning syncs until we see a draw call
* that may actually access proteted resources in the binning stage. However,
* if the draw calls are recorded in a secondary command buffer and the
* barriers were recorded in a primary command buffer, that won't work
* and we will have to check if we need a binning sync when executing the
* secondary.
*/
struct v3dv_job *primary_job = primary->state.job;
if (primary_job->serialize &&
(primary->state.barrier.bcl_buffer_access ||
primary->state.barrier.bcl_image_access)) {
v3dv_cmd_buffer_consume_bcl_sync(primary, primary_job);
}
/* Emit occlusion query state if needed so the draw calls inside our
* secondaries update the counters.
*/
@@ -1702,7 +1716,7 @@ v3dX(cmd_buffer_execute_inside_pass)(struct v3dv_cmd_buffer *primary,
* the RETURN_FROM_SUB_LIST into the primary job to skip the
* branch?
*/
struct v3dv_job *primary_job = primary->state.job;
primary_job = primary->state.job;
if (!primary_job || secondary_job->serialize ||
pending_barrier.dst_mask) {
const bool needs_bcl_barrier =