mirror of
https://github.com/microsoft/terminal.git
synced 2026-02-08 21:29:19 +00:00
Reduce GdiEngine input latency (#15608)
This commit reduces GdiEngine's average display latency by 8ms, which caused it to miss a v-blank about half the time at 60Hz. Closes #15607 ## Validation Steps Performed Input latency with `frarees/typometer` matches conhost from Win10 ✅
This commit is contained in:
@@ -169,6 +169,11 @@ DWORD WINAPI RenderThread::_ThreadProc()
|
||||
{
|
||||
while (_fKeepRunning)
|
||||
{
|
||||
// Between waiting on _hEvent and calling PaintFrame() there should be a minimal delay,
|
||||
// so that a key press progresses to a drawing operation as quickly as possible.
|
||||
// As such, we wait for the renderer to complete _before_ waiting on _hEvent.
|
||||
_pRenderer->WaitUntilCanRender();
|
||||
|
||||
WaitForSingleObject(_hPaintEnabledEvent, INFINITE);
|
||||
|
||||
if (!_fNextFrameRequested.exchange(false, std::memory_order_acq_rel))
|
||||
@@ -209,10 +214,7 @@ DWORD WINAPI RenderThread::_ThreadProc()
|
||||
}
|
||||
|
||||
ResetEvent(_hPaintCompletedEvent);
|
||||
|
||||
_pRenderer->WaitUntilCanRender();
|
||||
LOG_IF_FAILED(_pRenderer->PaintFrame());
|
||||
|
||||
SetEvent(_hPaintCompletedEvent);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user