From d771e0cc60a0aa853c5e1e0df304f970a47ab774 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Fri, 8 May 2020 22:26:07 +0200 Subject: [PATCH] st/nine: Increase available GPU memory This patch caps to 4GB the limit of GPU memory accessible only for 32bits build. This would deserve some tests on windows, so we might change that behaviour in the future. For example, it's possible that GetAvailableTextureMem is capped to 4GB on 64bits build. We cap to a bit less than 4GB, which might help https://github.com/iXit/Mesa-3D/issues/323 In addition, increase from 80% to 95% the allocation limit above which we fail allocating. Part-of: --- src/gallium/frontends/nine/device9.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/frontends/nine/device9.c b/src/gallium/frontends/nine/device9.c index 97223cd8fa5..2634b88a614 100644 --- a/src/gallium/frontends/nine/device9.c +++ b/src/gallium/frontends/nine/device9.c @@ -217,14 +217,15 @@ NineDevice9_ctor( struct NineDevice9 *This, * instance. This is the Win 7 behavior. * Win XP shares this counter across multiple devices. */ This->available_texture_mem = This->screen->get_param(This->screen, PIPE_CAP_VIDEO_MEMORY); - if (This->available_texture_mem < 4096) - This->available_texture_mem <<= 20; - else - This->available_texture_mem = UINT_MAX; - /* We cap texture memory usage to 80% of what is reported free initially + This->available_texture_mem <<= 20; +#ifdef PIPE_ARCH_X86 + /* To prevent overflows for 32bits apps - Not sure about this one */ + This->available_texture_limit = MAX2(This->available_texture_limit, UINT_MAX - (64 << 20)); +#endif + /* We cap texture memory usage to 95% of what is reported free initially * This helps get closer Win behaviour. For example VertexBuffer allocation * still succeeds when texture allocation fails. */ - This->available_texture_limit = This->available_texture_mem * 20LL / 100LL; + This->available_texture_limit = This->available_texture_mem * 5LL / 100LL; /* create implicit swapchains */ This->nswapchains = ID3DPresentGroup_GetMultiheadCount(This->present); -- 2.30.2