st/nine: Use new function to query for resolution mismatch
authorPatrick Rudolph <siro@das-labor.org>
Wed, 10 Feb 2016 18:30:20 +0000 (19:30 +0100)
committerAxel Davy <axel.davy@ens.fr>
Wed, 18 May 2016 21:37:14 +0000 (23:37 +0200)
Any third party app might change the current screen resolution.
Poll for resolution mismatch to force a device reset.
Required for non ex devices only.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/nine/swapchain9.c
src/gallium/state_trackers/nine/swapchain9.h

index 1744b538717b7871af1502bc1473a96aff6518fd..7edba6b1e9f4c6c404777efd7cf9449ee811d512 100644 (file)
@@ -548,6 +548,9 @@ NineDevice9_TestCooperativeLevel( struct NineDevice9 *This )
     if (NineSwapChain9_GetOccluded(This->swapchains[0])) {
         This->device_needs_reset = TRUE;
         return D3DERR_DEVICELOST;
+    } else if (NineSwapChain9_ResolutionMismatch(This->swapchains[0])) {
+        This->device_needs_reset = TRUE;
+        return D3DERR_DEVICENOTRESET;
     } else if (This->device_needs_reset) {
         return D3DERR_DEVICENOTRESET;
     }
index e2fb4d4a1e3197de8e455e0e1c20065e406bf9d3..803bd519a59f7a566b64c70fd44c7a880bea55c6 100644 (file)
@@ -794,7 +794,8 @@ NineSwapChain9_Present( struct NineSwapChain9 *This,
             return S_PRESENT_OCCLUDED;
         }
     } else {
-        if (NineSwapChain9_GetOccluded(This)) {
+        if (NineSwapChain9_GetOccluded(This) ||
+            NineSwapChain9_ResolutionMismatch(This)) {
             This->base.device->device_needs_reset = TRUE;
         }
         if (This->base.device->device_needs_reset) {
@@ -1016,3 +1017,13 @@ NineSwapChain9_GetOccluded( struct NineSwapChain9 *This )
 
     return FALSE;
 }
+
+BOOL
+NineSwapChain9_ResolutionMismatch( struct NineSwapChain9 *This )
+{
+    if (This->base.device->minor_version_num > 1) {
+        return ID3DPresent_ResolutionMismatch(This->present);
+    }
+
+    return FALSE;
+}
index 7714cd52cdd5cfd31db9941668e5f77aebeae217..43032ce8543decb53ca7a901d504af4f467b5522 100644 (file)
@@ -142,4 +142,7 @@ NineSwapChain9_GetPresentParameters( struct NineSwapChain9 *This,
 BOOL
 NineSwapChain9_GetOccluded( struct NineSwapChain9 *This );
 
+BOOL
+NineSwapChain9_ResolutionMismatch( struct NineSwapChain9 *This );
+
 #endif /* _NINE_SWAPCHAIN9_H_ */