mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
panfrost: Add heap_memory_percent driconf support
This also changes `max_mem_alloc_size` to use 100% instead of the heuristic, consistent with `video_memory`. Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
This commit is contained in:
parent
084164fbb5
commit
253f3a30eb
4 changed files with 18 additions and 19 deletions
|
|
@ -22,6 +22,7 @@ DRI_CONF_SECTION_PERFORMANCE
|
|||
DRI_CONF_SECTION_END
|
||||
|
||||
DRI_CONF_SECTION_MISCELLANEOUS
|
||||
DRI_CONF_HEAP_MEMORY_PERCENT(1.0f)
|
||||
DRI_CONF_PAN_COMPUTE_CORE_MASK(~0ull)
|
||||
DRI_CONF_PAN_FRAGMENT_CORE_MASK(~0ull)
|
||||
DRI_CONF_OPT_B(pan_relax_afbc_yuv_imports, false, "Use relaxed import rules for AFBC(YUV)")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "frontend/winsys_handle.h"
|
||||
#include "util/format/u_format.h"
|
||||
#include "util/os_misc.h"
|
||||
#include "util/u_debug_image.h"
|
||||
#include "util/u_drm.h"
|
||||
#include "util/u_gen_mipmap.h"
|
||||
|
|
@ -1049,10 +1050,10 @@ panfrost_can_create_resource(struct pipe_screen *screen,
|
|||
if (!os_get_total_physical_memory(&system_memory))
|
||||
return false;
|
||||
|
||||
/* Limit maximum texture size to a quarter of the system memory, to avoid
|
||||
* allocating huge textures on systems with little memory.
|
||||
*/
|
||||
return tmp.plane.layout.data_size_B <= system_memory / 4;
|
||||
uint64_t memory =
|
||||
os_get_gpu_heap_size(screen->heap_memory_percent, NULL);
|
||||
|
||||
return tmp.plane.layout.data_size_B <= memory;
|
||||
}
|
||||
|
||||
static struct pipe_resource *
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "pipe/p_screen.h"
|
||||
#include "util/format/u_format.h"
|
||||
#include "util/format/u_format_s3tc.h"
|
||||
#include "util/os_misc.h"
|
||||
#include "util/os_time.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_memory.h"
|
||||
|
|
@ -634,18 +635,8 @@ panfrost_init_compute_caps(struct panfrost_screen *screen)
|
|||
*/
|
||||
caps->max_threads_per_block = dev->arch >= 6 ? 256 : 128;
|
||||
|
||||
uint64_t total_ram;
|
||||
if (!os_get_total_physical_memory(&total_ram))
|
||||
total_ram = 0;
|
||||
|
||||
/* 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 * 1024 * 1024 * 1024)
|
||||
available_ram = total_ram / 2;
|
||||
else
|
||||
available_ram = total_ram * 3 / 4;
|
||||
const uint64_t available_ram =
|
||||
os_get_gpu_heap_size(screen->heap_memory_percent, NULL);
|
||||
|
||||
/* 48bit address space max, with the lower 32MB reserved. We clamp
|
||||
* things so it matches kmod VA range limitations.
|
||||
|
|
@ -843,9 +834,8 @@ panfrost_init_screen_caps(struct panfrost_screen *screen)
|
|||
|
||||
caps->max_texture_gather_offset = 7;
|
||||
|
||||
uint64_t system_memory;
|
||||
caps->video_memory = os_get_total_physical_memory(&system_memory) ?
|
||||
system_memory >> 20 : 0;
|
||||
caps->video_memory =
|
||||
os_get_gpu_heap_size(screen->heap_memory_percent, NULL) >> 20;
|
||||
|
||||
caps->shader_stencil_export = true;
|
||||
caps->conditional_render = true;
|
||||
|
|
@ -1063,6 +1053,11 @@ panfrost_create_screen(int fd, const struct pipe_screen_config *config,
|
|||
snprintf(screen->renderer_string, sizeof(screen->renderer_string),
|
||||
"%s MC%u (Panfrost)", dev->model->name, core_count);
|
||||
|
||||
screen->heap_memory_percent =
|
||||
driQueryOptionf(config->options, "heap_memory_percent");
|
||||
if (screen->heap_memory_percent == OS_GPU_HEAP_SIZE_HEURISTIC)
|
||||
screen->heap_memory_percent = 1.0f;
|
||||
|
||||
screen->afbc_tiled = driQueryOptionb(config->options, "pan_afbc_tiled");
|
||||
|
||||
screen->force_afbc_packing = dev->debug & PAN_DBG_FORCE_PACK;
|
||||
|
|
|
|||
|
|
@ -106,6 +106,8 @@ struct panfrost_screen {
|
|||
struct panfrost_vtable vtbl;
|
||||
struct disk_cache *disk_cache;
|
||||
|
||||
float heap_memory_percent;
|
||||
|
||||
/* Use AFBC tiled layout whenever possible */
|
||||
bool afbc_tiled;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue