<div dir="ltr">Please ignore above patch.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 29, 2017 at 5:48 PM, Bartosz Tomczyk <span dir="ltr"><<a href="mailto:bartosz.tomczyk86@gmail.com" target="_blank">bartosz.tomczyk86@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This avoids costly thread synchronisation. With this fix games that previously regressed with mesa_glthread=true like xonotic or grid autosport.<br>
Could someone test if games that benefit from glthread didn't regress?<br>
---<br>
 src/mesa/main/glthread.c | 17 +++++++++++++----<br>
 1 file changed, 13 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c<br>
index 06115b916d..d46288c242 100644<br>
--- a/src/mesa/main/glthread.c<br>
+++ b/src/mesa/main/glthread.c<br>
@@ -252,12 +252,21 @@ _mesa_glthread_finish(struct gl_context *ctx)<br>
    if (pthread_self() == glthread->thread)<br>
       return;<br>
<br>
-   _mesa_glthread_flush_batch(<wbr>ctx);<br>
-<br>
    pthread_mutex_lock(&glthread-><wbr>mutex);<br>
<br>
-   while (glthread->batch_queue || glthread->busy)<br>
-      pthread_cond_wait(&glthread-><wbr>work_done, &glthread->mutex);<br>
+   if (!(glthread->batch_queue || glthread->busy))<br>
+   {<br>
+      if (glthread->batch && glthread->batch->used)<br>
+      {<br>
+         glthread_unmarshal_batch(ctx, glthread->batch);<br>
+      }<br>
+      glthread_allocate_batch(ctx);<br>
+   }<br>
+   else<br>
+   {<br>
+      while (glthread->batch_queue || glthread->busy)<br>
+         pthread_cond_wait(&glthread-><wbr>work_done, &glthread->mutex);<br>
+   }<br>
<br>
    pthread_mutex_unlock(&<wbr>glthread->mutex);<br>
 }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.12.2<br>
<br>
</font></span></blockquote></div><br></div>