[PATCH 0/1] MR10246: dxgi: Implement IDXGIOutput::WaitForVBlank()
In QT 6.9 QWindow update request are driven by a vblank watcher thread that calls IDXGIOutput::WaitForVBlank in loop (https://doc.qt.io/qt-6/whatsnew69.html#qt-gui-module). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10246
From: Mike Kozelkov <augenzi@etersoft.ru> --- dlls/dxgi/output.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/dlls/dxgi/output.c b/dlls/dxgi/output.c index e828ed0d9d8..91ea25dd740 100644 --- a/dlls/dxgi/output.c +++ b/dlls/dxgi/output.c @@ -363,14 +363,32 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode(IDXGIOutput static HRESULT STDMETHODCALLTYPE dxgi_output_WaitForVBlank(IDXGIOutput6 *iface) { - static BOOL once = FALSE; + struct dxgi_output *output = impl_from_IDXGIOutput6(iface); + struct wined3d_raster_status raster_status; + int prev_scanline = 0; + HRESULT hr; - if (!once++) - FIXME("iface %p stub!\n", iface); - else - TRACE("iface %p stub!\n", iface); + TRACE("iface %p\n", iface); - return E_NOTIMPL; + for (;;) + { + wined3d_mutex_lock(); + hr = wined3d_output_get_raster_status(output->wined3d_output, &raster_status); + wined3d_mutex_unlock(); + if (FAILED(hr)) + { + WARN("Failed to get raster status, hr %#lx.\n", hr); + return hr; + } + if (raster_status.in_vblank && prev_scanline > raster_status.scan_line) + break; + + prev_scanline = raster_status.scan_line; + + Sleep(0); + } + + return S_OK; } static HRESULT STDMETHODCALLTYPE dxgi_output_TakeOwnership(IDXGIOutput6 *iface, IUnknown *device, BOOL exclusive) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10246
participants (2)
-
Mike Kozelkov -
Mike Kozelkov (@augenzi)