anv: Make anv_address::offset 64-bit

This allows us to convert a 64-bit address to an anv_address which is
useful for working with device addresses.

v2: switch to int64_t to keep state pool relative relocation working
    on non-softpin platforms

v3: Update assert to reflect relative offsets (Jason)

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8637>
This commit is contained in:
Jason Ekstrand 2020-07-06 18:12:35 -05:00 committed by Marge Bot
parent a67d7c9dee
commit ac6d7a1758
1 changed files with 13 additions and 2 deletions

View File

@ -1177,7 +1177,7 @@ anv_device_upload_nir(struct anv_device *device,
struct anv_address {
struct anv_bo *bo;
uint32_t offset;
int64_t offset;
};
struct anv_device {
@ -1639,6 +1639,16 @@ anv_batch_emit_reloc(struct anv_batch *batch,
#define ANV_NULL_ADDRESS ((struct anv_address) { NULL, 0 })
static inline struct anv_address
anv_address_from_u64(uint64_t addr_u64)
{
assert(addr_u64 == intel_canonical_address(addr_u64));
return (struct anv_address) {
.bo = NULL,
.offset = addr_u64,
};
}
static inline bool
anv_address_is_null(struct anv_address addr)
{
@ -1691,7 +1701,8 @@ _anv_combine_address(struct anv_batch *batch, void *location,
return anv_address_physical(anv_address_add(address, delta));
} else {
assert(batch->start <= location && location < batch->end);
/* i915 relocations are signed. */
assert(INT32_MIN <= address.offset && address.offset <= INT32_MAX);
return anv_batch_emit_reloc(batch, location, address.bo, address.offset + delta);
}
}