st/nine: Add driconf option to limit texture memory

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9377>
This commit is contained in:
Axel Davy 2021-02-06 23:30:56 +01:00 committed by Marge Bot
parent 24eb1f21d0
commit 0beb77751e
4 changed files with 8 additions and 1 deletions

View file

@ -44,6 +44,7 @@ struct d3dadapter9_context
int csmt_force;
BOOL dynamic_texture_workaround;
BOOL shader_inline_constants;
int memfd_virtualsizelimit;
void (*destroy)( struct d3dadapter9_context *ctx );
};

View file

@ -236,7 +236,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
/* Create first, it messes up our state. */
This->hud = hud_create(This->context.cso, NULL, NULL); /* NULL result is fine */
This->allocator = nine_allocator_create(This, 512);
This->allocator = nine_allocator_create(This, pCTX->memfd_virtualsizelimit);
/* Available memory counter. Updated only for allocations with this device
* instance. This is the Win 7 behavior.

View file

@ -60,6 +60,7 @@ const driOptionDescription __driConfigOptionsNine[] = {
DRI_CONF_NINE_CSMT(-1)
DRI_CONF_NINE_DYNAMICTEXTUREWORKAROUND(false)
DRI_CONF_NINE_SHADERINLINECONSTANTS(false)
DRI_CONF_NINE_SHMEM_LIMIT()
DRI_CONF_SECTION_END
};
@ -277,6 +278,7 @@ drm_create_adapter( int fd,
ctx->base.csmt_force = driQueryOptioni(&userInitOptions, "csmt_force");
ctx->base.dynamic_texture_workaround = driQueryOptionb(&userInitOptions, "dynamic_texture_workaround");
ctx->base.shader_inline_constants = driQueryOptionb(&userInitOptions, "shader_inline_constants");
ctx->base.memfd_virtualsizelimit = driQueryOptioni(&userInitOptions, "texture_memory_limit");
driDestroyOptionCache(&userInitOptions);
driDestroyOptionInfo(&defaultInitOptions);

View file

@ -402,6 +402,10 @@
DRI_CONF_OPT_B(shader_inline_constants, def, \
"If set to true, recompile shaders with integer or boolean constants when the values are known. Can cause stutter, but can increase slightly performance.")
#define DRI_CONF_NINE_SHMEM_LIMIT() \
DRI_CONF_OPT_I(texture_memory_limit, 512, 0, 0, \
"In MB the limit of virtual memory used for textures until shmem files are unmapped (default 512MB, 32bits only). If negative disables shmem. Set to a low amount to reduce virtual memory usage, but can inccur a small perf hit if too low.")
/**
* \brief radeonsi specific configuration options
*/