[dxvk] Don't hold queue lock when invoking periodic memory tasks

This commit is contained in:
Philip Rebohle 2025-02-14 14:34:33 +01:00
parent 9573c389de
commit 6d9e0baa27

View file

@ -129,12 +129,14 @@ namespace dxvk {
void DxvkSubmissionQueue::submitCmdLists() {
env::setThreadName("dxvk-submit");
std::unique_lock<dxvk::mutex> lock(m_mutex);
uint64_t trackedSubmitId = 0u;
uint64_t trackedPresentId = 0u;
while (!m_stopped.load()) {
DxvkSubmitEntry entry;
{ std::unique_lock<dxvk::mutex> lock(m_mutex);
m_appendCond.wait(lock, [this] {
return m_stopped.load() || !m_submitQueue.empty();
});
@ -142,8 +144,8 @@ namespace dxvk {
if (m_stopped.load())
return;
DxvkSubmitEntry entry = std::move(m_submitQueue.front());
lock.unlock();
entry = std::move(m_submitQueue.front());
}
// Submit command buffer to device
if (m_lastError != VK_ERROR_DEVICE_LOST) {
@ -191,7 +193,7 @@ namespace dxvk {
entry.status->result = entry.result;
// On success, pass it on to the queue thread
lock = std::unique_lock<dxvk::mutex>(m_mutex);
{ std::unique_lock<dxvk::mutex> lock(m_mutex);
bool doForward = (entry.result == VK_SUCCESS) ||
(entry.present.presenter != nullptr && entry.result != VK_ERROR_DEVICE_LOST);
@ -208,6 +210,7 @@ namespace dxvk {
m_submitQueue.pop();
m_submitCond.notify_all();
}
// Good time to invoke allocator tasks now since we
// expect this to get called somewhat periodically.