mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 06:29:58 -04:00
Hold each frame's start in the driver while low latency is on, and let that keep the frame limit.
The driver's sleep sits where the game's frame starts: at its first pad read or window image acquire after a present, whichever comes first, before the input is sampled. The frame's number, the count of the game's presents, goes with its work: the guest thread marks the simulation and the first submission, the replaying thread tags its queue submissions and marks their end, and the present thread marks the host present, which carries the number too. The window's swapchain is made with the latency mode while NVIDIA's path is on, and remade when the setting changes. While the mode is in effect the pacer holds nothing, so a picture goes out as soon as it is drawn and the limit is kept by the driver before the pad is read; RivaTuner Statistics Server is kept out as with frame generation. The pacer takes the limit back while a movie plays, while no host present goes out, and for the rest of the run when the frames show the driver does not hold it. With the mode off every hook returns at its first check. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "nvn_api.h"
|
||||
#include "prof.h"
|
||||
#include "vk.h"
|
||||
#include "vk_lowlat.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
#define WEAK __attribute__((weak))
|
||||
@@ -96,6 +97,7 @@ static struct {
|
||||
VkSubmitInfo2 si[HOLD_CAP];
|
||||
VkCommandBufferSubmitInfo cbi[HOLD_CAP][SUB_CBS];
|
||||
VkSemaphoreSubmitInfo sig[HOLD_CAP][2];
|
||||
VkLatencySubmissionPresentIdNV lat[HOLD_CAP]; // the frame's number for the driver's low latency (vk_lowlat.c)
|
||||
uint64_t last; // the newest timeline value a held submission signals, 0 none
|
||||
uint64_t batches, subs; // vkQueueSubmit2 calls and the submissions they carried
|
||||
} H;
|
||||
@@ -312,6 +314,9 @@ static void queue_submit(VkCtx *c, const VkSubmitInfo2 *si, uint64_t value) {
|
||||
memcpy(H.sig[i], si->pSignalSemaphoreInfos, sizeof H.sig[i][0] * si->signalSemaphoreInfoCount);
|
||||
H.si[i].pSignalSemaphoreInfos = H.sig[i];
|
||||
}
|
||||
// NVIDIA's low latency on (vk_lowlat.c): the submission carries the number of the frame being replayed, so the
|
||||
// driver counts its GPU time to that frame. The callers' submissions have no chain of their own.
|
||||
if (vk_lowlat_submit_tag(&H.lat[i])) H.si[i].pNext = &H.lat[i];
|
||||
if (value) H.last = value;
|
||||
uint64_t now = kern_now_ns();
|
||||
if (i == 0) __atomic_store_n(&held_t0, now, __ATOMIC_RELEASE);
|
||||
|
||||
Reference in New Issue
Block a user