freedreno/drm: Assume explicit fences if in_fence_fd
authorRob Clark <robdclark@chromium.org>
Tue, 20 Apr 2021 15:57:54 +0000 (08:57 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 28 Apr 2021 15:36:42 +0000 (15:36 +0000)
If we ever see explicit fencing used, then we can disable implicit
fencing, even for internal or unfenced batches.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10444>

src/freedreno/drm/msm_priv.h
src/freedreno/drm/msm_ringbuffer_sp.c

index e4fe084..464f779 100644 (file)
@@ -63,6 +63,12 @@ struct msm_pipe {
    uint32_t last_submit_fence;
 
    uint32_t last_enqueue_fence;   /* just for debugging */
+
+   /**
+    * If we *ever* see an in-fence-fd, assume that userspace is
+    * not relying on implicit fences.
+    */
+   bool no_implicit_sync;
 };
 FD_DEFINE_CAST(fd_pipe, msm_pipe);
 
index 809c480..0a95369 100644 (file)
@@ -334,8 +334,13 @@ flush_submit_list(struct list_head *submit_list)
    }
 
    if (msm_submit->in_fence_fd != -1) {
-      req.flags |= MSM_SUBMIT_FENCE_FD_IN | MSM_SUBMIT_NO_IMPLICIT;
+      req.flags |= MSM_SUBMIT_FENCE_FD_IN;
       req.fence_fd = msm_submit->in_fence_fd;
+      msm_pipe->no_implicit_sync = true;
+   }
+
+   if (msm_pipe->no_implicit_sync) {
+      req.flags |= MSM_SUBMIT_NO_IMPLICIT;
    }
 
    if (msm_submit->out_fence && msm_submit->out_fence->use_fence_fd) {