From 47273d7312cb5b5b6b0b9faa814d574bbbce1c01 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Wed, 18 Oct 2017 17:04:27 +0100 Subject: [PATCH] egl: set UseFallback if LIBGL_ALWAYS_SOFTWARE is set Suggested-by: Emil Velikov Signed-off-by: Eric Engestrom --- src/egl/drivers/dri2/platform_surfaceless.c | 3 +-- src/egl/drivers/dri2/platform_wayland.c | 3 +-- src/egl/drivers/dri2/platform_x11.c | 2 +- src/egl/main/egldriver.c | 5 ++++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c index 2af4a40b1a6..977b0460166 100644 --- a/src/egl/drivers/dri2/platform_surfaceless.c +++ b/src/egl/drivers/dri2/platform_surfaceless.c @@ -36,7 +36,6 @@ #include "egl_dri2.h" #include "egl_dri2_fallbacks.h" #include "loader.h" -#include "util/debug.h" static __DRIimage* surfaceless_alloc_image(struct dri2_egl_display *dri2_dpy, @@ -325,7 +324,7 @@ dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp) dri2_dpy->fd = -1; disp->DriverData = (void *) dri2_dpy; - if (!env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false)) { + if (!disp->Options.UseFallback) { driver_loaded = surfaceless_probe_device(disp, false); if (!driver_loaded) _eglLog(_EGL_WARNING, diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 14db55ca747..b38eb1c3354 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -42,7 +42,6 @@ #include "egl_dri2.h" #include "egl_dri2_fallbacks.h" #include "loader.h" -#include "util/debug.h" #include "util/u_vector.h" #include "eglglobals.h" @@ -1972,7 +1971,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp) { EGLBoolean initialized = EGL_FALSE; - if (!env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false)) + if (!disp->Options.UseFallback) initialized = dri2_initialize_wayland_drm(drv, disp); if (!initialized) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 9c20ea8f8a9..5bcdb2dac74 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1460,7 +1460,7 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp) { EGLBoolean initialized = EGL_FALSE; - if (!env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false)) { + if (!disp->Options.UseFallback) { #ifdef HAVE_DRI3 if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false)) initialized = dri2_initialize_x11_dri3(drv, disp); diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 33f8f57aeb1..1ff37850e05 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -44,6 +44,8 @@ #include "egldriver.h" #include "egllog.h" +#include "util/debug.h" + static mtx_t _eglModuleMutex = _MTX_INITIALIZER_NP; static _EGLDriver *_eglDriver; @@ -86,7 +88,8 @@ _eglMatchDriver(_EGLDisplay *dpy) assert(!dpy->Initialized); /* set options */ - dpy->Options.UseFallback = EGL_FALSE; + dpy->Options.UseFallback = + env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false); best_drv = _eglMatchAndInitialize(dpy); if (!best_drv) { -- 2.30.2