glx/egl: fix LIBGL_KOPPER_DISABLE

when set, this disables the use of vk swapchains and lets the dri frontend
manage buffers like any other driver

also document some kopper env vars

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28137>
This commit is contained in:
Mike Blumenkrantz
2024-03-12 14:59:55 -04:00
committed by Marge Bot
parent d3730fcd2d
commit cfa955ed78
6 changed files with 25 additions and 9 deletions

View File

@@ -38,6 +38,22 @@ LibGL environment variables
disable DRI3 if set to ``true``. disable DRI3 if set to ``true``.
.. envvar:: LIBGL_KOPPER_DISABLE
disable vulkan swapchains with zink if set to ``true``.
In general, this should not be used unless you know what you are
doing. Some examples of "knowing what you are doing" include:
- using a VK driver which has no WSI implementation for your display server
- profiling the DRI frontend against your VK driver's WSI implementation
.. envvar:: LIBGL_KOPPER_DRI2
disable DRI3 with zink if set to ``true``.
In general, this should not be used unless you know what you are
doing. Some examples of "knowing what you are doing" include:
- running xrdp
- using a VK driver which doesn't support modifiers
Core Mesa environment variables Core Mesa environment variables
------------------------------- -------------------------------

View File

@@ -1803,7 +1803,8 @@ EGLBoolean
dri2_initialize_x11(_EGLDisplay *disp) dri2_initialize_x11(_EGLDisplay *disp)
{ {
enum dri2_egl_driver_fail status = DRI2_EGL_DRIVER_FAILED; enum dri2_egl_driver_fail status = DRI2_EGL_DRIVER_FAILED;
if (disp->Options.ForceSoftware || disp->Options.Zink) if (disp->Options.ForceSoftware ||
(disp->Options.Zink && !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false)))
return dri2_initialize_x11_swrast(disp); return dri2_initialize_x11_swrast(disp);
#ifdef HAVE_DRI3 #ifdef HAVE_DRI3

View File

@@ -635,7 +635,8 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
if (!dri2_dpy->driver_name) if (!dri2_dpy->driver_name)
dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd_render_gpu); dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd_render_gpu);
if (!strcmp(dri2_dpy->driver_name, "zink")) { if (!strcmp(dri2_dpy->driver_name, "zink") &&
!debug_get_bool_option("LIBGL_KOPPER_DISABLE", false)) {
close(dri2_dpy->fd_render_gpu); close(dri2_dpy->fd_render_gpu);
return DRI2_EGL_DRIVER_PREFER_ZINK; return DRI2_EGL_DRIVER_PREFER_ZINK;
} }

View File

@@ -142,17 +142,13 @@ DEFINE_LOADER_DRM_ENTRYPOINT(lima)
#endif #endif
#if defined(GALLIUM_ZINK) #if defined(GALLIUM_ZINK)
#if DETECT_OS_ANDROID
DEFINE_LOADER_DRM_ENTRYPOINT(zink);
#else
const __DRIextension **__driDriverGetExtensions_zink(void); const __DRIextension **__driDriverGetExtensions_zink(void);
PUBLIC const __DRIextension **__driDriverGetExtensions_zink(void) PUBLIC const __DRIextension **__driDriverGetExtensions_zink(void)
{ {
return galliumvk_driver_extensions; return debug_get_bool_option("LIBGL_KOPPER_DISABLE", false) ? galliumdrm_driver_extensions : galliumvk_driver_extensions;
} }
#endif #endif
#endif
#if defined(GALLIUM_D3D12) #if defined(GALLIUM_D3D12)
DEFINE_LOADER_DRM_ENTRYPOINT(d3d12); DEFINE_LOADER_DRM_ENTRYPOINT(d3d12);

View File

@@ -78,6 +78,7 @@
#include "loader.h" #include "loader.h"
#include "loader_dri_helper.h" #include "loader_dri_helper.h"
#include "dri2.h" #include "dri2.h"
#include "util/u_debug.h"
static struct dri3_drawable * static struct dri3_drawable *
loader_drawable_to_dri3_drawable(struct loader_dri3_drawable *draw) { loader_drawable_to_dri3_drawable(struct loader_dri3_drawable *draw) {
@@ -836,7 +837,7 @@ dri3_create_screen(int screen, struct glx_display * priv)
goto handle_error; goto handle_error;
} }
if (!strcmp(driverName, "zink")) { if (!strcmp(driverName, "zink") && !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false)) {
return_zink = true; return_zink = true;
goto handle_error; goto handle_error;
} }

View File

@@ -907,7 +907,8 @@ __glXInitialize(Display * dpy)
** (e.g., those called in AllocAndFetchScreenConfigs). ** (e.g., those called in AllocAndFetchScreenConfigs).
*/ */
#if defined(GLX_USE_DRM) #if defined(GLX_USE_DRM)
if (glx_direct && glx_accel && !zink) { if (glx_direct && glx_accel &&
(!zink || debug_get_bool_option("LIBGL_KOPPER_DISABLE", false))) {
#if defined(HAVE_DRI3) #if defined(HAVE_DRI3)
if (!debug_get_bool_option("LIBGL_DRI3_DISABLE", false)) { if (!debug_get_bool_option("LIBGL_DRI3_DISABLE", false)) {
dpyPriv->dri3Display = dri3_create_display(dpy); dpyPriv->dri3Display = dri3_create_display(dpy);