diff --git a/src/gallium/drivers/crocus/crocus_screen.c b/src/gallium/drivers/crocus/crocus_screen.c index 882fc969c8a..71131141ccd 100644 --- a/src/gallium/drivers/crocus/crocus_screen.c +++ b/src/gallium/drivers/crocus/crocus_screen.c @@ -37,6 +37,7 @@ #include "pipe/p_state.h" #include "pipe/p_context.h" #include "pipe/p_screen.h" +#include "util/os_misc.h" #include "util/u_debug.h" #include "util/u_inlines.h" #include "util/format/u_format.h" @@ -383,8 +384,9 @@ crocus_init_screen_caps(struct crocus_screen *screen) const unsigned gpu_mappable_megabytes = (screen->aperture_threshold) / (1024 * 1024); - uint64_t system_memory_bytes; - if (!os_get_total_physical_memory(&system_memory_bytes)) { + uint64_t system_memory_bytes = + os_get_gpu_heap_size(screen->driconf.heap_memory_percent, NULL); + if (!system_memory_bytes) { caps->video_memory = -1; } else { const unsigned system_memory_megabytes = @@ -604,6 +606,11 @@ crocus_screen_create(int fd, const struct pipe_screen_config *config) screen->driconf.lower_depth_range_rate = driQueryOptionf(config->options, "lower_depth_range_rate"); + screen->driconf.heap_memory_percent = + driQueryOptionf(config->options, "heap_memory_percent"); + if (screen->driconf.heap_memory_percent == OS_GPU_HEAP_SIZE_HEURISTIC) + screen->driconf.heap_memory_percent = 1.0f; + screen->precompile = debug_get_bool_option("shader_precompile", true); isl_device_init(&screen->isl_dev, &screen->devinfo); diff --git a/src/gallium/drivers/crocus/crocus_screen.h b/src/gallium/drivers/crocus/crocus_screen.h index 3a367ddedee..8a58bbd1583 100644 --- a/src/gallium/drivers/crocus/crocus_screen.h +++ b/src/gallium/drivers/crocus/crocus_screen.h @@ -201,6 +201,7 @@ struct crocus_screen { bool always_flush_cache; bool limit_trig_input_range; float lower_depth_range_rate; + float heap_memory_percent; } driconf; uint64_t aperture_bytes; diff --git a/src/gallium/drivers/crocus/driinfo_crocus.h b/src/gallium/drivers/crocus/driinfo_crocus.h index c81b9a45182..e325353316c 100644 --- a/src/gallium/drivers/crocus/driinfo_crocus.h +++ b/src/gallium/drivers/crocus/driinfo_crocus.h @@ -14,3 +14,7 @@ DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY DRI_CONF_PP_LOWER_DEPTH_RANGE_RATE() DRI_CONF_SECTION_END + +DRI_CONF_SECTION_MISCELLANEOUS + DRI_CONF_HEAP_MEMORY_PERCENT(1.0f) +DRI_CONF_SECTION_END