Skip to content
Snippets Groups Projects
Commit bb2fa97c authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard
Browse files

vkd3d: Do not keep the CS queue locked while processing it.

d3d12_command_queue_flush_ops() can renter itself while processing signal
events. Since we don't use recursive mutexes, we currently have to check
some of the queue variables without holding the mutex, which is not safe.

This is solved by allowing the queue to release its mutex while it is
processing entries: when flushing, the queue is briefly locked, the
is_flushing flag is set, the queue content is copied away and the
queue is unlocked again. After having processed the entries, the
queue is locked again to check is something else was added in the
meantime. This is repeated until the queue is empty (or a wait operation
is blocking it).

This should also remove some latency when a thread pushes to the queue
while another one is processing it, but I didn't try to measure any
impact. While it is expected that with this patch the queue mutex
will be locked and unlocked more frequently, it should also remain
locked for less time, hopefully creating little contention.
parent 09d2c8d1
No related branches found
No related tags found
1 merge request!94Fix other synchronization problems
Pipeline #8373 skipped
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment