On 31.10.2017 03:15, Marek Olšák wrote:
On Sun, Oct 22, 2017 at 9:07 PM, Nicolai Hähnle <nhaeh...@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.

You're quite right, I'm removing this assertion, thanks!



Marek



--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to