Nikolay Sivov : dxgi: Allow setting maximum frame latency parameter.

Alexandre Julliard julliard at winehq.org
Tue May 15 16:25:22 CDT 2018


Module: wine
Branch: master
Commit: 8b57e7dcb9dd4546520d36cb2ffed85aca0e32fb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8b57e7dcb9dd4546520d36cb2ffed85aca0e32fb

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue May 15 11:25:59 2018 +0300

dxgi: Allow setting maximum frame latency parameter.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxgi/device.c       | 24 ++++++++++++++++++------
 dlls/dxgi/tests/device.c | 19 +++++++++++--------
 2 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c
index 2c85c1d..0341bb0 100644
--- a/dlls/dxgi/device.c
+++ b/dlls/dxgi/device.c
@@ -258,22 +258,34 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_GetGPUThreadPriority(IWineDXGIDevic
 
 static HRESULT STDMETHODCALLTYPE dxgi_device_SetMaximumFrameLatency(IWineDXGIDevice *iface, UINT max_latency)
 {
-    FIXME("iface %p, max_latency %u stub!\n", iface, max_latency);
+    struct dxgi_device *device = impl_from_IWineDXGIDevice(iface);
+
+    TRACE("iface %p, max_latency %u.\n", iface, max_latency);
 
     if (max_latency > DXGI_FRAME_LATENCY_MAX)
         return DXGI_ERROR_INVALID_CALL;
 
-    return E_NOTIMPL;
+    wined3d_mutex_lock();
+    wined3d_device_set_max_frame_latency(device->wined3d_device, max_latency);
+    wined3d_mutex_unlock();
+
+    return S_OK;
 }
 
 static HRESULT STDMETHODCALLTYPE dxgi_device_GetMaximumFrameLatency(IWineDXGIDevice *iface, UINT *max_latency)
 {
-    FIXME("iface %p, max_latency %p stub!\n", iface, max_latency);
+    struct dxgi_device *device = impl_from_IWineDXGIDevice(iface);
 
-    if (max_latency)
-        *max_latency = DXGI_FRAME_LATENCY_DEFAULT;
+    TRACE("iface %p, max_latency %p.\n", iface, max_latency);
 
-    return E_NOTIMPL;
+    if (!max_latency)
+        return DXGI_ERROR_INVALID_CALL;
+
+    wined3d_mutex_lock();
+    *max_latency = wined3d_device_get_max_frame_latency(device->wined3d_device);
+    wined3d_mutex_unlock();
+
+    return S_OK;
 }
 
 static HRESULT STDMETHODCALLTYPE dxgi_device_OfferResources(IWineDXGIDevice *iface, UINT resource_count,
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c
index 8172269..3ad9683 100644
--- a/dlls/dxgi/tests/device.c
+++ b/dlls/dxgi/tests/device.c
@@ -3426,26 +3426,29 @@ static void test_maximum_frame_latency(void)
 
     if (SUCCEEDED(IDXGIDevice_QueryInterface(device, &IID_IDXGIDevice1, (void **)&device1)))
     {
+        hr = IDXGIDevice1_GetMaximumFrameLatency(device1, NULL);
+        ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+
         hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
-        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
         ok(max_latency == DEFAULT_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
 
         hr = IDXGIDevice1_SetMaximumFrameLatency(device1, MAX_FRAME_LATENCY);
-        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
         hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
-        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
-        todo_wine ok(max_latency == MAX_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
+        ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        ok(max_latency == MAX_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
 
         hr = IDXGIDevice1_SetMaximumFrameLatency(device1, MAX_FRAME_LATENCY + 1);
         ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
         hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
-        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
-        todo_wine ok(max_latency == MAX_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
+        ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        ok(max_latency == MAX_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
 
         hr = IDXGIDevice1_SetMaximumFrameLatency(device1, 0);
-        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
         hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
-        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
         /* 0 does not reset to the default frame latency on all Windows versions. */
         ok(max_latency == DEFAULT_FRAME_LATENCY || broken(!max_latency),
                 "Got unexpected maximum frame latency %u.\n", max_latency);




More information about the wine-cvs mailing list