From 7c3bd27d3b7e76ffde9d5bdc873246694d58d5a2 Mon Sep 17 00:00:00 2001 From: "Thomas H.P. Andersen" Date: Wed, 19 Jun 2024 13:32:09 +0200 Subject: [PATCH] nvk/upload_queue: fix the _fill method When calculating the height for multi line uploads we should ensure that we do not exceed max_dim rather than using at least max_dim. The assert is also changed to ensure that we do not upload more than the source size. Fixes: 22e44d54fd1396411ff58807180c4b8ac051bdc8 Part-of: --- src/nouveau/vulkan/nvk_upload_queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nouveau/vulkan/nvk_upload_queue.c b/src/nouveau/vulkan/nvk_upload_queue.c index af238cc87f8..0c002e72c2c 100644 --- a/src/nouveau/vulkan/nvk_upload_queue.c +++ b/src/nouveau/vulkan/nvk_upload_queue.c @@ -376,12 +376,12 @@ nvk_upload_queue_fill_locked(struct nvk_device *dev, uint32_t width_B, height; if (size > max_dim) { width_B = max_dim; - height = MAX2(max_dim, size / width_B); + height = MIN2(max_dim, size / width_B); } else { width_B = size; height = 1; } - assert(size <= width_B * height); + assert(width_B * height <= size); struct nv_push p; nv_push_init(&p, queue->bo->map + queue->bo_push_end, cmd_size_dw);