util: add dri config option to disable GL_MAP_UNSYNCHRONIZED_BIT

GL_MAP_UNSYNCHRONIZED_BIT depends on the app having its threading
handled correctly. This allows us to force disable the bit when
they get it wrong.

CC: 22.1 22.0 <mesa-stable>

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17199>
This commit is contained in:
Timothy Arceri
2022-06-23 11:27:32 +10:00
committed by Marge Bot
parent b74d3e71be
commit 5f686bfc85
7 changed files with 14 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_FORCE_COMPAT_PROFILE(false) DRI_CONF_FORCE_COMPAT_PROFILE(false)
DRI_CONF_FORCE_COMPAT_SHADERS(false) DRI_CONF_FORCE_COMPAT_SHADERS(false)
DRI_CONF_FORCE_GL_NAMES_REUSE(false) DRI_CONF_FORCE_GL_NAMES_REUSE(false)
DRI_CONF_FORCE_GL_MAP_BUFFER_SYNCHRONIZED(false)
DRI_CONF_TRANSCODE_ETC(false) DRI_CONF_TRANSCODE_ETC(false)
DRI_CONF_TRANSCODE_ASTC(false) DRI_CONF_TRANSCODE_ASTC(false)
DRI_CONF_FORCE_GL_VENDOR() DRI_CONF_FORCE_GL_VENDOR()

View File

@@ -64,6 +64,7 @@ u_driconf_fill_st_options(struct st_config_options *options,
query_bool_option(glthread_nop_check_framebuffer_status); query_bool_option(glthread_nop_check_framebuffer_status);
query_bool_option(ignore_map_unsynchronized); query_bool_option(ignore_map_unsynchronized);
query_bool_option(force_gl_names_reuse); query_bool_option(force_gl_names_reuse);
query_bool_option(force_gl_map_buffer_synchronized);
query_bool_option(transcode_etc); query_bool_option(transcode_etc);
query_bool_option(transcode_astc); query_bool_option(transcode_astc);
query_string_option(force_gl_vendor); query_string_option(force_gl_vendor);

View File

@@ -247,6 +247,7 @@ struct st_config_options
bool ignore_map_unsynchronized; bool ignore_map_unsynchronized;
bool force_integer_tex_nearest; bool force_integer_tex_nearest;
bool force_gl_names_reuse; bool force_gl_names_reuse;
bool force_gl_map_buffer_synchronized;
bool transcode_etc; bool transcode_etc;
bool transcode_astc; bool transcode_astc;
char *force_gl_vendor; char *force_gl_vendor;

View File

@@ -493,6 +493,9 @@ _mesa_bufferobj_map_range(struct gl_context *ctx,
transfer_flags &= ~PIPE_MAP_UNSYNCHRONIZED; transfer_flags &= ~PIPE_MAP_UNSYNCHRONIZED;
} }
if (ctx->Const.ForceMapBufferSynchronized)
transfer_flags &= ~PIPE_MAP_UNSYNCHRONIZED;
obj->Mappings[index].Pointer = pipe_buffer_map_range(pipe, obj->Mappings[index].Pointer = pipe_buffer_map_range(pipe,
obj->buffer, obj->buffer,
offset, length, offset, length,

View File

@@ -932,6 +932,9 @@ struct gl_constants
*/ */
bool BufferCreateMapUnsynchronizedThreadSafe; bool BufferCreateMapUnsynchronizedThreadSafe;
/** Override GL_MAP_UNSYNCHRONIZED_BIT */
bool ForceMapBufferSynchronized;
/** GL_ARB_get_program_binary */ /** GL_ARB_get_program_binary */
GLuint NumProgramBinaryFormats; GLuint NumProgramBinaryFormats;

View File

@@ -1156,6 +1156,8 @@ void st_init_extensions(struct pipe_screen *screen,
consts->GLSLIgnoreWriteToReadonlyVar = options->glsl_ignore_write_to_readonly_var; consts->GLSLIgnoreWriteToReadonlyVar = options->glsl_ignore_write_to_readonly_var;
consts->ForceMapBufferSynchronized = options->force_gl_map_buffer_synchronized;
consts->PrimitiveRestartFixedIndex = consts->PrimitiveRestartFixedIndex =
screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX); screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX);

View File

@@ -261,6 +261,9 @@
#define DRI_CONF_FORCE_GL_NAMES_REUSE(def) \ #define DRI_CONF_FORCE_GL_NAMES_REUSE(def) \
DRI_CONF_OPT_B(force_gl_names_reuse, def, "Force GL names reuse") DRI_CONF_OPT_B(force_gl_names_reuse, def, "Force GL names reuse")
#define DRI_CONF_FORCE_GL_MAP_BUFFER_SYNCHRONIZED(def) \
DRI_CONF_OPT_B(force_gl_map_buffer_synchronized, def, "Override GL_MAP_UNSYNCHRONIZED_BIT.")
#define DRI_CONF_TRANSCODE_ETC(def) \ #define DRI_CONF_TRANSCODE_ETC(def) \
DRI_CONF_OPT_B(transcode_etc, def, "Transcode ETC formats to DXTC if unsupported") DRI_CONF_OPT_B(transcode_etc, def, "Transcode ETC formats to DXTC if unsupported")