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

Jason Ekstrand jason at jlekstrand.net
Thu May 31 15:46:25 UTC 2018


---
 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
+ */
+static inline uint64_t
+gen_48b_address(uint64_t v)
+{
+   const int shift = 63 - 47;
+   return (uint64_t)(v << shift) >> shift;
+}
+
 #endif /* GEN_GEM_H */
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list