diff options
author | Christian Gmeiner <[email protected]> | 2020-02-07 11:24:55 +0100 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-07 18:21:54 +0000 |
commit | 0c36b1c0dbf2dcb8ded2509bc547a026b9624cc0 (patch) | |
tree | 2bf2604e044984daea04e0f00f3573bca804296e | |
parent | 7bddaa61362924ec9dc360a2846cbdc8c647d834 (diff) |
etnaviv: enable texture upload memory throttling
Fixes oom-killer during piglit's streaming-texture-upload on a
SolidRun CuBox-i with 2GB of RAM.
Signed-off-by: Christian Gmeiner <[email protected]>
Reviewed-by: Lucas Stach <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3745>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3745>
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_screen.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index dcceddc4729..51154a3df11 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -229,6 +229,22 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) /* Preferences */ case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER: return 0; + case PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET: { + /* etnaviv is being run on systems as small as 256MB total RAM so + * we need to provide a sane value for such a device. Limit the + * memory budget to min(~3% of pyhiscal memory, 64MB). + * + * a simple divison by 32 provides the numbers we want. + * 256MB / 32 = 8MB + * 2048MB / 32 = 64MB + */ + uint64_t system_memory; + + if (!os_get_total_physical_memory(&system_memory)) + system_memory = 4096 << 20; + + return MIN2(system_memory / 32, 64 * 1024 * 1024); + } case PIPE_CAP_MAX_VARYINGS: return screen->specs.max_varyings; |