summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-04-06 23:08:52 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:05 -0800
commit1398c99affc280098f5724321d04a0b0baa17ccb (patch)
tree80b439ab3ac6d2125c41439e6c4bc2bcfd750523
parentb69a85bc4dc2af7667b37301a84d5eaa6ee0b1d4 (diff)
iris: canonicalize addresses.
Back to working! Woo!
-rw-r--r--src/gallium/drivers/iris/iris_bufmgr.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c
index c1a4fa5d5f3..a81a2561fe2 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -344,12 +344,30 @@ vma_alloc(struct iris_bufmgr *bufmgr,
return 1ull << 32;
struct bo_cache_bucket *bucket = get_bucket_allocator(bufmgr, size);
+ uint64_t addr;
- if (bucket)
- return bucket_vma_alloc(bufmgr, bucket, memzone);
+ if (bucket) {
+ addr = bucket_vma_alloc(bufmgr, bucket, memzone);
+ } else {
+ addr = util_vma_heap_alloc(&bufmgr->vma_allocator[memzone], size,
+ alignment);
+ }
+
+ /* Canonicalize the address.
+ *
+ * The Broadwell PRM Vol. 2a, MI_LOAD_REGISTER_MEM::MemoryAddress says:
+ *
+ * "This field specifies the address of the memory location where the
+ * register value specified in the DWord above will read from. The
+ * address specifies the DWord location of the data. Range =
+ * GraphicsVirtualAddress[63:2] for a DWord register GraphicsAddress
+ * [63:48] are ignored by the HW and assumed to be in correct
+ * canonical form [63:48] == [47]."
+ */
+ const int shift = 63 - 47;
+ addr = (((int64_t) addr) << shift) >> shift;
- return util_vma_heap_alloc(&bufmgr->vma_allocator[memzone], size,
- alignment);
+ return addr;
}
static void