virgl: Add an option to disable coherent

This breaks almost every android apps when running with crosvm+minigbm.
Add an option so we can disable it.

Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12968>
This commit is contained in:
Lepton Wu 2021-09-21 16:30:34 -07:00 committed by Marge Bot
parent c1e2dfb365
commit 1a33dca3ae
2 changed files with 5 additions and 1 deletions

View File

@ -49,6 +49,7 @@ static const struct debug_named_value virgl_debug_options[] = {
{ "nobgraswz", VIRGL_DEBUG_NO_BGRA_DEST_SWIZZLE,"Disable tweak to swizzle emulated BGRA on GLES hosts" },
{ "sync", VIRGL_DEBUG_SYNC, "Sync after every flush" },
{ "xfer", VIRGL_DEBUG_XFER, "Do not optimize for transfers" },
{ "nocoherent", VIRGL_DEBUG_NO_COHERENT, "Disable coherent memory"},
DEBUG_NAMED_VALUE_END
};
DEBUG_GET_ONCE_FLAGS_OPTION(virgl_debug, "VIRGL_DEBUG", virgl_debug_options, 0)
@ -300,7 +301,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
return (vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_ARB_BUFFER_STORAGE) &&
(vscreen->caps.caps.v2.host_feature_check_version >= 4) &&
vscreen->vws->supports_coherent;
vscreen->vws->supports_coherent && !vscreen->no_coherent;
case PIPE_CAP_PCI_GROUP:
case PIPE_CAP_PCI_BUS:
case PIPE_CAP_PCI_DEVICE:
@ -954,6 +955,7 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c
}
screen->tweak_gles_emulate_bgra &= !(virgl_debug & VIRGL_DEBUG_NO_EMULATE_BGRA);
screen->tweak_gles_apply_bgra_dest_swizzle &= !(virgl_debug & VIRGL_DEBUG_NO_BGRA_DEST_SWIZZLE);
screen->no_coherent = virgl_debug & VIRGL_DEBUG_NO_COHERENT;
screen->vws = vws;
screen->base.get_name = virgl_get_name;

View File

@ -35,6 +35,7 @@ enum virgl_debug_flags {
VIRGL_DEBUG_NO_BGRA_DEST_SWIZZLE = 1 << 3,
VIRGL_DEBUG_SYNC = 1 << 4,
VIRGL_DEBUG_XFER = 1 << 5,
VIRGL_DEBUG_NO_COHERENT = 1 << 6,
};
extern int virgl_debug;
@ -56,6 +57,7 @@ struct virgl_screen {
uint32_t sub_ctx_id;
bool tweak_gles_emulate_bgra;
bool tweak_gles_apply_bgra_dest_swizzle;
bool no_coherent;
int32_t tweak_gles_tf3_value;
struct disk_cache *disk_cache;