Skip to content
Snippets Groups Projects
Commit 8e62a1c9 authored by Dave Airlie's avatar Dave Airlie
Browse files

nvk/image: fix image align and size constraints.

In order to use compressed images we have to align to at least (1<<16)
though the kernel also likes (1<<21).

This fixes the alignments/sizes so they can work with vm allocs
parent 5df8e68c
No related branches found
No related tags found
Loading
......@@ -439,6 +439,11 @@ nil_image_init(struct nouveau_ws_device *dev,
image->pte_kind = nil_choose_pte_kind(dev, info->format, info->samples,
true /* TODO: compressed */);
image->align_B = MAX2(image->align_B, 4096);
if (image->pte_kind >= 0xb && image->pte_kind <= 0xe)
image->align_B = MAX2(image->align_B, (1 << 16));
image->size_B = ALIGN(image->size_B, image->align_B);
return true;
}
......
......@@ -352,8 +352,9 @@ nvk_GetImageMemoryRequirements2(VkDevice _device,
uint32_t memory_types = (1 << device->pdev->mem_type_cnt) - 1;
// TODO hope for the best?
pMemoryRequirements->memoryRequirements.memoryTypeBits = memory_types;
pMemoryRequirements->memoryRequirements.alignment = 0x1000;
pMemoryRequirements->memoryRequirements.alignment = image->nil.align_B;
pMemoryRequirements->memoryRequirements.size = image->nil.size_B;
vk_foreach_struct_const(ext, pMemoryRequirements->pNext) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment