[PATCH 01/10] dma-buf: make fence sequence numbers 64 bit v2

Chris Wilson chris at chris-wilson.co.uk
Tue Dec 4 12:52:15 UTC 2018


Quoting Christian König (2018-12-04 11:59:39)
> -static inline bool __dma_fence_is_later(u32 f1, u32 f2)
> +static inline bool __dma_fence_is_later(u64 f1, u64 f2)
>  {
> -       return (int)(f1 - f2) > 0;
> +       /* 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.
> +        */
> +       if (upper_32_bits(f1) || upper_32_bits(f2))
> +               return f1 > f2;
> +
> +       return (int)(lower_32_bits(f1) - lower_32_bits(f2)) > 0;

Or just "(int64_t)(f1 - f2) > 0", works if drivers are only using the low
32b and if they use the full 64b.
-Chris


More information about the dri-devel mailing list