driconf: Add ignore_map_unsynchronized option

Add an option to workaround incorrect unsynchronized VBO updates in
Dead-Cells.

See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4337
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9316>
This commit is contained in:
Rob Clark
2021-02-21 10:36:50 -08:00
committed by Marge Bot
parent 3c20b698e2
commit e6f2e8b3fc
6 changed files with 27 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_GLX_EXTENSION_OVERRIDE()
DRI_CONF_INDIRECT_GL_EXTENSION_OVERRIDE()
DRI_CONF_DISABLE_PROTECTED_CONTENT_CHECK(false)
DRI_CONF_IGNORE_MAP_UNSYNCHRONIZED(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_MISCELLANEOUS

View File

@@ -99,6 +99,8 @@ dri_fill_st_options(struct dri_screen *screen)
driQueryOptionb(optionCache, "allow_draw_out_of_order");
options->allow_incorrect_primitive_id =
driQueryOptionb(optionCache, "allow_incorrect_primitive_id");
options->ignore_map_unsynchronized =
driQueryOptionb(optionCache, "ignore_map_unsynchronized");
options->force_gl_names_reuse =
driQueryOptionb(optionCache, "force_gl_names_reuse");

View File

@@ -242,6 +242,7 @@ struct st_config_options
bool allow_glsl_cross_stage_interpolation_mismatch;
bool allow_draw_out_of_order;
bool allow_incorrect_primitive_id;
bool ignore_map_unsynchronized;
bool force_integer_tex_nearest;
bool force_gl_names_reuse;
char *force_gl_vendor;

View File

@@ -539,10 +539,20 @@ st_bufferobj_map_range(struct gl_context *ctx,
assert(offset < obj->Size);
assert(offset + length <= obj->Size);
const enum pipe_map_flags transfer_flags =
enum pipe_map_flags transfer_flags =
st_access_flags_to_transfer_flags(access,
offset == 0 && length == obj->Size);
/* Sometimes games do silly things like MapBufferRange(UNSYNC|DISCARD_RANGE)
* In this case, the the UNSYNC is a bit redundant, but the games rely
* on the driver rebinding/replacing the backing storage rather than
* going down the UNSYNC path (ie. honoring DISCARD_x first before UNSYNC).
*/
if (unlikely(st_context(ctx)->options.ignore_map_unsynchronized)) {
if (transfer_flags & (PIPE_MAP_DISCARD_RANGE | PIPE_MAP_DISCARD_WHOLE_RESOURCE))
transfer_flags &= ~PIPE_MAP_UNSYNCHRONIZED;
}
obj->Mappings[index].Pointer = pipe_buffer_map_range(pipe,
st_obj->buffer,
offset, length,

View File

@@ -22,7 +22,7 @@ Application bugs worked around in this file:
built-ins (specifically gl_VertexID), which causes the vertex shaders to fail
to compile.
* Applications that are not suitable for adapative sync are blacklisted here.
* Applications that are not suitable for adapative sync are denylisted here.
TODO: document the other workarounds.
@@ -296,6 +296,13 @@ TODO: document the other workarounds.
<option name="allow_incorrect_primitive_id" value="true" />
</application>
<!-- Workaround for unsynchronized VBO updates on Dead Cells android
game. (Possibly also needed for desktop version?)
-->
<application name="Dead-Cells" executable="com.playdigious.deadcells.mobile">
<option name="ignore_map_unsynchronized" value="true" />
</application>
<!-- The GL thread allowlist is below, workarounds are above.
Keep it that way. -->

View File

@@ -233,6 +233,10 @@
DRI_CONF_OPT_B(disable_protected_content_check, def, \
"Don't reject image import if protected_content attribute doesn't match")
#define DRI_CONF_IGNORE_MAP_UNSYNCHRONIZED(def) \
DRI_CONF_OPT_B(ignore_map_unsynchronized, def, \
"Ignore GL_MAP_UNSYNCHRONIZED_BIT, workaround for games that use it incorrectly")
/**
* \brief Image quality-related options
*/