Mesa (staging/22.1): util: add dri config option to disable GL_MAP_UNSYNCHRONIZED_BIT
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 27 16:23:26 UTC 2022
Module: Mesa
Branch: staging/22.1
Commit: d36439c235e278ec7b6778e857ba4d16c6b60660
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d36439c235e278ec7b6778e857ba4d16c6b60660
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>
(cherry picked from commit 5f686bfc852e56ed7f688a8c3653ca68de04994b)
---
.pick_status.json | 2 +-
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 +++
8 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/.pick_status.json b/.pick_status.json
index 44d932ed547..043c4dd0297 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -265,7 +265,7 @@
"description": "util: add dri config option to disable GL_MAP_UNSYNCHRONIZED_BIT",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
index 067348a3733..aacf408e608 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 c7aab405159..36053d14bfb 100644
--- a/src/gallium/include/frontend/api.h
+++ b/src/gallium/include/frontend/api.h
@@ -241,6 +241,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 b3b2dc6c77b..55a3f2990df 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -485,6 +485,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 3143ec75c51..0a66ebfe193 100644
--- a/src/mesa/main/consts_exts.h
+++ b/src/mesa/main/consts_exts.h
@@ -943,6 +943,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 04d484e1b55..11358f7d68d 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -1168,6 +1168,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 8bfabce676a..7ca309f1ab3 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