Mesa (master): zink: add set_context_param hook

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 1 13:16:30 UTC 2021


Module: Mesa
Branch: master
Commit: 1fdd906b21eb8be1bec24a4f6ea1a03c006ea3e0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1fdd906b21eb8be1bec24a4f6ea1a03c006ea3e0

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Jan 28 10:15:45 2021 -0500

zink: add set_context_param hook

for handling PIPE_CONTEXT_PARAM_PIN_THREADS_TO_L3_CACHE

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9970>

---

 src/gallium/drivers/zink/zink_context.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index cb784bbfa40..4d40a05cf1e 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -45,7 +45,8 @@
 #include "util/u_framebuffer.h"
 #include "util/u_helpers.h"
 #include "util/u_inlines.h"
-
+#include "util/u_thread.h"
+#include "util/u_cpu_detect.h"
 #include "nir.h"
 
 #include "util/u_memory.h"
@@ -377,6 +378,23 @@ zink_set_device_reset_callback(struct pipe_context *pctx,
       memset(&ctx->reset, 0, sizeof(ctx->reset));
 }
 
+static void
+zink_set_context_param(struct pipe_context *pctx, enum pipe_context_param param,
+                       unsigned value)
+{
+   struct zink_context *ctx = zink_context(pctx);
+
+   switch (param) {
+   case PIPE_CONTEXT_PARAM_PIN_THREADS_TO_L3_CACHE:
+      util_set_thread_affinity(ctx->batch.flush_queue.threads[0],
+                               util_get_cpu_caps()->L3_affinity_mask[value],
+                               NULL, util_get_cpu_caps()->num_cpu_mask_bits);
+      break;
+   default:
+      break;
+   }
+}
+
 static VkSamplerMipmapMode
 sampler_mipmap_mode(enum pipe_tex_mipfilter filter)
 {
@@ -2713,6 +2731,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
 
    if (tc && (struct zink_context*)tc != ctx) {
       tc->bytes_mapped_limit = screen->total_mem / 4;
+      ctx->base.set_context_param = zink_set_context_param;
    }
 
    return (struct pipe_context*)tc;



More information about the mesa-commit mailing list