From 5e7f0ebe29df58c873b2c66674d8cbf0b1046a4d Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Thu, 6 Oct 2016 19:42:21 +0200 Subject: [PATCH] softpipe: Cap to 2 GB on 32 bits On 32 bits system, application memory is quite limited. softpipe uses application memory. To help prevent memory exhaustion, limit reported memory availability to 2GB. Some gallium nine apps do check reported memory by allocating resources until memory is full. Gallium nine refuses allocations when 80% of the reported memory limit is used. This change helps some apps to start. Signed-off-by: Axel Davy Reviewed-by: Roland Scheidegger --- src/gallium/drivers/softpipe/sp_screen.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 6ffc7771c83..880480b581a 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -230,6 +230,12 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) if (!os_get_total_physical_memory(&system_memory)) return 0; + if (sizeof(void *) == 4) + /* Cap to 2 GB on 32 bits system. We do this because softpipe does + * eat application memory, which is quite limited on 32 bits. App + * shouldn't expect too much available memory. */ + system_memory = MIN2(system_memory, 2048 << 20); + return (int)(system_memory >> 20); } case PIPE_CAP_UMA: -- 2.30.2