Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rebohle <philip.rebohle@tu-dortmund.de>2023-06-21 17:33:06 +0300
committerPhilip Rebohle <philip.rebohle@tu-dortmund.de>2023-06-21 17:33:06 +0300
commit121f9065ad3b4f3d63a53d73842588b448319d0b (patch)
treede68a5a388174c5154de9b684009907c0547f51d
parenta287566c655b7ccc86cc866cd2bf8a075a4d4708 (diff)
[dxvk] Apply frame rate limiter on presentation timelinefps-limiter-on-present
This may reduce latency as we no longer end up stalling subsequent GPU submissions.
-rw-r--r--src/dxvk/dxvk_presenter.cpp17
-rw-r--r--src/dxvk/dxvk_presenter.h3
2 files changed, 16 insertions, 4 deletions
diff --git a/src/dxvk/dxvk_presenter.cpp b/src/dxvk/dxvk_presenter.cpp
index 857ecf57..9afa7268 100644
--- a/src/dxvk/dxvk_presenter.cpp
+++ b/src/dxvk/dxvk_presenter.cpp
@@ -108,10 +108,6 @@ namespace dxvk {
m_swapchain, std::numeric_limits<uint64_t>::max(),
sync.acquire, VK_NULL_HANDLE, &m_imageIndex);
- bool vsync = mode == VK_PRESENT_MODE_FIFO_KHR
- || mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR;
-
- m_fpsLimiter.delay(vsync);
return status;
}
@@ -134,6 +130,7 @@ namespace dxvk {
m_frameQueue.push(frame);
m_frameCond.notify_one();
} else {
+ applyFrameRateLimiter(mode);
m_signal->signal(frameId);
}
@@ -648,6 +645,14 @@ namespace dxvk {
}
+ void Presenter::applyFrameRateLimiter(VkPresentModeKHR mode) {
+ bool vsync = mode == VK_PRESENT_MODE_FIFO_KHR
+ || mode == VK_PRESENT_MODE_FIFO_RELAXED_KHR;
+
+ m_fpsLimiter.delay(vsync);
+ }
+
+
void Presenter::runFrameThread() {
env::setThreadName("dxvk-frame");
@@ -667,6 +672,10 @@ namespace dxvk {
if (!frame.frameId)
return;
+ // Apply the FPS limiter before signaling the frame event in
+ // order to reduce latency if the app uses it for frame pacing.
+ applyFrameRateLimiter(frame.mode);
+
// If the present operation has succeeded, actually wait for it to complete.
// Don't bother with it on MAILBOX / IMMEDIATE modes since doing so would
// restrict us to the display refresh rate on some platforms (XWayland).
diff --git a/src/dxvk/dxvk_presenter.h b/src/dxvk/dxvk_presenter.h
index 30247796..799a3d41 100644
--- a/src/dxvk/dxvk_presenter.h
+++ b/src/dxvk/dxvk_presenter.h
@@ -294,6 +294,9 @@ namespace dxvk {
void destroySurface();
+ void applyFrameRateLimiter(
+ VkPresentModeKHR mode);
+
void runFrameThread();
};