summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-09-05 23:10:57 -0400
committerMarek Olšák <[email protected]>2018-09-07 16:03:30 -0400
commit8d473f555a0c3c94cffd18e68a13274488dcfb17 (patch)
treea0ca440547d0c224de102b074ad1b84494a18568 /src/mesa/state_tracker
parente5e3b5cdcc38ce1111b134e6fe5bc4d00c8c715f (diff)
st/mesa: pin driver threads to a specific L3 cache on AMD Zen (v2)
v2: use set_context_param Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_context.c3
-rw-r--r--src/mesa/state_tracker/st_manager.c10
2 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 34bfb845bb0..146d9c629ab 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -79,6 +79,7 @@
#include "st_vdpau.h"
#include "st_texture.h"
#include "pipe/p_context.h"
+#include "util/u_cpu_detect.h"
#include "util/u_inlines.h"
#include "util/u_upload_mgr.h"
#include "util/u_vbuf.h"
@@ -563,6 +564,8 @@ st_create_context(gl_api api, struct pipe_context *pipe,
struct dd_function_table funcs;
struct st_context *st;
+ util_cpu_detect();
+
memset(&funcs, 0, sizeof(funcs));
st_init_driver_functions(pipe->screen, &funcs);
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 69286b57916..a3f00228942 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -56,6 +56,7 @@
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "util/u_format.h"
+#include "util/u_helpers.h"
#include "util/u_pointer.h"
#include "util/u_inlines.h"
#include "util/u_atomic.h"
@@ -1063,6 +1064,15 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
* of the referenced drawables no longer exist.
*/
st_framebuffers_purge(st);
+
+ /* Notify the driver that the context thread may have been changed.
+ * This should pin all driver threads to a specific L3 cache for optimal
+ * performance on AMD Zen CPUs.
+ */
+ struct glthread_state *glthread = st->ctx->GLThread;
+ thrd_t *upper_thread = glthread ? &glthread->queue.threads[0] : NULL;
+
+ util_context_thread_changed(st->pipe, upper_thread);
}
else {
ret = _mesa_make_current(NULL, NULL, NULL);