diff --git a/docs/envvars.rst b/docs/envvars.rst index 052b3b02599..e0c73ea4500 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -23,6 +23,8 @@ LibGL environment variables ``LIBGL_SHOW_FPS`` print framerate to stdout based on the number of ``glXSwapBuffers`` calls per second. +``LIBGL_DRI2_DISABLE`` + disable DRI2 if set to ``true``. ``LIBGL_DRI3_DISABLE`` disable DRI3 if set to ``true``. diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index f61267af2aa..9ffd67ab58c 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1541,7 +1541,11 @@ dri2_initialize_x11(_EGLDisplay *disp) return EGL_TRUE; #endif - return dri2_initialize_x11_dri2(disp); + if (!env_var_as_boolean("LIBGL_DRI2_DISABLE", false)) + if (dri2_initialize_x11_dri2(disp)) + return EGL_TRUE; + + return EGL_FALSE; } void diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 34e86ae734d..fd313111ea2 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -926,7 +926,8 @@ __glXInitialize(Display * dpy) if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false)) dpyPriv->dri3Display = dri3_create_display(dpy); #endif /* HAVE_DRI3 */ - dpyPriv->dri2Display = dri2CreateDisplay(dpy); + if (!env_var_as_boolean("LIBGL_DRI2_DISABLE", false)) + dpyPriv->dri2Display = dri2CreateDisplay(dpy); dpyPriv->driDisplay = driCreateDisplay(dpy); } #endif /* GLX_USE_DRM */