anv, hasvk: Fix reported CPU page size
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Memory mappings must be aligned to the smallest page size in use, which may
be 16k or 64k on some systems.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13720
Signed-off-by: Simon Richter <Simon.Richter@hogyros.de>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36801>
This commit is contained in:
Simon Richter 2025-08-16 22:33:43 +09:00 committed by Marge Bot
parent 450a6189de
commit 11325f922d
2 changed files with 14 additions and 5 deletions

View file

@ -17,6 +17,7 @@
#include "git_sha1.h"
#include "util/disk_cache.h"
#include "util/os_misc.h"
#include "util/mesa-sha1.h"
#include "util/os_misc.h"
@ -1281,6 +1282,10 @@ get_properties(const struct anv_physical_device *pdevice,
const struct intel_device_info *devinfo = &pdevice->info;
uint64_t page_size;
if (!os_get_page_size(&page_size))
page_size = 4096; /* fallback */
const VkDeviceSize max_heap_size = anx_get_physical_device_max_heap_size(pdevice);
const uint32_t max_workgroup_size =
@ -1391,7 +1396,7 @@ get_properties(const struct anv_physical_device *pdevice,
.maxViewportDimensions = { (1 << 14), (1 << 14) },
.viewportBoundsRange = { INT16_MIN, INT16_MAX },
.viewportSubPixelBits = 13, /* We take a float? */
.minMemoryMapAlignment = 4096, /* A page */
.minMemoryMapAlignment = page_size,
/* The dataport requires texel alignment so we need to assume a worst
* case of R32G32B32A32 which is 16 bytes.
*/
@ -1726,7 +1731,7 @@ get_properties(const struct anv_physical_device *pdevice,
/* VK_EXT_external_memory_host */
{
props->minImportedHostPointerAlignment = 4096;
props->minImportedHostPointerAlignment = page_size;
}
/* VK_EXT_graphics_pipeline_library */
@ -1829,7 +1834,7 @@ get_properties(const struct anv_physical_device *pdevice,
/* VK_EXT_map_memory_placed */
{
props->minPlacedMemoryMapAlignment = 4096;
props->minPlacedMemoryMapAlignment = page_size;
}
/* VK_EXT_mesh_shader */

View file

@ -948,6 +948,10 @@ get_properties(const struct anv_physical_device *pdevice,
{
const struct intel_device_info *devinfo = &pdevice->info;
uint64_t page_size;
if (!os_get_page_size(&page_size))
page_size = 4096; /* fallback */
const uint32_t max_ssbos = pdevice->has_a64_buffer_access ? UINT16_MAX : 64;
const uint32_t max_textures = 128;
const uint32_t max_samplers =
@ -1063,7 +1067,7 @@ get_properties(const struct anv_physical_device *pdevice,
.maxViewportDimensions = { (1 << 14), (1 << 14) },
.viewportBoundsRange = { INT16_MIN, INT16_MAX },
.viewportSubPixelBits = 13, /* We take a float? */
.minMemoryMapAlignment = 4096, /* A page */
.minMemoryMapAlignment = page_size,
/* The dataport requires texel alignment so we need to assume a worst
* case of R32G32B32A32 which is 16 bytes.
*/
@ -1155,7 +1159,7 @@ get_properties(const struct anv_physical_device *pdevice,
/* VK_EXT_external_memory_host */
{
/* Userptr needs page aligned memory. */
props->minImportedHostPointerAlignment = 4096;
props->minImportedHostPointerAlignment = page_size;
}
/* VK_EXT_line_rasterization */