mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-26 07:00:31 +01:00
iris: use os_get_total_physical_memory instead of open-coding
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36621>
This commit is contained in:
parent
2213a76c0a
commit
44bc8557ae
1 changed files with 2 additions and 7 deletions
|
|
@ -182,15 +182,10 @@ iris_get_video_memory(struct iris_screen *screen)
|
|||
const unsigned gpu_mappable_megabytes =
|
||||
(devinfo->aperture_bytes * 3 / 4) / (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))
|
||||
return -1;
|
||||
|
||||
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));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue