st/nine: Allow to override the vram size
This can be useful for debugging, or for some apps not supporting >= 4GB of vram. Signed-off-by: Axel Davy <davyaxel0@gmail.com> Acked-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>
This commit is contained in:
parent
26a42f1053
commit
c5f75bc200
|
@ -45,6 +45,7 @@ struct d3dadapter9_context
|
||||||
BOOL dynamic_texture_workaround;
|
BOOL dynamic_texture_workaround;
|
||||||
BOOL shader_inline_constants;
|
BOOL shader_inline_constants;
|
||||||
int memfd_virtualsizelimit;
|
int memfd_virtualsizelimit;
|
||||||
|
int override_vram_size;
|
||||||
|
|
||||||
void (*destroy)( struct d3dadapter9_context *ctx );
|
void (*destroy)( struct d3dadapter9_context *ctx );
|
||||||
};
|
};
|
||||||
|
|
|
@ -276,6 +276,8 @@ NineDevice9_ctor( struct NineDevice9 *This,
|
||||||
* instance. This is the Win 7 behavior.
|
* instance. This is the Win 7 behavior.
|
||||||
* Win XP shares this counter across multiple devices. */
|
* Win XP shares this counter across multiple devices. */
|
||||||
This->available_texture_mem = This->screen->get_param(This->screen, PIPE_CAP_VIDEO_MEMORY);
|
This->available_texture_mem = This->screen->get_param(This->screen, PIPE_CAP_VIDEO_MEMORY);
|
||||||
|
This->available_texture_mem = (pCTX->override_vram_size >= 0) ?
|
||||||
|
(long long)pCTX->override_vram_size : This->available_texture_mem;
|
||||||
This->available_texture_mem <<= 20;
|
This->available_texture_mem <<= 20;
|
||||||
|
|
||||||
/* We cap texture memory usage to 95% of what is reported free initially
|
/* We cap texture memory usage to 95% of what is reported free initially
|
||||||
|
|
|
@ -62,6 +62,9 @@ const driOptionDescription __driConfigOptionsNine[] = {
|
||||||
DRI_CONF_NINE_SHADERINLINECONSTANTS(false)
|
DRI_CONF_NINE_SHADERINLINECONSTANTS(false)
|
||||||
DRI_CONF_NINE_SHMEM_LIMIT()
|
DRI_CONF_NINE_SHMEM_LIMIT()
|
||||||
DRI_CONF_SECTION_END
|
DRI_CONF_SECTION_END
|
||||||
|
DRI_CONF_SECTION_DEBUG
|
||||||
|
DRI_CONF_OVERRIDE_VRAM_SIZE()
|
||||||
|
DRI_CONF_SECTION_END
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fallback_card_config {
|
struct fallback_card_config {
|
||||||
|
@ -279,6 +282,7 @@ drm_create_adapter( int fd,
|
||||||
ctx->base.dynamic_texture_workaround = driQueryOptionb(&userInitOptions, "dynamic_texture_workaround");
|
ctx->base.dynamic_texture_workaround = driQueryOptionb(&userInitOptions, "dynamic_texture_workaround");
|
||||||
ctx->base.shader_inline_constants = driQueryOptionb(&userInitOptions, "shader_inline_constants");
|
ctx->base.shader_inline_constants = driQueryOptionb(&userInitOptions, "shader_inline_constants");
|
||||||
ctx->base.memfd_virtualsizelimit = driQueryOptioni(&userInitOptions, "texture_memory_limit");
|
ctx->base.memfd_virtualsizelimit = driQueryOptioni(&userInitOptions, "texture_memory_limit");
|
||||||
|
ctx->base.override_vram_size = driQueryOptioni(&userInitOptions, "override_vram_size");
|
||||||
|
|
||||||
driDestroyOptionCache(&userInitOptions);
|
driDestroyOptionCache(&userInitOptions);
|
||||||
driDestroyOptionInfo(&defaultInitOptions);
|
driDestroyOptionInfo(&defaultInitOptions);
|
||||||
|
|
Loading…
Reference in New Issue