mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
freedreno: Add heap_memory_percent driconf support
Note: instead of using the common heuristic, the old behavior is maintained. Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
This commit is contained in:
parent
9e52b99500
commit
69d7a20fa6
3 changed files with 21 additions and 18 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// freedreno specific driconf options
|
||||
|
||||
DRI_CONF_SECTION_MISCELLANEOUS
|
||||
DRI_CONF_HEAP_MEMORY_PERCENT(0)
|
||||
DRI_CONF_DISABLE_CONSERVATIVE_LRZ(false)
|
||||
DRI_CONF_DISABLE_EXPLICIT_SYNC_HEURISTIC(false)
|
||||
DRI_CONF_SECTION_END
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "util/format/u_format.h"
|
||||
#include "util/format/u_format_s3tc.h"
|
||||
#include "util/os_misc.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_inlines.h"
|
||||
#include "util/u_memory.h"
|
||||
|
|
@ -25,7 +26,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
#include <sys/sysinfo.h>
|
||||
|
||||
#include "freedreno_fence.h"
|
||||
#include "freedreno_perfetto.h"
|
||||
|
|
@ -186,18 +186,21 @@ fd_screen_destroy(struct pipe_screen *pscreen)
|
|||
static uint64_t
|
||||
get_memory_size(struct fd_screen *screen)
|
||||
{
|
||||
uint64_t system_memory;
|
||||
float percent = screen->driconf.heap_memory_percent;
|
||||
uint64_t va_size = 0;
|
||||
|
||||
if (!os_get_total_physical_memory(&system_memory))
|
||||
return 0;
|
||||
if (fd_device_version(screen->dev) >= FD_VERSION_VA_SIZE) {
|
||||
uint64_t va_size;
|
||||
if (!fd_pipe_get_param(screen->pipe, FD_VA_SIZE, &va_size)) {
|
||||
system_memory = MIN2(system_memory / 2, va_size);
|
||||
}
|
||||
}
|
||||
if (fd_device_version(screen->dev) >= FD_VERSION_VA_SIZE)
|
||||
fd_pipe_get_param(screen->pipe, FD_VA_SIZE, &va_size);
|
||||
|
||||
return system_memory;
|
||||
if (percent == OS_GPU_HEAP_SIZE_HEURISTIC)
|
||||
percent = va_size ? 0.5f : 1.0f;
|
||||
|
||||
uint64_t memory = os_get_gpu_heap_size(percent, NULL);
|
||||
|
||||
if (va_size)
|
||||
memory = MIN2(memory, va_size);
|
||||
|
||||
return memory;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -351,11 +354,11 @@ fd_init_compute_caps(struct fd_screen *screen)
|
|||
|
||||
caps->max_threads_per_block = options->max_workgroup_invocations;
|
||||
|
||||
caps->max_global_size = screen->ram_size;
|
||||
caps->max_global_size = os_get_gpu_heap_size(1.0f, NULL);
|
||||
|
||||
caps->max_local_size = screen->info->cs_shared_mem_size;
|
||||
|
||||
caps->max_mem_alloc_size = screen->ram_size;
|
||||
caps->max_mem_alloc_size = caps->max_global_size;
|
||||
|
||||
caps->max_clock_frequency = screen->max_freq / 1000000;
|
||||
|
||||
|
|
@ -1000,6 +1003,8 @@ fd_screen_create(int fd,
|
|||
driParseConfigFiles(config->options, config->options_info, 0, "msm",
|
||||
NULL, fd_dev_name(screen->dev_id), NULL, 0, NULL, 0);
|
||||
|
||||
screen->driconf.heap_memory_percent =
|
||||
driQueryOptionf(config->options, "heap_memory_percent");
|
||||
screen->driconf.conservative_lrz =
|
||||
!driQueryOptionb(config->options, "disable_conservative_lrz");
|
||||
screen->driconf.enable_throttling =
|
||||
|
|
@ -1009,10 +1014,6 @@ fd_screen_create(int fd,
|
|||
if (driQueryOptionb(config->options, "disable_explicit_sync_heuristic"))
|
||||
fd_device_disable_explicit_sync_heuristic(dev);
|
||||
|
||||
struct sysinfo si;
|
||||
sysinfo(&si);
|
||||
screen->ram_size = si.totalram;
|
||||
|
||||
DBG("Pipe Info:");
|
||||
DBG(" GPU-id: %s", fd_dev_name(screen->dev_id));
|
||||
DBG(" Chip-id: 0x%016"PRIx64, screen->chip_id);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ struct fd_screen {
|
|||
uint32_t gpu_id; /* 220, 305, etc */
|
||||
uint64_t chip_id; /* coreid:8 majorrev:8 minorrev:8 patch:8 */
|
||||
uint32_t max_freq;
|
||||
uint32_t ram_size;
|
||||
uint32_t max_rts; /* max # of render targets */
|
||||
uint32_t priority_mask;
|
||||
unsigned prio_low, prio_norm, prio_high; /* remap low/norm/high priority to kernel priority */
|
||||
|
|
@ -93,6 +92,8 @@ struct fd_screen {
|
|||
/* If "dual_color_blend_by_location" workaround is enabled
|
||||
*/
|
||||
bool dual_color_blend_by_location;
|
||||
|
||||
float heap_memory_percent;
|
||||
} driconf;
|
||||
|
||||
struct fd_dev_info dev_info;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue