From a0f80774ce644b67307ac4a8cc6a9a7553c59db1 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Fri, 12 Apr 2024 10:38:20 +0200 Subject: [PATCH] panvk: Return os_page_size for minMemoryMapAlignment The spec says "When mapping a memory allocation with vkMapMemory, subtracting offset bytes from the returned pointer will always produce an integer multiple of this limit", meaning the OS page size. As the page size depends on the kernel configuration, this should be queried at runtime. Signed-off-by: Mary Guillemard Reviewed-by: Erik Faye-Lund Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/vulkan/panvk_physical_device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/panfrost/vulkan/panvk_physical_device.c b/src/panfrost/vulkan/panvk_physical_device.c index 335c61ed330b7..f8b583c565e15 100644 --- a/src/panfrost/vulkan/panvk_physical_device.c +++ b/src/panfrost/vulkan/panvk_physical_device.c @@ -372,6 +372,9 @@ panvk_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, { VK_FROM_HANDLE(panvk_physical_device, pdevice, physicalDevice); + uint64_t os_page_size = 4096; + os_get_page_size(&os_page_size); + /* HW supports MSAA 4, 8 and 16, but we limit ourselves to MSAA 4 for now. */ VkSampleCountFlags sample_counts = VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT; @@ -559,7 +562,7 @@ panvk_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, .viewportSubPixelBits = 0, /* Align on a page. */ - .minMemoryMapAlignment = 4096, + .minMemoryMapAlignment = os_page_size, /* Some compressed texture formats require 128-byte alignment. */ .minTexelBufferOffsetAlignment = 64,