mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-06 20:58:37 +01:00
[dxvk] Don't hold queue lock when invoking periodic memory tasks
This commit is contained in:
parent
9573c389de
commit
6d9e0baa27
1 changed files with 27 additions and 24 deletions
|
@ -129,21 +129,23 @@ namespace dxvk {
|
||||||
void DxvkSubmissionQueue::submitCmdLists() {
|
void DxvkSubmissionQueue::submitCmdLists() {
|
||||||
env::setThreadName("dxvk-submit");
|
env::setThreadName("dxvk-submit");
|
||||||
|
|
||||||
std::unique_lock<dxvk::mutex> lock(m_mutex);
|
|
||||||
|
|
||||||
uint64_t trackedSubmitId = 0u;
|
uint64_t trackedSubmitId = 0u;
|
||||||
uint64_t trackedPresentId = 0u;
|
uint64_t trackedPresentId = 0u;
|
||||||
|
|
||||||
while (!m_stopped.load()) {
|
while (!m_stopped.load()) {
|
||||||
m_appendCond.wait(lock, [this] {
|
DxvkSubmitEntry entry;
|
||||||
return m_stopped.load() || !m_submitQueue.empty();
|
|
||||||
});
|
{ std::unique_lock<dxvk::mutex> lock(m_mutex);
|
||||||
|
|
||||||
if (m_stopped.load())
|
m_appendCond.wait(lock, [this] {
|
||||||
return;
|
return m_stopped.load() || !m_submitQueue.empty();
|
||||||
|
});
|
||||||
DxvkSubmitEntry entry = std::move(m_submitQueue.front());
|
|
||||||
lock.unlock();
|
if (m_stopped.load())
|
||||||
|
return;
|
||||||
|
|
||||||
|
entry = std::move(m_submitQueue.front());
|
||||||
|
}
|
||||||
|
|
||||||
// Submit command buffer to device
|
// Submit command buffer to device
|
||||||
if (m_lastError != VK_ERROR_DEVICE_LOST) {
|
if (m_lastError != VK_ERROR_DEVICE_LOST) {
|
||||||
|
@ -191,24 +193,25 @@ namespace dxvk {
|
||||||
entry.status->result = entry.result;
|
entry.status->result = entry.result;
|
||||||
|
|
||||||
// On success, pass it on to the queue thread
|
// 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) ||
|
bool doForward = (entry.result == VK_SUCCESS) ||
|
||||||
(entry.present.presenter != nullptr && entry.result != VK_ERROR_DEVICE_LOST);
|
(entry.present.presenter != nullptr && entry.result != VK_ERROR_DEVICE_LOST);
|
||||||
|
|
||||||
if (doForward) {
|
if (doForward) {
|
||||||
m_finishQueue.push(std::move(entry));
|
m_finishQueue.push(std::move(entry));
|
||||||
} else {
|
} else {
|
||||||
Logger::err(str::format("DxvkSubmissionQueue: Command submission failed: ", entry.result));
|
Logger::err(str::format("DxvkSubmissionQueue: Command submission failed: ", entry.result));
|
||||||
m_lastError = entry.result;
|
m_lastError = entry.result;
|
||||||
|
|
||||||
if (m_lastError != VK_ERROR_DEVICE_LOST)
|
if (m_lastError != VK_ERROR_DEVICE_LOST)
|
||||||
m_device->waitForIdle();
|
m_device->waitForIdle();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_submitQueue.pop();
|
||||||
|
m_submitCond.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_submitQueue.pop();
|
|
||||||
m_submitCond.notify_all();
|
|
||||||
|
|
||||||
// Good time to invoke allocator tasks now since we
|
// Good time to invoke allocator tasks now since we
|
||||||
// expect this to get called somewhat periodically.
|
// expect this to get called somewhat periodically.
|
||||||
m_device->m_objects.memoryManager().performTimedTasks();
|
m_device->m_objects.memoryManager().performTimedTasks();
|
||||||
|
|
Loading…
Add table
Reference in a new issue