diff options
author | Christian König <christian.koenig@amd.com> | 2019-04-15 14:46:34 +0200 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2019-04-16 14:49:10 +0200 |
commit | 5e498abf14858945f1249d9cc4ff1e8715a307e3 (patch) | |
tree | d8c599a61c51f700fd5dd9ae5d5492ce64e38b45 /include/linux/dma-fence.h | |
parent | 4dff47c7607a7ceb9916fec179dc88e7b90f3b7c (diff) | |
download | linux-5e498abf14858945f1249d9cc4ff1e8715a307e3.tar.gz linux-5e498abf14858945f1249d9cc4ff1e8715a307e3.tar.bz2 linux-5e498abf14858945f1249d9cc4ff1e8715a307e3.zip |
dma-buf: explicitely note that dma-fence-chains use 64bit seqno
Instead of checking the upper values of the sequence number use an explicit
field in the dma_fence_ops structure to note if a sequence should be 32bit
or 64bit.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Link: https://patchwork.freedesktop.org/patch/299655/
Diffstat (limited to 'include/linux/dma-fence.h')
-rw-r--r-- | include/linux/dma-fence.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h index 6b788467b2e3..974717d6ac0c 100644 --- a/include/linux/dma-fence.h +++ b/include/linux/dma-fence.h @@ -112,6 +112,14 @@ struct dma_fence_cb { */ struct dma_fence_ops { /** + * @use_64bit_seqno: + * + * True if this dma_fence implementation uses 64bit seqno, false + * otherwise. + */ + bool use_64bit_seqno; + + /** * @get_driver_name: * * Returns the driver name. This is a callback to allow drivers to @@ -410,18 +418,19 @@ dma_fence_is_signaled(struct dma_fence *fence) * __dma_fence_is_later - return if f1 is chronologically later than f2 * @f1: the first fence's seqno * @f2: the second fence's seqno from the same context + * @ops: dma_fence_ops associated with the seqno * * 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(u64 f1, u64 f2) +static inline bool __dma_fence_is_later(u64 f1, u64 f2, + const struct dma_fence_ops *ops) { /* This is for backward compatibility with drivers which can only handle - * 32bit sequence numbers. Use a 64bit compare when any of the higher - * bits are none zero, otherwise use a 32bit compare with wrap around - * handling. + * 32bit sequence numbers. Use a 64bit compare when the driver says to + * do so. */ - if (upper_32_bits(f1) || upper_32_bits(f2)) + if (ops->use_64bit_seqno) return f1 > f2; return (int)(lower_32_bits(f1) - lower_32_bits(f2)) > 0; @@ -441,7 +450,7 @@ static inline bool dma_fence_is_later(struct dma_fence *f1, if (WARN_ON(f1->context != f2->context)) return false; - return __dma_fence_is_later(f1->seqno, f2->seqno); + return __dma_fence_is_later(f1->seqno, f2->seqno, f1->ops); } /** |