Message ID | 20170629125930.821-1-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Jun 29, 2017 at 01:59:24PM +0100, Chris Wilson wrote: > 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> Hi Chris, Thanks for writing the code and walking me through it. Whole set is Reviewed-by: Sean Paul <seanpaul@chromium.org> I'll leave Gustavo or Sumit to apply. Sean > 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
Hi, 2017-06-29 Sean Paul <seanpaul@chromium.org>: > On Thu, Jun 29, 2017 at 01:59:24PM +0100, Chris Wilson wrote: > > 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> > > Hi Chris, > Thanks for writing the code and walking me through it. > > Whole set is > Reviewed-by: Sean Paul <seanpaul@chromium.org> > > I'll leave Gustavo or Sumit to apply. Pushed all to drm-misc-next. Thanks! Gustavo
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); } /**
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(-)