Commit b2600c83 authored by Conor McCarthy's avatar Conor McCarthy Committed by Alexandre Julliard

vkd3d: Leave the command queue op mutex locked after a partial flush.

All return paths in d3d12_command_queue_flush_ops_locked() must leave the op mutex locked. (cherry-picked from upstream commit e27ceddfb4a89470d5d35ab4391d0a5cf4453ef1)
parent 423eb0a1
......@@ -6781,16 +6781,16 @@ static bool d3d12_command_queue_op_array_append(struct d3d12_command_queue_op_ar
return true;
}
static HRESULT d3d12_command_queue_fixup_after_flush(struct d3d12_command_queue *queue, unsigned int done_count)
static void d3d12_command_queue_delete_aux_ops(struct d3d12_command_queue *queue,
unsigned int done_count)
{
HRESULT hr;
queue->aux_op_queue.count -= done_count;
memmove(queue->aux_op_queue.ops, &queue->aux_op_queue.ops[done_count],
queue->aux_op_queue.count * sizeof(*queue->aux_op_queue.ops));
}
vkd3d_mutex_lock(&queue->op_mutex);
static HRESULT d3d12_command_queue_fixup_after_flush_locked(struct d3d12_command_queue *queue)
{
d3d12_command_queue_swap_queues(queue);
d3d12_command_queue_op_array_append(&queue->op_queue, queue->aux_op_queue.count, queue->aux_op_queue.ops);
......@@ -6798,11 +6798,7 @@ static HRESULT d3d12_command_queue_fixup_after_flush(struct d3d12_command_queue
queue->aux_op_queue.count = 0;
queue->is_flushing = false;
hr = d3d12_command_queue_record_as_blocked(queue);
vkd3d_mutex_unlock(&queue->op_mutex);
return hr;
return d3d12_command_queue_record_as_blocked(queue);
}
static HRESULT d3d12_command_queue_flush_ops(struct d3d12_command_queue *queue, bool *flushed_any)
......@@ -6855,7 +6851,9 @@ static HRESULT d3d12_command_queue_flush_ops_locked(struct d3d12_command_queue *
if (op->u.wait.value > fence->max_pending_value)
{
vkd3d_mutex_unlock(&fence->mutex);
return d3d12_command_queue_fixup_after_flush(queue, i);
d3d12_command_queue_delete_aux_ops(queue, i);
vkd3d_mutex_lock(&queue->op_mutex);
return d3d12_command_queue_fixup_after_flush_locked(queue);
}
d3d12_command_queue_wait_locked(queue, fence, op->u.wait.value);
d3d12_fence_decref(fence);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment