From 565980f3c0f360eb946fe9fa75b507290b2bd7d0 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Wed, 16 Apr 2025 12:11:45 -0700 Subject: [PATCH] d3d12: Add tc memory throttles Part-of: --- src/gallium/drivers/d3d12/d3d12_context_common.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/d3d12/d3d12_context_common.cpp b/src/gallium/drivers/d3d12/d3d12_context_common.cpp index a4a5523c603..d741a0a7fa3 100644 --- a/src/gallium/drivers/d3d12/d3d12_context_common.cpp +++ b/src/gallium/drivers/d3d12/d3d12_context_common.cpp @@ -494,12 +494,16 @@ d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) ctx->batches[i].ctx_index = i; } - if (flags & PIPE_CONTEXT_PREFER_THREADED) - return threaded_context_create(&ctx->base, + if (flags & PIPE_CONTEXT_PREFER_THREADED) { + struct pipe_context *ret = threaded_context_create(&ctx->base, &screen->transfer_pool, d3d12_replace_buffer_storage, NULL, &ctx->threaded_context); + ctx->threaded_context->bytes_replaced_limit = 1024 * 1024 * 1024; /* 1GiB */ + threaded_context_init_bytes_mapped_limit(ctx->threaded_context, 4); + return ret; + } return &ctx->base; }