From 20696aa170aab5f7b248632c2316b5bc7ee17e7b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 16 Nov 2020 15:44:06 +1000 Subject: [PATCH] lavapipe: execute a finish in pipeline barrier and event waiting. Refactor out the code for finishing a fence and used it in pipeline barrier and event waiting. Reviewed-by: Mike Blumenkrantz Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/frontends/lavapipe/lvp_execute.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index ea57df9f876..d4a2ef7e47a 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -177,6 +177,19 @@ assert_subresource_layers(const struct pipe_resource *pres, const VkImageSubreso #endif } +static void finish_fence(struct rendering_state *state) +{ + struct pipe_fence_handle *handle = NULL; + + state->pctx->flush(state->pctx, &handle, 0); + + state->pctx->screen->fence_finish(state->pctx->screen, + NULL, + handle, PIPE_TIMEOUT_INFINITE); + state->pctx->screen->fence_reference(state->pctx->screen, + &handle, NULL); +} + static void emit_compute_state(struct rendering_state *state) { if (state->iv_dirty[PIPE_SHADER_COMPUTE]) { @@ -2876,6 +2889,7 @@ static void handle_event_reset(struct vk_cmd_queue_entry *cmd, static void handle_wait_events(struct vk_cmd_queue_entry *cmd, struct rendering_state *state) { + finish_fence(state); for (unsigned i = 0; i < cmd->u.wait_events.event_count; i++) { LVP_FROM_HANDLE(lvp_event, event, cmd->u.wait_events.events[i]); @@ -2886,8 +2900,7 @@ static void handle_wait_events(struct vk_cmd_queue_entry *cmd, static void handle_pipeline_barrier(struct vk_cmd_queue_entry *cmd, struct rendering_state *state) { - /* why hello nail, I'm a hammer. - TODO */ - state->pctx->flush(state->pctx, NULL, 0); + finish_fence(state); } static void handle_begin_query(struct vk_cmd_queue_entry *cmd,