summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
authorAxel Davy <axel.davy@ens.fr>2016-03-28 22:34:35 +0200
committerAxel Davy <axel.davy@ens.fr>2016-10-10 23:43:48 +0200
commit814ca96d0d8692c5260f595be53c4b9aed0989fa (patch)
treeb1c5df9817861bf4d004c85a38b422055a51077e /src/gallium/drivers/llvmpipe
parent218459771a1801d7ad20dd340ac35a50f2b5b81a (diff)
downloadexternal_mesa3d-814ca96d0d8692c5260f595be53c4b9aed0989fa.zip
external_mesa3d-814ca96d0d8692c5260f595be53c4b9aed0989fa.tar.gz
external_mesa3d-814ca96d0d8692c5260f595be53c4b9aed0989fa.tar.bz2
llvmpipe: Cap to 2 GB on 32 bits
On 32 bits system, application memory is quite limited. llvmpipe 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 <axel.davy@ens.fr> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 18837a2..9a0a1a2 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -280,6 +280,12 @@ llvmpipe_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 llvmpipe 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: