We signal the fences ourselves in virtio_gpu_fence_event_process,
shortly after we set last_fence_id. The window of time is small
enough such that it may be possible to return false in this optional
callback and rely on DMA_FENCE_FLAG_SIGNALED_BIT.

Signed-off-by: Gurchetan Singh <gurchetansi...@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_fence.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_fence.c 
b/drivers/gpu/drm/virtio/virtgpu_fence.c
index d63848178a58..a63a383347c4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fence.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fence.c
@@ -43,13 +43,10 @@ static const char *virtio_get_timeline_name(struct 
dma_fence *f)
 static bool virtio_fence_signaled(struct dma_fence *f)
 {
        struct virtio_gpu_fence *fence = to_virtio_fence(f);
-
-       if (WARN_ON_ONCE(fence->f.seqno == 0))
-               /* leaked fence outside driver before completing
-                * initialization with virtio_gpu_fence_emit */
-               return false;
-       if (atomic64_read(&fence->drv->last_fence_id) >= fence->f.seqno)
-               return true;
+       /* leaked fence outside driver before completing
+        * initialization with virtio_gpu_fence_emit
+        */
+       WARN_ON_ONCE(fence->fence_id == 0);
        return false;
 }
 
-- 
2.25.1.481.gfbce0eb801-goog

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to