[Mesa-dev] [PATCH 09/25] gallium/u_threaded: implement asynchronous flushes
Marek Olšák
maraeo at gmail.com
Tue Oct 31 02:15:07 UTC 2017
On Sun, Oct 22, 2017 at 9:07 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> @@ -107,20 +138,46 @@ static boolean si_fence_finish(struct pipe_screen *screen,
> uint64_t timeout)
> {
> struct radeon_winsys *rws = ((struct r600_common_screen*)screen)->ws;
> struct si_multi_fence *rfence = (struct si_multi_fence *)fence;
> struct r600_common_context *rctx;
> int64_t abs_timeout = os_time_get_absolute_timeout(timeout);
>
> ctx = threaded_context_unwrap_sync(ctx);
> rctx = ctx ? (struct r600_common_context*)ctx : NULL;
>
> + if (!util_queue_fence_is_signalled(&rfence->ready)) {
> + if (!timeout)
> + return false;
> +
> + if (rfence->tc_token) {
> + /* Ensure that si_flush_from_st will be called for
> + * this fence, but only if we're in the API thread
> + * where the context is current.
> + *
> + * Note that the batch containing the flush may already
> + * be in flight in the driver thread, so the fence
> + * may not be ready yet when this call returns.
> + */
> + threaded_context_flush(ctx, rfence->tc_token);
> + }
> +
> + if (timeout == PIPE_TIMEOUT_INFINITE) {
> + util_queue_fence_wait(&rfence->ready);
> + } else {
> + if (!util_queue_fence_wait_timeout(&rfence->ready, abs_timeout))
> + return false;
> + }
> +
> + assert(!rfence->tc_token);
tc_token might be non-NULL if this code is executed right after
si_flush_from_st signals the fence.
Marek
More information about the mesa-dev
mailing list