diff options
author | Lionel Landwerlin <[email protected]> | 2019-12-10 03:49:49 -0800 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2019-12-10 16:06:54 +0000 |
commit | 5fdea9f40182002899fc941bfb8c3f36ed5366a1 (patch) | |
tree | 675c0772b905aaa8d49411a81954a5533be55d71 | |
parent | dcfe1903c3f501429851d0278ba78742e907355b (diff) |
anv: fix incorrect VMA alignment for CCS main surfaces
Maybe finer way of dealing with this requirement would be to increase
the number of pdevice->memory.types[] to add a category for special
alignment cases.
Meanwhile this fixes the problem of CCS surface alignment and it's
probably not going to cause issues given the size of our address
space.
Signed-off-by: Lionel Landwerlin <[email protected]>
Fixes: 6af8a4acc4a4 ("anv: Add aux-map translation for gen12+")
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/intel/vulkan/anv_device.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 210136bb500..ca71cc6d245 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -2972,6 +2972,14 @@ bool anv_vma_alloc(struct anv_device *device, struct anv_bo *bo, uint64_t client_address) { + const struct anv_physical_device *pdevice = &device->instance->physicalDevice; + const struct gen_device_info *devinfo = &pdevice->info; + /* Gen12 CCS surface addresses need to be 64K aligned. We have no way of + * telling what this allocation is for so pick the largest alignment. + */ + const uint32_t vma_alignment = + devinfo->gen >= 12 ? (64 * 1024) : (4 * 1024); + if (!(bo->flags & EXEC_OBJECT_PINNED)) { assert(!(bo->has_client_visible_address)); return true; @@ -2989,7 +2997,8 @@ anv_vma_alloc(struct anv_device *device, struct anv_bo *bo, bo->offset = gen_canonical_address(client_address); } } else { - uint64_t addr = util_vma_heap_alloc(&device->vma_cva, bo->size, 4096); + uint64_t addr = + util_vma_heap_alloc(&device->vma_cva, bo->size, vma_alignment); if (addr) { bo->offset = gen_canonical_address(addr); assert(addr == gen_48b_address(bo->offset)); @@ -3002,7 +3011,8 @@ anv_vma_alloc(struct anv_device *device, struct anv_bo *bo, assert(client_address == 0); if (bo->flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS) { - uint64_t addr = util_vma_heap_alloc(&device->vma_hi, bo->size, 4096); + uint64_t addr = + util_vma_heap_alloc(&device->vma_hi, bo->size, vma_alignment); if (addr) { bo->offset = gen_canonical_address(addr); assert(addr == gen_48b_address(bo->offset)); @@ -3010,7 +3020,8 @@ anv_vma_alloc(struct anv_device *device, struct anv_bo *bo, } if (bo->offset == 0) { - uint64_t addr = util_vma_heap_alloc(&device->vma_lo, bo->size, 4096); + uint64_t addr = + util_vma_heap_alloc(&device->vma_lo, bo->size, vma_alignment); if (addr) { bo->offset = gen_canonical_address(addr); assert(addr == gen_48b_address(bo->offset)); |