From 2213a76c0a33db8aeb9af9afbccb89fc55561168 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 6 Aug 2025 17:40:45 +0200 Subject: [PATCH] crocus: use os_get_total_physical_memory instead of open-coding Reviewed-by: Lionel Landwerlin Part-of: --- src/gallium/drivers/crocus/crocus_screen.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/crocus/crocus_screen.c b/src/gallium/drivers/crocus/crocus_screen.c index f88834a983e..24c18b2a56f 100644 --- a/src/gallium/drivers/crocus/crocus_screen.c +++ b/src/gallium/drivers/crocus/crocus_screen.c @@ -381,15 +381,10 @@ crocus_init_screen_caps(struct crocus_screen *screen) const unsigned gpu_mappable_megabytes = (screen->aperture_threshold) / (1024 * 1024); - const long system_memory_pages = sysconf(_SC_PHYS_PAGES); - const long system_page_size = sysconf(_SC_PAGE_SIZE); - - if (system_memory_pages <= 0 || system_page_size <= 0) { + uint64_t system_memory_bytes; + if (!os_get_total_physical_memory(&system_memory_bytes)) { caps->video_memory = -1; } else { - const uint64_t system_memory_bytes = - (uint64_t) system_memory_pages * (uint64_t) system_page_size; - const unsigned system_memory_megabytes = (unsigned) (system_memory_bytes / (1024 * 1024));