From: Iago Toral Quiroga Date: Mon, 27 Mar 2023 09:11:24 +0000 (+0200) Subject: v3dv: pause occlusion queries during vkCmdClearAttachments X-Git-Tag: upstream/23.3.3~11000 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3647b05ae9302f9bc1eb7e7d3a777bd773c45621;p=platform%2Fupstream%2Fmesa.git v3dv: pause occlusion queries during vkCmdClearAttachments We implement this by emitting a draw call, which should not be registered during occlusion query counting. Fixes: dEQP-VK.query_pool.occlusion_query*clear* Reviewed-by: Alejandro PiƱeiro Part-of: --- diff --git a/src/broadcom/ci/broadcom-rpi4-fails.txt b/src/broadcom/ci/broadcom-rpi4-fails.txt index 83dc5f2..ed780b7 100644 --- a/src/broadcom/ci/broadcom-rpi4-fails.txt +++ b/src/broadcom/ci/broadcom-rpi4-fails.txt @@ -564,35 +564,3 @@ x11-dEQP-EGL.functional.create_context_ext.robust_gl_31.rgba8888_no_depth_no_ste # New CTS failures in 1.3.5.0 dEQP-VK.api.buffer_view.access.uniform_texel_buffer.b8g8r8a8_unorm,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_32_wait_query_without_availability_draw_points_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_32_wait_query_without_availability_draw_points_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_32_wait_query_without_availability_draw_triangles_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_32_wait_query_without_availability_draw_triangles_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_32_wait_queue_without_availability_draw_points_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_32_wait_queue_without_availability_draw_points_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_32_wait_queue_without_availability_draw_triangles_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_32_wait_queue_without_availability_draw_triangles_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_64_wait_query_without_availability_draw_points_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_64_wait_query_without_availability_draw_points_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_64_wait_query_without_availability_draw_triangles_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_64_wait_query_without_availability_draw_triangles_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_64_wait_queue_without_availability_draw_points_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_64_wait_queue_without_availability_draw_points_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_64_wait_queue_without_availability_draw_triangles_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_conservative_size_64_wait_queue_without_availability_draw_triangles_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_32_wait_query_without_availability_draw_points_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_32_wait_query_without_availability_draw_points_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_32_wait_query_without_availability_draw_triangles_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_32_wait_query_without_availability_draw_triangles_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_32_wait_queue_without_availability_draw_points_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_32_wait_queue_without_availability_draw_points_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_32_wait_queue_without_availability_draw_triangles_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_32_wait_queue_without_availability_draw_triangles_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_64_wait_query_without_availability_draw_points_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_64_wait_query_without_availability_draw_points_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_64_wait_query_without_availability_draw_triangles_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_64_wait_query_without_availability_draw_triangles_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_64_wait_queue_without_availability_draw_points_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_64_wait_queue_without_availability_draw_points_clear_depth,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_64_wait_queue_without_availability_draw_triangles_clear_color,Fail -dEQP-VK.query_pool.occlusion_query.get_results_precise_size_64_wait_queue_without_availability_draw_triangles_clear_depth,Fail diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index 6b66770..449e532 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -3618,6 +3618,32 @@ v3dv_cmd_buffer_begin_query(struct v3dv_cmd_buffer *cmd_buffer, } } +void +v3dv_cmd_buffer_pause_occlusion_query(struct v3dv_cmd_buffer *cmd_buffer) +{ + struct v3dv_cmd_buffer_state *state = &cmd_buffer->state; + struct v3dv_bo *occlusion_query_bo = state->query.active_query.bo; + if (occlusion_query_bo) { + assert(!state->query.active_query.paused_bo); + state->query.active_query.paused_bo = occlusion_query_bo; + state->query.active_query.bo = NULL; + state->dirty |= V3DV_CMD_DIRTY_OCCLUSION_QUERY; + } +} + +void +v3dv_cmd_buffer_resume_occlusion_query(struct v3dv_cmd_buffer *cmd_buffer) +{ + struct v3dv_cmd_buffer_state *state = &cmd_buffer->state; + struct v3dv_bo *occlusion_query_bo = state->query.active_query.paused_bo; + if (occlusion_query_bo) { + assert(!state->query.active_query.bo); + state->query.active_query.bo = occlusion_query_bo; + state->query.active_query.paused_bo = NULL; + state->dirty |= V3DV_CMD_DIRTY_OCCLUSION_QUERY; + } +} + static void v3dv_cmd_buffer_schedule_end_query(struct v3dv_cmd_buffer *cmd_buffer, struct v3dv_query_pool *pool, diff --git a/src/broadcom/vulkan/v3dv_meta_clear.c b/src/broadcom/vulkan/v3dv_meta_clear.c index 38c7b44..5446401 100644 --- a/src/broadcom/vulkan/v3dv_meta_clear.c +++ b/src/broadcom/vulkan/v3dv_meta_clear.c @@ -1202,6 +1202,9 @@ v3dv_CmdClearAttachments(VkCommandBuffer commandBuffer, * framebuffers, we use a geometry shader to redirect clears to the * appropriate layers. */ + + v3dv_cmd_buffer_pause_occlusion_query(cmd_buffer); + bool is_layered, all_rects_same_layers; gather_layering_info(rectCount, pRects, &is_layered, &all_rects_same_layers); for (uint32_t i = 0; i < attachmentCount; i++) { @@ -1219,4 +1222,6 @@ v3dv_CmdClearAttachments(VkCommandBuffer commandBuffer, rectCount, pRects); } } + + v3dv_cmd_buffer_resume_occlusion_query(cmd_buffer); } diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index 9662bb7..eb4c398 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -1566,6 +1566,14 @@ struct v3dv_cmd_buffer_state { */ struct v3dv_bo *bo; uint32_t offset; + /* When the driver emits draw calls to implement other operations in + * the middle of a render pass (such as an attachment clear), we need + * to pause occlusion query recording and resume it later so that + * these draw calls don't register in occlussion counters. We use + * this to store the BO reference in which we should resume occlusion + * query counters after the driver is done emitting its draw calls. + */ + struct v3dv_bo *paused_bo; /* This pointer is not NULL if we have an active performance query */ struct v3dv_perf_query *perf; @@ -1773,6 +1781,9 @@ void v3dv_cmd_buffer_begin_query(struct v3dv_cmd_buffer *cmd_buffer, uint32_t query, VkQueryControlFlags flags); +void v3dv_cmd_buffer_pause_occlusion_query(struct v3dv_cmd_buffer *cmd_buffer); +void v3dv_cmd_buffer_resume_occlusion_query(struct v3dv_cmd_buffer *cmd_buffer); + void v3dv_cmd_buffer_end_query(struct v3dv_cmd_buffer *cmd_buffer, struct v3dv_query_pool *pool, uint32_t query);