| From 1a33dca3aeb102860341da93eea5dbf4a3a43ef5 Mon Sep 17 00:00:00 2001 |
| From: Lepton Wu <lepton@chromium.org> |
| Date: Tue, 21 Sep 2021 16:30:34 -0700 |
| Subject: [PATCH] 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> |
| --- |
| src/gallium/drivers/virgl/virgl_screen.c | 4 +++- |
| src/gallium/drivers/virgl/virgl_screen.h | 2 ++ |
| 2 files changed, 5 insertions(+), 1 deletion(-) |
| |
| diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c |
| index 56cfdc6e524..767e0ce9374 100644 |
| --- a/src/gallium/drivers/virgl/virgl_screen.c |
| +++ b/src/gallium/drivers/virgl/virgl_screen.c |
| @@ -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; |
| diff --git a/src/gallium/drivers/virgl/virgl_screen.h b/src/gallium/drivers/virgl/virgl_screen.h |
| index 22275cbea1c..a604c6bb431 100644 |
| --- a/src/gallium/drivers/virgl/virgl_screen.h |
| +++ b/src/gallium/drivers/virgl/virgl_screen.h |
| @@ -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; |
| -- |
| 2.33.0.464.g1972c5931b-goog |
| |