summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-05-30 20:00:37 -0700
committerJason Ekstrand <[email protected]>2018-05-31 16:51:45 -0700
commit6e4672f881bbc73c56b0d81dfea93d09f8d39eec (patch)
tree090a352ae80a31223b3192606ac8066591488b35 /src/intel
parent943fecc5691b55b8ce8740d133dd70614effb72d (diff)
intel/common: Add an address de-canonicalization helper
Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Scott D Phillips <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/common/gen_gem.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/intel/common/gen_gem.h b/src/intel/common/gen_gem.h
index 842a455e050..7dd9ae6d548 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 */