From be5a07aa52b04856e1903a86dcfa2d4be6b26c5b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 11 Jan 2023 12:03:31 -0600 Subject: [PATCH] nil: 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 Part-of: --- src/nouveau/nil/nil_image.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/nouveau/nil/nil_image.c b/src/nouveau/nil/nil_image.c index 71b879dbf26..2b03853fe3c 100644 --- a/src/nouveau/nil/nil_image.c +++ b/src/nouveau/nil/nil_image.c @@ -439,6 +439,11 @@ nil_image_init(struct nv_device_info *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; }