[Mesa-dev] [PATCH 1/3] llvmpipe: add lp_fence_timedwait() helper

Roland Scheidegger sroland at vmware.com
Fri Apr 12 15:56:31 UTC 2019


Looks correct to me.
For the series,
Reviewed-by: Roland Scheidegger <sroland at vmware.com>

Am 11.04.19 um 18:05 schrieb Emil Velikov:
> The function is analogous to lp_fence_wait() while taking at timeout
> (ns) parameter, as needed for EGL fence/sync.
> 
> Cc: Roland Scheidegger <sroland at vmware.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>  src/gallium/drivers/llvmpipe/lp_fence.c | 22 ++++++++++++++++++++++
>  src/gallium/drivers/llvmpipe/lp_fence.h |  3 +++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c b/src/gallium/drivers/llvmpipe/lp_fence.c
> index 20cd91cd63d..f8b31a9d6a5 100644
> --- a/src/gallium/drivers/llvmpipe/lp_fence.c
> +++ b/src/gallium/drivers/llvmpipe/lp_fence.c
> @@ -125,3 +125,25 @@ lp_fence_wait(struct lp_fence *f)
>  }
>  
>  
> +boolean
> +lp_fence_timedwait(struct lp_fence *f, uint64_t timeout)
> +{
> +   struct timespec ts = {
> +      .tv_nsec = timeout % 1000000000L,
> +      .tv_sec = timeout / 1000000000L,
> +   };
> +   int ret;
> +
> +   if (LP_DEBUG & DEBUG_FENCE)
> +      debug_printf("%s %d\n", __FUNCTION__, f->id);
> +
> +   mtx_lock(&f->mutex);
> +   assert(f->issued);
> +   while (f->count < f->rank) {
> +      ret = cnd_timedwait(&f->signalled, &f->mutex, &ts);
> +   }
> +   mtx_unlock(&f->mutex);
> +   return ret == thrd_success;
> +}
> +
> +
> diff --git a/src/gallium/drivers/llvmpipe/lp_fence.h b/src/gallium/drivers/llvmpipe/lp_fence.h
> index b72026492c6..5ba746d22d1 100644
> --- a/src/gallium/drivers/llvmpipe/lp_fence.h
> +++ b/src/gallium/drivers/llvmpipe/lp_fence.h
> @@ -65,6 +65,9 @@ lp_fence_signalled(struct lp_fence *fence);
>  void
>  lp_fence_wait(struct lp_fence *fence);
>  
> +boolean
> +lp_fence_timedwait(struct lp_fence *fence, uint64_t timeout);
> +
>  void
>  llvmpipe_init_screen_fence_funcs(struct pipe_screen *screen);
>  
> 



More information about the mesa-dev mailing list