st/nine: Avoid RefToBind calls in ff
authorAxel Davy <davyaxel0@gmail.com>
Sun, 9 Sep 2018 10:47:16 +0000 (12:47 +0200)
committerAxel Davy <davyaxel0@gmail.com>
Tue, 25 Sep 2018 20:05:24 +0000 (22:05 +0200)
When using csmt, ff shader creation happens on the csmt
thread. Creating the shaders, then calling RefToBind causes
the device ref to be increased then decreased.

However the device dtor assumes than no work pending on the
csmt thread could increase the device ref, leading to hang.

The issue is avoided by creating the shaders with a bind
count directly.

Fixes: https://github.com/iXit/Mesa-3D/issues/295
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
src/gallium/state_trackers/nine/nine_ff.c
src/gallium/state_trackers/nine/pixelshader9.c
src/gallium/state_trackers/nine/vertexshader9.c

index fabc1d3b882774dfda082cc044b9b0fafd61178d..58cc29b5e3010034c31510135a6b248574f8b579 100644 (file)
@@ -1698,7 +1698,6 @@ nine_ff_get_vs(struct NineDevice9 *device)
         (void)err;
         assert(err == PIPE_OK);
         device->ff.num_vs++;
-        NineUnknown_ConvertRefToBind(NineUnknown(vs));
 
         vs->num_inputs = bld.num_inputs;
         for (n = 0; n < bld.num_inputs; ++n)
@@ -1850,7 +1849,6 @@ nine_ff_get_ps(struct NineDevice9 *device)
         (void)err;
         assert(err == PIPE_OK);
         device->ff.num_ps++;
-        NineUnknown_ConvertRefToBind(NineUnknown(ps));
 
         ps->rt_mask = 0x1;
         ps->sampler_mask = sampler_mask;
index bfc395cdf558e654d7c56c7f6a44c436c636deac..6f053f709bfb7dbf360ae0da90dcca672e42df4b 100644 (file)
@@ -203,5 +203,9 @@ NinePixelShader9_new( struct NineDevice9 *pDevice,
                       struct NinePixelShader9 **ppOut,
                       const DWORD *pFunction, void *cso )
 {
-    NINE_DEVICE_CHILD_NEW(PixelShader9, ppOut, pDevice, pFunction, cso);
+    if (cso) { /* ff shader. Needs to start with bind count */
+        NINE_DEVICE_CHILD_BIND_NEW(PixelShader9, ppOut, pDevice, pFunction, cso);
+    } else {
+        NINE_DEVICE_CHILD_NEW(PixelShader9, ppOut, pDevice, pFunction, cso);
+    }
 }
index a4228af157e3640fb6b994d9585dd1f849577af6..f104a9ad13472c0f067e6731a3d5f0c6e093338c 100644 (file)
@@ -262,5 +262,9 @@ NineVertexShader9_new( struct NineDevice9 *pDevice,
                        struct NineVertexShader9 **ppOut,
                        const DWORD *pFunction, void *cso )
 {
-    NINE_DEVICE_CHILD_NEW(VertexShader9, ppOut, pDevice, pFunction, cso);
+    if (cso) {
+        NINE_DEVICE_CHILD_BIND_NEW(VertexShader9, ppOut, pDevice, pFunction, cso);
+    } else {
+        NINE_DEVICE_CHILD_NEW(VertexShader9, ppOut, pDevice, pFunction, cso);
+    }
 }