All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, Sumit Semwal <sumit.semwal@linaro.org>
Subject: [PATCH 1/7] dma-buf/dma-fence: Extract __dma_fence_is_later()
Date: Thu, 29 Jun 2017 13:59:24 +0100	[thread overview]
Message-ID: <20170629125930.821-1-chris@chris-wilson.co.uk> (raw)

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

             reply	other threads:[~2017-06-29 12:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 12:59 Chris Wilson [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170629125930.821-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.