mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
pvr: Use os_get_gpu_heap_size()
To use the common function, this gives up the warning about the memory being too small to meet the Vulkan spec for low end devices. Note: the common helper expose 25% for devices with <=1GiB but to adhere to the Vulkan spec, the value is clamped to 1GiB. Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
This commit is contained in:
parent
6331fedd31
commit
62c0f4811d
1 changed files with 5 additions and 21 deletions
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "util/disk_cache.h"
|
||||
#include "util/ralloc.h"
|
||||
#include "util/os_misc.h"
|
||||
|
||||
#include "vk_util.h"
|
||||
#include "vk_log.h"
|
||||
|
|
@ -986,30 +987,13 @@ static bool pvr_device_is_conformant(const struct pvr_device_info *info)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Minimum required by the Vulkan 1.1 spec (see Table 32. Required Limits) */
|
||||
/* Minimum required by the Vulkan spec Limits (maxMemoryAllocationSize) */
|
||||
#define PVR_MAX_MEMORY_ALLOCATION_SIZE (1ull << 30)
|
||||
|
||||
static uint64_t pvr_compute_heap_size(void)
|
||||
static inline uint64_t pvr_compute_heap_size(void)
|
||||
{
|
||||
/* Query the total ram from the system */
|
||||
uint64_t total_ram;
|
||||
if (!os_get_total_physical_memory(&total_ram))
|
||||
return 0;
|
||||
|
||||
if (total_ram < PVR_MAX_MEMORY_ALLOCATION_SIZE) {
|
||||
mesa_logw(
|
||||
"Warning: The available RAM is below the minimum required by the Vulkan specification!");
|
||||
}
|
||||
|
||||
/* We don't want to burn too much ram with the GPU. If the user has 4GiB
|
||||
* or less, we use at most half. If they have more than 4GiB, we use 3/4.
|
||||
*/
|
||||
uint64_t available_ram;
|
||||
if (total_ram <= 4ULL * 1024ULL * 1024ULL * 1024ULL)
|
||||
available_ram = total_ram / 2U;
|
||||
else
|
||||
available_ram = total_ram * 3U / 4U;
|
||||
|
||||
uint64_t available_ram =
|
||||
os_get_gpu_heap_size(OS_GPU_HEAP_SIZE_HEURISTIC, NULL);
|
||||
return MAX2(available_ram, PVR_MAX_MEMORY_ALLOCATION_SIZE);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue