aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_context.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-08-31 20:58:10 -0400
committerMarek Olšák <[email protected]>2018-09-07 17:59:02 -0400
commit21ca322e637291b89a445159fc45b8dbf638e6c9 (patch)
treec0f2417651f7c6dba6c0ec9da1ee6755132e7181 /src/mesa/state_tracker/st_context.c
parent9ce2cef68f37a05cd2e4e4128395af38e7be963f (diff)
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.
Diffstat (limited to 'src/mesa/state_tracker/st_context.c')
-rw-r--r--src/mesa/state_tracker/st_context.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 146d9c629ab..354876746f4 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -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,