[Mesa-stable] [PATCH 1/2] st/nine: Ignore window size if error

Axel Davy davyaxel0 at gmail.com
Wed Feb 27 22:49:46 UTC 2019


Check GetWindowInfo and ignore the computed sizes
if there is an error.

Fixes the regression caused by:
commit 2318ca68bbeb4fa6e21a4d8c650cec3f64246596
"st/nine: Handle window resize when a presentation buffer is used"
when using old wine gallium nine patches

Related issues:
https://github.com/iXit/Mesa-3D/issues/331
https://github.com/iXit/Mesa-3D/issues/332

Fixes also crash at window destruction.

Cc: mesa-stable at lists.freedesktop.org

Signed-off-by: Axel Davy <davyaxel0 at gmail.com>
---
 src/gallium/state_trackers/nine/swapchain9.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
index 6c22be24c7c..36e07310400 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -750,9 +750,16 @@ present( struct NineSwapChain9 *This,
     if (This->params.SwapEffect == D3DSWAPEFFECT_DISCARD)
         handle_draw_cursor_and_hud(This, resource);
 
-    ID3DPresent_GetWindowInfo(This->present, hDestWindowOverride, &target_width, &target_height, &target_depth);
+    hr = ID3DPresent_GetWindowInfo(This->present, hDestWindowOverride, &target_width, &target_height, &target_depth);
     (void)target_depth;
 
+    /* Can happen with old Wine (presentation can still succeed),
+     * or at window destruction. */
+    if (FAILED(hr) || target_width == 0 || target_height == 0) {
+        target_width = resource->width0;
+        target_height = resource->height0;
+    }
+
     /* Switch to using presentation buffers on window resize.
      * Note: Most apps should resize the d3d back buffers when
      * a window resize is detected, which will result in a call to
-- 
2.21.0



More information about the mesa-stable mailing list