Mesa (main): util: add dri config option to disable GL_MAP_UNSYNCHRONIZED_BIT
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 24 01:08:21 UTC 2022
Module: Mesa
Branch: main
Commit: 5f686bfc852e56ed7f688a8c3653ca68de04994b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f686bfc852e56ed7f688a8c3653ca68de04994b
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Thu Jun 23 11:27:32 2022 +1000
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 at amd.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17199>
---
src/gallium/auxiliary/pipe-loader/driinfo_gallium.h | 1 +
src/gallium/auxiliary/util/u_driconf.c | 1 +
src/gallium/include/frontend/api.h | 1 +
src/mesa/main/bufferobj.c | 3 +++
src/mesa/main/consts_exts.h | 3 +++
src/mesa/state_tracker/st_extensions.c | 2 ++
src/util/driconf.h | 3 +++
7 files changed, 14 insertions(+)
diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
index b5e4c1a6c03..a99b9dafbc9 100644
--- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -37,6 +37,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_FORCE_COMPAT_PROFILE(false)
DRI_CONF_FORCE_COMPAT_SHADERS(false)
DRI_CONF_FORCE_GL_NAMES_REUSE(false)
+ DRI_CONF_FORCE_GL_MAP_BUFFER_SYNCHRONIZED(false)
DRI_CONF_TRANSCODE_ETC(false)
DRI_CONF_TRANSCODE_ASTC(false)
DRI_CONF_FORCE_GL_VENDOR()
diff --git a/src/gallium/auxiliary/util/u_driconf.c b/src/gallium/auxiliary/util/u_driconf.c
index 893c3b69aaf..8b9d8a72987 100644
--- a/src/gallium/auxiliary/util/u_driconf.c
+++ b/src/gallium/auxiliary/util/u_driconf.c
@@ -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(ignore_map_unsynchronized);
query_bool_option(force_gl_names_reuse);
+ query_bool_option(force_gl_map_buffer_synchronized);
query_bool_option(transcode_etc);
query_bool_option(transcode_astc);
query_string_option(force_gl_vendor);
diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h
index 57a6a453e1f..8fc425b351b 100644
--- a/src/gallium/include/frontend/api.h
+++ b/src/gallium/include/frontend/api.h
@@ -247,6 +247,7 @@ struct st_config_options
bool ignore_map_unsynchronized;
bool force_integer_tex_nearest;
bool force_gl_names_reuse;
+ bool force_gl_map_buffer_synchronized;
bool transcode_etc;
bool transcode_astc;
char *force_gl_vendor;
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 67079f4fd86..4f528cef5ca 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -493,6 +493,9 @@ _mesa_bufferobj_map_range(struct gl_context *ctx,
transfer_flags &= ~PIPE_MAP_UNSYNCHRONIZED;
}
+ if (ctx->Const.ForceMapBufferSynchronized)
+ transfer_flags &= ~PIPE_MAP_UNSYNCHRONIZED;
+
obj->Mappings[index].Pointer = pipe_buffer_map_range(pipe,
obj->buffer,
offset, length,
diff --git a/src/mesa/main/consts_exts.h b/src/mesa/main/consts_exts.h
index c33242862a8..f8572683eb4 100644
--- a/src/mesa/main/consts_exts.h
+++ b/src/mesa/main/consts_exts.h
@@ -932,6 +932,9 @@ struct gl_constants
*/
bool BufferCreateMapUnsynchronizedThreadSafe;
+ /** Override GL_MAP_UNSYNCHRONIZED_BIT */
+ bool ForceMapBufferSynchronized;
+
/** GL_ARB_get_program_binary */
GLuint NumProgramBinaryFormats;
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 8eaed354bb2..4280866d762 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -1156,6 +1156,8 @@ void st_init_extensions(struct pipe_screen *screen,
consts->GLSLIgnoreWriteToReadonlyVar = options->glsl_ignore_write_to_readonly_var;
+ consts->ForceMapBufferSynchronized = options->force_gl_map_buffer_synchronized;
+
consts->PrimitiveRestartFixedIndex =
screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX);
diff --git a/src/util/driconf.h b/src/util/driconf.h
index 1bc31edd413..a80ad910a5f 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -261,6 +261,9 @@
#define DRI_CONF_FORCE_GL_NAMES_REUSE(def) \
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) \
DRI_CONF_OPT_B(transcode_etc, def, "Transcode ETC formats to DXTC if unsupported")
More information about the mesa-commit
mailing list