diff options
author | Ryan Neph <ryanneph@google.com> | 2023-04-05 12:16:34 -0700 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-04-19 06:35:35 +0000 |
commit | 48062f91c721b8cc177e4df09719cfe609a92453 (patch) | |
tree | aed2975464ad67f900e1d1b8c3961d87531e94bf /src/gallium/drivers/virgl/virgl_screen.c | |
parent | 2e2491b76cdfc93ea33b1330caf36764c5515b68 (diff) |
virgl: add debug flag to force synchronous GL shader compilation
This does two things:
1. Flush the command buffer and associate a fence with each
glLinkProgram().
2. Force the application calling glLinkProgram() to wait on the
associated fence, matching the semantics of native drivers.
This important for some workloads and some environments. For example, on
ChromeOS devices supporting VM-based android (ARCVM), an app's HWUI thread
may be configured to use skiagl, while the app may create its own GLES
context for custom rendering. Virgl+virtio_gpu supports a single fencing
timeline, so all guest GL/GLES contexts are serialized by submission
order to the guest kernel.
If the app's submits multiple heavy shaders for compliation+linking
(glCompileShader + glLinkProgram()), these are batched into a single
virtgpu execbuffer (with one fence). Then rendering performed by the
HWUI thread is blocked until the unrelated heavy host-side work is
finished. To the user, the app appears completely frozen until finished.
With this change, the app is throttled in its calls to glLinkProgram(),
and the HWUI work can fill in the gaps between each while hitting most
display update deadlines. To the user, the UI may render at reduced
framerate, but remains mostly responsive to interaction.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22341>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_screen.c')
-rw-r--r-- | src/gallium/drivers/virgl/virgl_screen.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index ff04d406fa2..6acaa38e7c2 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -55,6 +55,7 @@ static const struct debug_named_value virgl_debug_options[] = { { "r8srgb-readback", VIRGL_DEBUG_L8_SRGB_ENABLE_READBACK, "Enable redaback for L8 sRGB textures" }, { "nocoherent", VIRGL_DEBUG_NO_COHERENT, "Disable coherent memory"}, { "video", VIRGL_DEBUG_VIDEO, "Video codec"}, + { "shader_sync", VIRGL_DEBUG_SHADER_SYNC, "Sync after every shader link"}, DEBUG_NAMED_VALUE_END }; DEBUG_GET_ONCE_FLAGS_OPTION(virgl_debug, "VIRGL_DEBUG", virgl_debug_options, 0) @@ -1122,6 +1123,7 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c const char *VIRGL_GLES_APPLY_BGRA_DEST_SWIZZLE = "gles_apply_bgra_dest_swizzle"; const char *VIRGL_GLES_SAMPLES_PASSED_VALUE = "gles_samples_passed_value"; const char *VIRGL_FORMAT_L8_SRGB_ENABLE_READBACK = "format_l8_srgb_enable_readback"; + const char *VIRGL_SHADER_SYNC = "virgl_shader_sync"; if (!screen) return NULL; @@ -1140,11 +1142,13 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c driQueryOptioni(config->options, VIRGL_GLES_SAMPLES_PASSED_VALUE); screen->tweak_l8_srgb_readback = driQueryOptionb(config->options, VIRGL_FORMAT_L8_SRGB_ENABLE_READBACK); + screen->shader_sync = driQueryOptionb(config->options, VIRGL_SHADER_SYNC); } 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->tweak_l8_srgb_readback |= !!(virgl_debug & VIRGL_DEBUG_L8_SRGB_ENABLE_READBACK); + screen->shader_sync |= !!(virgl_debug & VIRGL_DEBUG_SHADER_SYNC); screen->vws = vws; screen->base.get_name = virgl_get_name; |