diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-04-06 10:16:13 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-04-06 10:16:13 +0000 |
commit | a0d742befadcae89d35a2e4a5d65a85c53c886a5 (patch) | |
tree | 06ace984c944de045af3cc77e84e3da0188f1456 /lib/mesa/src/broadcom/vulkan | |
parent | b96000c8a346b7a5b93cd0e557a59f759b81a9af (diff) |
Import Mesa 22.3.7
Diffstat (limited to 'lib/mesa/src/broadcom/vulkan')
-rw-r--r-- | lib/mesa/src/broadcom/vulkan/v3dv_cl.c | 18 | ||||
-rw-r--r-- | lib/mesa/src/broadcom/vulkan/v3dv_cmd_buffer.c | 7 | ||||
-rw-r--r-- | lib/mesa/src/broadcom/vulkan/v3dv_private.h | 3 | ||||
-rw-r--r-- | lib/mesa/src/broadcom/vulkan/v3dvx_cmd_buffer.c | 16 |
4 files changed, 33 insertions, 11 deletions
diff --git a/lib/mesa/src/broadcom/vulkan/v3dv_cl.c b/lib/mesa/src/broadcom/vulkan/v3dv_cl.c index 55cf122cc..d1181bac4 100644 --- a/lib/mesa/src/broadcom/vulkan/v3dv_cl.c +++ b/lib/mesa/src/broadcom/vulkan/v3dv_cl.c @@ -114,14 +114,18 @@ v3dv_cl_ensure_space_with_branch(struct v3dv_cl *cl, uint32_t space) * end with a 'return from sub list' command. */ bool needs_return_from_sub_list = false; - if (cl->job->type == V3DV_JOB_TYPE_GPU_CL_SECONDARY) { - if (cl->size > 0) { + if (cl->job->type == V3DV_JOB_TYPE_GPU_CL_SECONDARY && cl->size > 0) needs_return_from_sub_list = true; - space += cl_packet_length(RETURN_FROM_SUB_LIST); - } - } else { - space += cl_packet_length(BRANCH); - } + + /* + * The CLE processor in the simulator tries to read V3D_CL_MAX_INSTR_SIZE + * bytes form the CL for each new instruction. If the last instruction in our + * CL is smaller than that, and there are not at least V3D_CL_MAX_INSTR_SIZE + * bytes until the end of the BO, it will read out of bounds and possibly + * cause a GMP violation interrupt to trigger. Ensure we always have at + * least that many bytes available to read with the last instruction. + */ + space += V3D_CL_MAX_INSTR_SIZE; if (v3dv_cl_offset(cl) + space <= cl->size) return; diff --git a/lib/mesa/src/broadcom/vulkan/v3dv_cmd_buffer.c b/lib/mesa/src/broadcom/vulkan/v3dv_cmd_buffer.c index c92794bd9..dba43223d 100644 --- a/lib/mesa/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/lib/mesa/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -2789,8 +2789,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; @@ -2890,7 +2891,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); } } diff --git a/lib/mesa/src/broadcom/vulkan/v3dv_private.h b/lib/mesa/src/broadcom/vulkan/v3dv_private.h index 27b0646d3..bbdb1ef57 100644 --- a/lib/mesa/src/broadcom/vulkan/v3dv_private.h +++ b/lib/mesa/src/broadcom/vulkan/v3dv_private.h @@ -1660,6 +1660,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, diff --git a/lib/mesa/src/broadcom/vulkan/v3dvx_cmd_buffer.c b/lib/mesa/src/broadcom/vulkan/v3dvx_cmd_buffer.c index 8f78dfb09..5219f4801 100644 --- a/lib/mesa/src/broadcom/vulkan/v3dvx_cmd_buffer.c +++ b/lib/mesa/src/broadcom/vulkan/v3dvx_cmd_buffer.c @@ -1623,6 +1623,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. */ @@ -1668,7 +1682,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 = |