diff options
author | Jason Ekstrand <[email protected]> | 2018-05-30 18:16:50 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-05-31 16:51:46 -0700 |
commit | 94081ffc80cc993c1c76cf427d8efd37e68de6f8 (patch) | |
tree | 241e12167ca2d3c7130847c06c57b194c7825439 | |
parent | aaea46242d651a1b03f7292ac89a68f8a9086692 (diff) |
anv: Add some anv_address helpers
Reviewed-by: Scott D Phillips <[email protected]>
-rw-r--r-- | src/intel/vulkan/anv_private.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 60444d99a42..bcd2197e7f9 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1120,6 +1120,30 @@ struct anv_address { uint32_t offset; }; +#define ANV_NULL_ADDRESS ((struct anv_address) { NULL, 0 }) + +static inline bool +anv_address_is_null(struct anv_address addr) +{ + return addr.bo == NULL && addr.offset == 0; +} + +static inline uint64_t +anv_address_physical(struct anv_address addr) +{ + if (addr.bo && (addr.bo->flags & EXEC_OBJECT_PINNED)) + return gen_canonical_address(addr.bo->offset + addr.offset); + else + return gen_canonical_address(addr.offset); +} + +static inline struct anv_address +anv_address_add(struct anv_address addr, uint64_t offset) +{ + addr.offset += offset; + return addr; +} + static inline uint64_t _anv_combine_address(struct anv_batch *batch, void *location, const struct anv_address address, uint32_t delta) |