[Mesa-dev] [PATCH 23/39] st/nine: Use new function to query for resolution mismatch

Axel Davy axel.davy at ens.fr
Sun May 15 10:45:37 UTC 2016


From: Patrick Rudolph <siro at das-labor.org>

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 at das-labor.org>
Reviewed-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/device9.c    |  3 +++
 src/gallium/state_trackers/nine/swapchain9.c | 13 ++++++++++++-
 src/gallium/state_trackers/nine/swapchain9.h |  3 +++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 4a10efc..c1e22cb 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -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;
     }
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
index e2fb4d4..803bd51 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -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;
+}
diff --git a/src/gallium/state_trackers/nine/swapchain9.h b/src/gallium/state_trackers/nine/swapchain9.h
index 7714cd5..43032ce 100644
--- a/src/gallium/state_trackers/nine/swapchain9.h
+++ b/src/gallium/state_trackers/nine/swapchain9.h
@@ -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_ */
-- 
2.8.2



More information about the mesa-dev mailing list