tu: Align BO size to page size
The kernel was rounding the size up for us, but it doesn't like a non-aligned map size, so just sanitize the size here. tu_cs was relying on the size not being rounded to keep the maximum size 2^20-1 or less, so fix that by using the initial unrounded size. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32533>
This commit is contained in:
@@ -176,7 +176,7 @@ tu_cs_add_bo(struct tu_cs *cs, uint32_t size)
|
|||||||
bos->bos[bos->bo_count++] = new_bo;
|
bos->bos[bos->bo_count++] = new_bo;
|
||||||
|
|
||||||
cs->start = cs->cur = cs->reserved_end = (uint32_t *) new_bo->map;
|
cs->start = cs->cur = cs->reserved_end = (uint32_t *) new_bo->map;
|
||||||
cs->end = cs->start + new_bo->size / sizeof(uint32_t);
|
cs->end = cs->start + size;
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ tu_bo_init_new_explicit_iova(struct tu_device *dev,
|
|||||||
MESA_TRACE_FUNC();
|
MESA_TRACE_FUNC();
|
||||||
struct tu_instance *instance = dev->physical_device->instance;
|
struct tu_instance *instance = dev->physical_device->instance;
|
||||||
|
|
||||||
|
size = align64(size, os_page_size);
|
||||||
|
|
||||||
VkResult result =
|
VkResult result =
|
||||||
dev->instance->knl->bo_init(dev, base, out_bo, size, client_iova,
|
dev->instance->knl->bo_init(dev, base, out_bo, size, client_iova,
|
||||||
mem_property, flags, name);
|
mem_property, flags, name);
|
||||||
@@ -65,6 +67,7 @@ tu_bo_init_dmabuf(struct tu_device *dev,
|
|||||||
uint64_t size,
|
uint64_t size,
|
||||||
int fd)
|
int fd)
|
||||||
{
|
{
|
||||||
|
size = align64(size, os_page_size);
|
||||||
VkResult result = dev->instance->knl->bo_init_dmabuf(dev, bo, size, fd);
|
VkResult result = dev->instance->knl->bo_init_dmabuf(dev, bo, size, fd);
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user