All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] dma-buf/dma-fence: Extract __dma_fence_is_later()
@ 2017-06-29 12:59 Chris Wilson
  2017-06-29 12:59 ` [PATCH 2/7] dma-buf/sw-sync: Fix the is-signaled test to handle u32 wraparound Chris Wilson
                   ` (8 more replies)
  0 siblings, 9 replies; 18+ messages in thread
From: Chris Wilson @ 2017-06-29 12:59 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Sumit Semwal

Often we have the task of comparing two seqno known to be on the same
context, so provide a common __dma_fence_is_later().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
---
 include/linux/dma-fence.h | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index a5195a7d6f77..ac5987989e9a 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -336,6 +336,19 @@ dma_fence_is_signaled(struct dma_fence *fence)
 }
 
 /**
+ * __dma_fence_is_later - return if f1 is chronologically later than f2
+ * @f1:	[in]	the first fence's seqno
+ * @f2:	[in]	the second fence's seqno from the same context
+ *
+ * Returns true if f1 is chronologically later than f2. Both fences must be
+ * from the same context, since a seqno is not common across contexts.
+ */
+static inline bool __dma_fence_is_later(u32 f1, u32 f2)
+{
+	return (int)(f1 - f2) > 0;
+}
+
+/**
  * dma_fence_is_later - return if f1 is chronologically later than f2
  * @f1:	[in]	the first fence from the same context
  * @f2:	[in]	the second fence from the same context
@@ -349,7 +362,7 @@ static inline bool dma_fence_is_later(struct dma_fence *f1,
 	if (WARN_ON(f1->context != f2->context))
 		return false;
 
-	return (int)(f1->seqno - f2->seqno) > 0;
+	return __dma_fence_is_later(f1->seqno, f2->seqno);
 }
 
 /**
-- 
2.13.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-06-29 23:20 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 12:59 [PATCH 1/7] dma-buf/dma-fence: Extract __dma_fence_is_later() Chris Wilson
2017-06-29 12:59 ` [PATCH 2/7] dma-buf/sw-sync: Fix the is-signaled test to handle u32 wraparound Chris Wilson
2017-06-29 12:59 ` [PATCH 3/7] dma-buf/sw-sync: Prevent user overflow on timeline advance Chris Wilson
2017-06-29 12:59 ` [PATCH 4/7] dma-buf/sw-sync: Reduce irqsave/irqrestore from known context Chris Wilson
2017-06-29 12:59 ` [PATCH 5/7] dma-buf/sw-sync: sync_pt is private and of fixed size Chris Wilson
2017-06-29 12:59 ` [PATCH 6/7] dma-buf/sw-sync: Fix locking around sync_timeline lists Chris Wilson
2017-06-29 17:22   ` Sean Paul
2017-06-29 17:29     ` Chris Wilson
2017-06-29 21:05   ` [PATCH v2] " Chris Wilson
2017-06-29 21:12   ` [PATCH v3] dma-buf/sw-sync: Use an rbtree to sort fences in the timeline Chris Wilson
2017-06-29 12:59 ` [PATCH 7/7] " Chris Wilson
2017-06-29 18:10   ` Sean Paul
2017-06-29 18:29     ` Chris Wilson
2017-06-29 21:08   ` [PATCH v2] " Chris Wilson
2017-06-29 14:08 ` ✓ Fi.CI.BAT: success for series starting with [1/7] dma-buf/dma-fence: Extract __dma_fence_is_later() Patchwork
2017-06-29 20:14 ` [PATCH 1/7] " Sean Paul
2017-06-29 23:20   ` Gustavo Padovan
2017-06-29 21:41 ` ✓ Fi.CI.BAT: success for series starting with [1/7] dma-buf/dma-fence: Extract __dma_fence_is_later() (rev4) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.