From: Marek Olšák <marek.ol...@amd.com> --- .../auxiliary/util/u_threaded_context.c | 23 +++++++++++++++++++ .../auxiliary/util/u_threaded_context.h | 1 + .../auxiliary/util/u_threaded_context_calls.h | 1 + 3 files changed, 25 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index fc7eb138835..95b98514a12 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -1892,20 +1892,42 @@ tc_create_video_codec(UNUSED struct pipe_context *_pipe, } static struct pipe_video_buffer * tc_create_video_buffer(UNUSED struct pipe_context *_pipe, UNUSED const struct pipe_video_buffer *templ) { unreachable("Threaded context should not be enabled for video APIs"); return NULL; } +static void +tc_call_pin_threads_to_L3_cache(struct pipe_context *pipe, + union tc_payload *payload) +{ + pipe->pin_threads_to_L3_cache(pipe, payload->uint); +} + +static void +tc_pin_threads_to_L3_cache(struct pipe_context *_pipe, + unsigned cache) +{ + struct threaded_context *tc = threaded_context(_pipe); + union tc_payload *payload = + tc_add_small_call(tc, TC_CALL_pin_threads_to_L3_cache); + + payload->uint = cache; + + /* Pin the gallium thread as requested. */ + util_pin_thread_to_L3(tc->queue.threads[0], cache, + util_cpu_caps.cores_per_L3); +} + /******************************************************************** * draw, launch, clear, blit, copy, flush */ struct tc_flush_payload { struct threaded_context *tc; struct pipe_fence_handle *fence; unsigned flags; }; @@ -2683,20 +2705,21 @@ threaded_context_create(struct pipe_context *pipe, CTX_INIT(create_fence_fd); CTX_INIT(fence_server_sync); CTX_INIT(fence_server_signal); CTX_INIT(get_timestamp); CTX_INIT(create_texture_handle); CTX_INIT(delete_texture_handle); CTX_INIT(make_texture_handle_resident); CTX_INIT(create_image_handle); CTX_INIT(delete_image_handle); CTX_INIT(make_image_handle_resident); + CTX_INIT(pin_threads_to_L3_cache); #undef CTX_INIT if (out) *out = tc; return &tc->base; fail: tc_destroy(&tc->base); return NULL; diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h index be6933d05a4..e3cb05318b2 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.h +++ b/src/gallium/auxiliary/util/u_threaded_context.h @@ -304,20 +304,21 @@ struct threaded_query { /* This is the second half of tc_call containing call data. * Most calls will typecast this to the type they need, typically larger * than 8 bytes. */ union tc_payload { struct pipe_query *query; struct pipe_resource *resource; struct pipe_transfer *transfer; struct pipe_fence_handle *fence; uint64_t handle; + unsigned uint; }; #ifdef _MSC_VER #define ALIGN16 __declspec(align(16)) #else #define ALIGN16 __attribute__((aligned(16))) #endif /* Each call slot should be aligned to its own size for optimal cache usage. */ struct ALIGN16 tc_call { diff --git a/src/gallium/auxiliary/util/u_threaded_context_calls.h b/src/gallium/auxiliary/util/u_threaded_context_calls.h index 921b86a67f0..42f244f1c67 100644 --- a/src/gallium/auxiliary/util/u_threaded_context_calls.h +++ b/src/gallium/auxiliary/util/u_threaded_context_calls.h @@ -42,20 +42,21 @@ CALL(set_stencil_ref) CALL(set_clip_state) CALL(set_sample_mask) CALL(set_min_samples) CALL(set_polygon_stipple) CALL(texture_barrier) CALL(memory_barrier) CALL(delete_texture_handle) CALL(make_texture_handle_resident) CALL(delete_image_handle) CALL(make_image_handle_resident) +CALL(pin_threads_to_L3_cache) CALL(bind_blend_state) CALL(bind_rasterizer_state) CALL(bind_depth_stencil_alpha_state) CALL(bind_compute_state) CALL(bind_fs_state) CALL(bind_vs_state) CALL(bind_gs_state) CALL(bind_tcs_state) CALL(bind_tes_state) -- 2.17.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev