static void virgl_link_shader(struct pipe_context *ctx, void **handles)
{
struct virgl_context *vctx = virgl_context(ctx);
+ struct virgl_screen *rs = virgl_screen(vctx->base.screen);
+
uint32_t shader_handles[PIPE_SHADER_TYPES];
for (uint32_t i = 0; i < PIPE_SHADER_TYPES; ++i)
shader_handles[i] = (uintptr_t)handles[i];
virgl_encode_link_shader(vctx, shader_handles);
+
+ /* block until shader linking is finished on host */
+ if (rs->shader_sync && !unlikely(virgl_debug & VIRGL_DEBUG_SYNC)) {
+ struct virgl_winsys *vws = rs->vws;
+ struct pipe_fence_handle *sync_fence;
+ virgl_flush_eq(vctx, vctx, &sync_fence);
+ vws->fence_wait(vws, sync_fence, PIPE_TIMEOUT_INFINITE);
+ vws->fence_reference(vws, &sync_fence, NULL);
+ }
}
struct pipe_context *virgl_context_create(struct pipe_screen *pscreen,
* possible drm-native-context guest driver:
*/
DRI_CONF_DISABLE_CONSERVATIVE_LRZ(false)
+
+ DRI_CONF_VIRGL_SHADER_SYNC(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
/* Also needed for native-context drivers (freedreno) */
DRI_CONF_DISABLE_THROTTLING(false)
-DRI_CONF_SECTION_END
\ No newline at end of file
+DRI_CONF_SECTION_END
{ "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)
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;
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;
VIRGL_DEBUG_USE_TGSI = 1 << 7,
VIRGL_DEBUG_L8_SRGB_ENABLE_READBACK = 1 << 8,
VIRGL_DEBUG_VIDEO = 1 << 9,
+ VIRGL_DEBUG_SHADER_SYNC = 1 << 10,
};
extern int virgl_debug;
bool tweak_gles_apply_bgra_dest_swizzle;
bool tweak_l8_srgb_readback;
bool no_coherent;
+ bool shader_sync;
int32_t tweak_gles_tf3_value;
nir_shader_compiler_options compiler_options;
DRI_CONF_OPT_B(format_l8_srgb_enable_readback, def, \
"Force-enable reading back L8_SRGB textures")
+#define DRI_CONF_VIRGL_SHADER_SYNC(def) \
+ DRI_CONF_OPT_B(virgl_shader_sync, def, \
+ "Make shader compilation synchronous")
+
/**
* \brief freedreno specific configuration options
*/