lavapipe: fix fencing when submitting multiple cmdbufs

a fence applies to all the submitted cmdbufs, so it's necessary to do
the flush which creates the user fence after all the cmdbufs have been
processed in order to avoid creating a fence that only applies to the
first cmdbuf

Fixes: b38879f8c5 ("vallium: initial import of the vulkan frontend")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10795>
This commit is contained in:
Mike Blumenkrantz
2021-05-13 18:14:51 -04:00
committed by Marge Bot
parent 719e4fb369
commit cf3f17a643
3 changed files with 11 additions and 11 deletions
+11 -2
View File
@@ -1108,9 +1108,18 @@ static int queue_thread(void *data)
mtx_unlock(&queue->m);
//execute
for (unsigned i = 0; i < task->cmd_buffer_count; i++) {
lvp_execute_cmds(queue->device, queue, task->fence, task->cmd_buffers[i]);
lvp_execute_cmds(queue->device, queue, task->cmd_buffers[i]);
}
if (!task->cmd_buffer_count && task->fence)
if (task->cmd_buffer_count) {
struct pipe_fence_handle *handle = NULL;
queue->ctx->flush(queue->ctx, task->fence ? &handle : NULL, 0);
if (task->fence) {
mtx_lock(&queue->device->fence_lock);
task->fence->handle = handle;
mtx_unlock(&queue->device->fence_lock);
}
} else if (task->fence)
task->fence->signaled = true;
p_atomic_dec(&queue->count);
mtx_lock(&queue->m);
@@ -3131,11 +3131,9 @@ static void lvp_execute_cmd_buffer(struct lvp_cmd_buffer *cmd_buffer,
VkResult lvp_execute_cmds(struct lvp_device *device,
struct lvp_queue *queue,
struct lvp_fence *fence,
struct lvp_cmd_buffer *cmd_buffer)
{
struct rendering_state state;
struct pipe_fence_handle *handle = NULL;
memset(&state, 0, sizeof(state));
state.pctx = queue->ctx;
state.blend_dirty = true;
@@ -3145,12 +3143,6 @@ VkResult lvp_execute_cmds(struct lvp_device *device,
/* create a gallium context */
lvp_execute_cmd_buffer(cmd_buffer, &state);
state.pctx->flush(state.pctx, fence ? &handle : NULL, 0);
if (fence) {
mtx_lock(&device->fence_lock);
fence->handle = handle;
mtx_unlock(&device->fence_lock);
}
state.start_vb = -1;
state.num_vb = 0;
state.pctx->set_vertex_buffers(state.pctx, 0, 0, PIPE_MAX_ATTRIBS, false, NULL);
@@ -1106,7 +1106,6 @@ struct lvp_cmd_buffer_entry {
VkResult lvp_execute_cmds(struct lvp_device *device,
struct lvp_queue *queue,
struct lvp_fence *fence,
struct lvp_cmd_buffer *cmd_buffer);
struct lvp_image *lvp_swapchain_get_image(VkSwapchainKHR swapchain,