mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
asahi: Add heap_memory_percent driconf support
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
This commit is contained in:
parent
a0415a4763
commit
bb58ff5b0e
3 changed files with 17 additions and 10 deletions
|
|
@ -30,6 +30,7 @@
|
|||
#include "util/format/u_formats.h"
|
||||
#include "util/half_float.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/os_misc.h"
|
||||
#include "util/simple_mtx.h"
|
||||
#include "util/timespec.h"
|
||||
#include "util/u_drm.h"
|
||||
|
|
@ -1887,10 +1888,9 @@ static void
|
|||
agx_query_memory_info(struct pipe_screen *pscreen,
|
||||
struct pipe_memory_info *info)
|
||||
{
|
||||
uint64_t mem_B = 0;
|
||||
os_get_total_physical_memory(&mem_B);
|
||||
|
||||
uint64_t mem_kB = mem_B / 1024;
|
||||
struct agx_screen *screen = agx_screen(pscreen);
|
||||
uint64_t mem_kB =
|
||||
os_get_gpu_heap_size(screen->heap_memory_percent, NULL) / 1024;
|
||||
|
||||
*info = (struct pipe_memory_info){
|
||||
.total_device_memory = mem_kB,
|
||||
|
|
@ -1967,6 +1967,7 @@ agx_init_compute_caps(struct pipe_screen *pscreen)
|
|||
{
|
||||
struct pipe_compute_caps *caps =
|
||||
(struct pipe_compute_caps *)&pscreen->compute_caps;
|
||||
struct agx_screen *screen = agx_screen(pscreen);
|
||||
struct agx_device *dev = agx_device(pscreen);
|
||||
|
||||
caps->address_bits = 64;
|
||||
|
|
@ -1981,10 +1982,8 @@ agx_init_compute_caps(struct pipe_screen *pscreen)
|
|||
|
||||
caps->max_threads_per_block = 1024;
|
||||
|
||||
uint64_t system_memory;
|
||||
if (os_get_total_physical_memory(&system_memory)) {
|
||||
caps->max_global_size = caps->max_mem_alloc_size = system_memory;
|
||||
}
|
||||
caps->max_global_size = caps->max_mem_alloc_size =
|
||||
os_get_gpu_heap_size(screen->heap_memory_percent, NULL);
|
||||
|
||||
caps->max_local_size = 32768;
|
||||
|
||||
|
|
@ -2001,6 +2000,7 @@ static void
|
|||
agx_init_screen_caps(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct pipe_caps *caps = (struct pipe_caps *)&pscreen->caps;
|
||||
struct agx_screen *screen = agx_screen(pscreen);
|
||||
|
||||
u_init_pipe_screen_caps(pscreen, 1);
|
||||
|
||||
|
|
@ -2148,9 +2148,8 @@ agx_init_screen_caps(struct pipe_screen *pscreen)
|
|||
|
||||
caps->max_viewports = AGX_MAX_VIEWPORTS;
|
||||
|
||||
uint64_t system_memory;
|
||||
caps->video_memory =
|
||||
os_get_total_physical_memory(&system_memory) ? (system_memory >> 20) : 0;
|
||||
os_get_gpu_heap_size(screen->heap_memory_percent, NULL) >> 20;
|
||||
|
||||
caps->device_reset_status_query = true;
|
||||
caps->robust_buffer_access_behavior = true;
|
||||
|
|
@ -2454,6 +2453,11 @@ agx_screen_create(int fd, struct renderonly *ro,
|
|||
|
||||
simple_mtx_init(&agx_screen->flush_seqid_lock, mtx_plain);
|
||||
|
||||
agx_screen->heap_memory_percent =
|
||||
driQueryOptionf(config->options, "heap_memory_percent");
|
||||
if (agx_screen->heap_memory_percent == OS_GPU_HEAP_SIZE_HEURISTIC)
|
||||
agx_screen->heap_memory_percent = 1.0f;
|
||||
|
||||
screen->destroy = agx_destroy_screen;
|
||||
screen->get_screen_fd = agx_screen_get_fd;
|
||||
screen->get_name = agx_get_name;
|
||||
|
|
|
|||
|
|
@ -877,6 +877,8 @@ struct agx_screen {
|
|||
|
||||
/* Lock to protect syncobj usage vs. destruction in context destroy */
|
||||
struct u_rwlock destroy_lock;
|
||||
|
||||
float heap_memory_percent;
|
||||
};
|
||||
|
||||
static inline struct agx_screen *
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@
|
|||
/* clang-format off */
|
||||
DRI_CONF_SECTION_MISCELLANEOUS
|
||||
DRI_CONF_NO_FP16(false)
|
||||
DRI_CONF_HEAP_MEMORY_PERCENT(1.0f)
|
||||
DRI_CONF_SECTION_END
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue