[Mesa-dev] [PATCH] [RFC] mesa/glthread: Call unmarshal_batch directly in glthread_finish when batch queue is empty.

Bartosz Tomczyk bartosz.tomczyk86 at gmail.com
Wed Mar 29 15:51:03 UTC 2017


Please ignore above patch.

On Wed, Mar 29, 2017 at 5:48 PM, Bartosz Tomczyk <
bartosz.tomczyk86 at gmail.com> wrote:

> This avoids costly thread synchronisation. With this fix games that
> previously regressed with mesa_glthread=true like xonotic or grid autosport.
> Could someone test if games that benefit from glthread didn't regress?
> ---
>  src/mesa/main/glthread.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c
> index 06115b916d..d46288c242 100644
> --- a/src/mesa/main/glthread.c
> +++ b/src/mesa/main/glthread.c
> @@ -252,12 +252,21 @@ _mesa_glthread_finish(struct gl_context *ctx)
>     if (pthread_self() == glthread->thread)
>        return;
>
> -   _mesa_glthread_flush_batch(ctx);
> -
>     pthread_mutex_lock(&glthread->mutex);
>
> -   while (glthread->batch_queue || glthread->busy)
> -      pthread_cond_wait(&glthread->work_done, &glthread->mutex);
> +   if (!(glthread->batch_queue || glthread->busy))
> +   {
> +      if (glthread->batch && glthread->batch->used)
> +      {
> +         glthread_unmarshal_batch(ctx, glthread->batch);
> +      }
> +      glthread_allocate_batch(ctx);
> +   }
> +   else
> +   {
> +      while (glthread->batch_queue || glthread->busy)
> +         pthread_cond_wait(&glthread->work_done, &glthread->mutex);
> +   }
>
>     pthread_mutex_unlock(&glthread->mutex);
>  }
> --
> 2.12.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170329/a7543535/attachment.html>


More information about the mesa-dev mailing list