From f5ca29b430f2e49b6595ae4deed5f4fa5481a1f0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 8 Apr 2021 20:33:30 -0400 Subject: [PATCH] zink: fix CI flakiness in glx-multithread-clearbuffer unsetting zink from GALLIUM_DRIVER is required in order for lavapipe to work, but setting it back is totally broken in the case where an app creates a ton of screens simultaneously instead, just leave it set to llvmpipe, and if a race condition occurs, at least llvmpipe isn't going to fail a test that zink passes Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_screen.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 83f964749da..db639d56af5 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -1525,17 +1525,16 @@ struct pipe_screen * zink_create_screen(struct sw_winsys *winsys) { #ifdef ZINK_WITH_SWRAST_VK - char *use_lavapipe = getenv("ZINK_USE_LAVAPIPE"), *gallium_driver = NULL; + char *use_lavapipe = getenv("ZINK_USE_LAVAPIPE"); if (use_lavapipe) { /** - * HACK: Temorarily unset $GALLIUM_DRIVER to prevent Lavapipe from + * HACK: unset $GALLIUM_DRIVER to prevent Lavapipe from * recursively trying to use zink as the gallium driver. * * This is not thread-safe, so if an application creates another - * context in another thread at the same time, well, we're out of - * luck! + * context in another thread at the same time, it may or may not use zink, + * but at least it won't abort. */ - gallium_driver = getenv("GALLIUM_DRIVER"); #ifdef _WIN32 _putenv("GALLIUM_DRIVER=llvmpipe"); #else @@ -1549,14 +1548,8 @@ zink_create_screen(struct sw_winsys *winsys) ret->winsys = winsys; #ifdef ZINK_WITH_SWRAST_VK - if (gallium_driver) { -#ifdef _WIN32 - char envstr[64] = ""; - snprintf(envstr, 64, "GALLIUM_DRIVER=%s", gallium_driver); - _putenv(envstr); -#else - setenv("GALLIUM_DRIVER", gallium_driver, 1); -#endif + if (use_lavapipe) { + printf("zink running on lavapipe: if you see VK_ERROR_OUT_OF_HOST_MEMORY from lavapipe, try again.\n"); } #endif