st/mesa: throttle texture uploads if their memory usage goes beyond a limit

This prevents radeonsi from running out of memory. It also increases
texture upload performance by being nice to the kernel memory manager.
This commit is contained in:
Marek Olšák
2018-08-31 20:58:10 -04:00
parent 9ce2cef68f
commit 21ca322e63
5 changed files with 165 additions and 0 deletions

View File

@@ -275,6 +275,7 @@ st_destroy_context_priv(struct st_context *st, bool destroy_pipe)
/* free glReadPixels cache data */
st_invalidate_readpix_cache(st);
util_throttle_deinit(st->pipe->screen, &st->throttle);
cso_destroy_context(st->cso_context);
@@ -467,6 +468,10 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS)
? true : false;
util_throttle_init(&st->throttle,
screen->get_param(screen,
PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET));
/* GL limits and extensions */
st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions, ctx->API);
st_init_extensions(pipe->screen, &ctx->Const,