From: Marek Olšák <marek.ol...@amd.com> so that all Blender threads are not forced to be on 1 CCX.
Fixes: 8d473f555a0 --- src/gallium/auxiliary/pipe-loader/driinfo_gallium.h | 1 + src/gallium/include/state_tracker/st_api.h | 1 + src/gallium/state_trackers/dri/dri_screen.c | 2 ++ src/mesa/state_tracker/st_context.c | 1 + src/mesa/state_tracker/st_context.h | 1 + src/mesa/state_tracker/st_manager.c | 8 +++++--- src/util/00-mesa-defaults.conf | 4 ++++ src/util/xmlpool/t_options.h | 5 +++++ 8 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h index 9db0dc01117..daa7ce7f6cc 100644 --- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h +++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h @@ -24,17 +24,18 @@ DRI_CONF_SECTION_DEBUG DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false") DRI_CONF_ALLOW_GLSL_BUILTIN_CONST_EXPRESSION("false") DRI_CONF_ALLOW_GLSL_RELAXED_ES("false") DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION("false") DRI_CONF_ALLOW_GLSL_CROSS_STAGE_INTERPOLATION_MISMATCH("false") DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false") DRI_CONF_FORCE_GLSL_ABS_SQRT("false") DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD("false") DRI_CONF_ALLOW_GLSL_LAYOUT_QUALIFIER_ON_FUNCTION_PARAMETERS("false") DRI_CONF_FORCE_COMPAT_PROFILE("false") + DRI_CONF_DISABLE_L3_THREAD_PINNING("false") DRI_CONF_SECTION_END DRI_CONF_SECTION_MISCELLANEOUS DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER("false") DRI_CONF_GLSL_ZERO_INIT("false") DRI_CONF_ALLOW_RGB10_CONFIGS("true") DRI_CONF_SECTION_END diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 2b63b8a3d2a..26b52f8dc51 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -224,20 +224,21 @@ struct st_config_options unsigned force_glsl_version; boolean allow_glsl_extension_directive_midshader; boolean allow_glsl_builtin_const_expression; boolean allow_glsl_relaxed_es; boolean allow_glsl_builtin_variable_redeclaration; boolean allow_higher_compat_version; boolean glsl_zero_init; boolean force_glsl_abs_sqrt; boolean allow_glsl_cross_stage_interpolation_mismatch; boolean allow_glsl_layout_qualifier_on_function_parameters; + boolean disable_L3_thread_pinning; unsigned char config_options_sha1[20]; }; /** * Represent the attributes of a context. */ struct st_context_attribs { /** * The profile and minimal version to support. diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 82a0988a634..b8bd92475cb 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -80,20 +80,22 @@ dri_fill_st_options(struct dri_screen *screen) driQueryOptionb(optionCache, "allow_glsl_builtin_variable_redeclaration"); options->allow_higher_compat_version = driQueryOptionb(optionCache, "allow_higher_compat_version"); options->glsl_zero_init = driQueryOptionb(optionCache, "glsl_zero_init"); options->force_glsl_abs_sqrt = driQueryOptionb(optionCache, "force_glsl_abs_sqrt"); options->allow_glsl_cross_stage_interpolation_mismatch = driQueryOptionb(optionCache, "allow_glsl_cross_stage_interpolation_mismatch"); options->allow_glsl_layout_qualifier_on_function_parameters = driQueryOptionb(optionCache, "allow_glsl_layout_qualifier_on_function_parameters"); + options->disable_L3_thread_pinning = + driQueryOptionb(optionCache, "disable_L3_thread_pinning"); driComputeOptionsSha1(optionCache, options->config_options_sha1); } static unsigned dri_loader_get_cap(struct dri_screen *screen, enum dri_loader_cap cap) { const __DRIdri2LoaderExtension *dri2_loader = screen->sPriv->dri2.loader; const __DRIimageLoaderExtension *image_loader = screen->sPriv->image.loader; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 354876746f4..4b19b140bcd 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -460,20 +460,21 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, screen->get_param(screen, PIPE_CAP_QUERY_TIME_ELAPSED); st->has_half_float_packing = screen->get_param(screen, PIPE_CAP_TGSI_PACK_HALF_FLOAT); st->has_multi_draw_indirect = screen->get_param(screen, PIPE_CAP_MULTI_DRAW_INDIRECT); st->has_hw_atomics = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS) ? true : false; + st->disable_L3_thread_pinning = options->disable_L3_thread_pinning; 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, &ctx->Extensions, &st->options, ctx->API); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 14b9b018809..e57873dafe8 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -121,20 +121,21 @@ struct st_context boolean has_shader_model3; boolean has_etc1; boolean has_etc2; boolean has_astc_2d_ldr; boolean prefer_blit_based_texture_transfer; boolean force_persample_in_shader; boolean has_shareable_shaders; boolean has_half_float_packing; boolean has_multi_draw_indirect; boolean can_bind_const_buffer_as_vertex; + boolean disable_L3_thread_pinning; /** * If a shader can be created when we get its source. * This means it has only 1 variant, not counting glBitmap and * glDrawPixels. */ boolean shader_has_one_variant[MESA_SHADER_STAGES]; boolean needs_texcoord_semantic; boolean apply_texture_swizzle_to_border_color; diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index ceb48dd4903..eb0b88ef473 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -1067,24 +1067,26 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi, /* Purge the context's winsys_buffers list in case any * 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; + if (!st->disable_L3_thread_pinning) { + 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); + util_context_thread_changed(st->pipe, upper_thread); + } } else { ret = _mesa_make_current(NULL, NULL, NULL); } return ret; } static void diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf index a937c46d052..e9a6b817d9a 100644 --- a/src/util/00-mesa-defaults.conf +++ b/src/util/00-mesa-defaults.conf @@ -199,20 +199,24 @@ TODO: document the other workarounds. </application> <application name="Wolfenstein The Old Blood" executable="WolfOldBlood_x64.exe"> <option name="force_compat_profile" value="true" /> </application> <application name="ARMA 3" executable="arma3.x86_64"> <option name="glsl_correct_derivatives_after_discard" value="true"/> </application> + <application name="Blender" executable="blender"> + <option name="disable_L3_thread_pinning" value="true"/> + </application> + <!-- The GL thread whitelist is below, workarounds are above. Keep it that way. --> <application name="Alien Isolation" executable="AlienIsolation"> <option name="mesa_glthread" value="true"/> </application> <application name="BioShock Infinite" executable="bioshock.i386"> <option name="mesa_glthread" value="true"/> </application> diff --git a/src/util/xmlpool/t_options.h b/src/util/xmlpool/t_options.h index e0a30f5fd1d..5d916519794 100644 --- a/src/util/xmlpool/t_options.h +++ b/src/util/xmlpool/t_options.h @@ -138,20 +138,25 @@ DRI_CONF_OPT_END #define DRI_CONF_ALLOW_GLSL_LAYOUT_QUALIFIER_ON_FUNCTION_PARAMETERS(def) \ DRI_CONF_OPT_BEGIN_B(allow_glsl_layout_qualifier_on_function_parameters, def) \ DRI_CONF_DESC(en,gettext("Allow layout qualifiers on function parameters.")) \ DRI_CONF_OPT_END #define DRI_CONF_FORCE_COMPAT_PROFILE(def) \ DRI_CONF_OPT_BEGIN_B(force_compat_profile, def) \ DRI_CONF_DESC(en,gettext("Force an OpenGL compatibility context")) \ DRI_CONF_OPT_END +#define DRI_CONF_DISABLE_L3_THREAD_PINNING(def) \ +DRI_CONF_OPT_BEGIN_B(disable_L3_thread_pinning, def) \ + DRI_CONF_DESC(en,gettext("Disable L3 thread pinning.")) \ +DRI_CONF_OPT_END + /** * \brief Image quality-related options */ #define DRI_CONF_SECTION_QUALITY \ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(en,gettext("Image Quality")) #define DRI_CONF_PRECISE_TRIG(def) \ DRI_CONF_OPT_BEGIN_B(precise_trig, def) \ DRI_CONF_DESC(en,gettext("Prefer accuracy over performance in trig functions")) \ -- 2.17.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev