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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5015>
This commit is contained in:
Axel Davy
2020-05-08 22:26:07 +02:00
committed by Marge Bot
parent 4cf13691be
commit d771e0cc60
+7 -6
View File
@@ -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);