Mesa (master): intel/common: Add an address de-canonicalization helper
Jason Ekstrand
jekstrand at kemper.freedesktop.org
Thu May 31 23:54:19 UTC 2018
Module: Mesa
Branch: master
Commit: 6e4672f881bbc73c56b0d81dfea93d09f8d39eec
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e4672f881bbc73c56b0d81dfea93d09f8d39eec
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Wed May 30 20:00:37 2018 -0700
intel/common: Add an address de-canonicalization helper
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Scott D Phillips <scott.d.phillips at intel.com>
---
src/intel/common/gen_gem.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/intel/common/gen_gem.h b/src/intel/common/gen_gem.h
index 842a455e05..7dd9ae6d54 100644
--- a/src/intel/common/gen_gem.h
+++ b/src/intel/common/gen_gem.h
@@ -40,4 +40,16 @@ gen_canonical_address(uint64_t v)
return (int64_t)(v << shift) >> shift;
}
+/**
+ * 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;
+}
+
#endif /* GEN_GEM_H */
More information about the mesa-commit
mailing list