[PATCH] dxgi: Allow setting maximum frame latency parameter.

Nikolay Sivov nsivov at codeweavers.com
Tue May 15 03:25:59 CDT 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 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 2c85c1da6b..0341bb0e99 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 8172269e74..3ad968308e 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);
-- 
2.17.0




More information about the wine-devel mailing list