[Mesa-dev] [PATCH v4 04/23] intel/common: Add an address de-cannonicalization helper

Kenneth Graunke kenneth at whitecape.org
Thu May 31 17:05:29 UTC 2018


On Thursday, May 31, 2018 8:46:25 AM PDT Jason Ekstrand wrote:
> ---
>  src/intel/common/gen_gem.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/intel/common/gen_gem.h b/src/intel/common/gen_gem.h
> index 842a455..eef6a5e 100644
> --- a/src/intel/common/gen_gem.h
> +++ b/src/intel/common/gen_gem.h
> @@ -40,4 +40,14 @@ gen_canonical_address(uint64_t v)
>     return (int64_t)(v << shift) >> shift;
>  }
>  
> +/**
> + * This is the opposite of gen_canonicalize_address
> + */

/**
 * This returns a 48-bit address with the high 16 bits zeroed.
 *
 * It's the opposite of gen_canonicalize_address.
 */

> +static inline uint64_t
> +gen_48b_address(uint64_t v)
> +{
> +   const int shift = 63 - 47;
> +   return (uint64_t)(v << shift) >> shift;

   return v & ((1ull << 48) - 1);

> +}
> +
>  #endif /* GEN_GEM_H */
> 

Also type in title, s/cannon/canon/

With those changes,
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180531/b7037d23/attachment.sig>


More information about the mesa-dev mailing list