st/nine: Fix a crash if the state is not initialized
authorAxel Davy <davyaxel0@gmail.com>
Sun, 26 Jan 2020 19:40:00 +0000 (20:40 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 15 May 2020 15:43:57 +0000 (15:43 +0000)
I don't remember exactly the conditions of the crash,
but I had a trace which was crashing in the gallium driver
before doing any rendering (something about viewports being not initialized).

It's not the first time we hit such a problem, so rather than investigating
that crash, I chose to just initialize every states at device creation.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5015>

src/gallium/frontends/nine/device9.c
src/gallium/frontends/nine/nine_state.c
src/gallium/frontends/nine/nine_state.h

index fd8e9274327c2320fd897e82aaa83f852a6195b4..b18695deadc51701930b920e3fc25957ccb246c1 100644 (file)
@@ -517,6 +517,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
     nine_state_init_sw(This);
 
     ID3DPresentGroup_Release(This->present);
+    nine_context_update_state(This); /* Some drivers needs states to be initialized */
     nine_csmt_process(This);
 
     return D3D_OK;
index 8724ec87c81934fb32aee7bd43f858f1df4ae8e4..90de3dd80f3b3ae93c17cfa7ae74ca0a6e532220 100644 (file)
@@ -2935,6 +2935,12 @@ nine_context_clear(struct NineDevice9 *device)
     }
 }
 
+void
+nine_context_update_state(struct NineDevice9 *device)
+{
+    nine_update_state(device);
+}
+
 void
 nine_state_init_sw(struct NineDevice9 *device)
 {
index d8fa2f80c4d80420f573687fc3cbf0f4385a8afa..d497a79c49db3f4e821d4f2d441252d3943f3733 100644 (file)
@@ -606,6 +606,7 @@ void nine_state_set_defaults(struct NineDevice9 *, const D3DCAPS9 *,
                              boolean is_reset);
 void nine_device_state_clear(struct NineDevice9 *);
 void nine_context_clear(struct NineDevice9 *);
+void nine_context_update_state(struct NineDevice9 *);
 
 void nine_state_init_sw(struct NineDevice9 *device);
 void nine_state_prepare_draw_sw(struct NineDevice9 *device,