Instead of setting based on set/unset, allow users to use boolean values. In the docs, use `ALWAYS=true` instead of `ALWAYS=1` as it's clearer IMO.
Signed-off-by: Eric Engestrom <eric.engest...@imgtec.com> --- docs/envvars.html | 4 ++-- docs/releasing.html | 4 ++-- src/egl/Android.mk | 1 + src/egl/Makefile.am | 6 ++++-- src/egl/SConscript | 2 ++ src/egl/drivers/dri2/platform_wayland.c | 3 ++- src/egl/drivers/dri2/platform_x11.c | 3 ++- src/glx/apple/apple_visual.c | 2 +- src/glx/glxext.c | 2 +- 9 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/envvars.html b/docs/envvars.html index ca553e5397..b70528fa46 100644 --- a/docs/envvars.html +++ b/docs/envvars.html @@ -30,7 +30,7 @@ If set to 'verbose' additional information will be printed. <li>LIBGL_DRIVERS_PATH - colon-separated list of paths to search for DRI drivers <li>LIBGL_ALWAYS_INDIRECT - forces an indirect rendering context/connection. -<li>LIBGL_ALWAYS_SOFTWARE - if set, always use software rendering +<li>LIBGL_ALWAYS_SOFTWARE - if set to `true`, always use software rendering <li>LIBGL_NO_DRAWARRAYS - if set do not use DrawArrays GLX protocol (for debugging) <li>LIBGL_SHOW_FPS - print framerate to stdout based on the number of glXSwapBuffers calls per second. @@ -240,7 +240,7 @@ Use kill -10 <pid> to toggle the hud as desired. <li>GALLIUM_HUD_DUMP_DIR - specifies a directory for writing the displayed hud values into files. -<li>GALLIUM_DRIVER - useful in combination with LIBGL_ALWAYS_SOFTWARE=1 for +<li>GALLIUM_DRIVER - useful in combination with LIBGL_ALWAYS_SOFTWARE=true for choosing one of the software renderers "softpipe", "llvmpipe" or "swr". <li>GALLIUM_LOG_FILE - specifies a file for logging all errors, warnings, etc. rather than stderr. diff --git a/docs/releasing.html b/docs/releasing.html index 930de0edef..66742b0bcb 100644 --- a/docs/releasing.html +++ b/docs/releasing.html @@ -483,12 +483,12 @@ <h1 id="release">Making a new release</h1> eval $__glxgears_cmd eval $__es2info_cmd eval $__es2gears_cmd - export LIBGL_ALWAYS_SOFTWARE=1 + export LIBGL_ALWAYS_SOFTWARE=true eval $__glxinfo_cmd eval $__glxgears_cmd eval $__es2info_cmd eval $__es2gears_cmd - export LIBGL_ALWAYS_SOFTWARE=1 + export LIBGL_ALWAYS_SOFTWARE=true export GALLIUM_DRIVER=softpipe eval $__glxinfo_cmd eval $__glxgears_cmd diff --git a/src/egl/Android.mk b/src/egl/Android.mk index 0055322677..d7a6e88918 100644 --- a/src/egl/Android.mk +++ b/src/egl/Android.mk @@ -48,6 +48,7 @@ LOCAL_C_INCLUDES := \ $(MESA_TOP)/src/egl/drivers/dri2 LOCAL_STATIC_LIBRARIES := \ + libmesa_util \ libmesa_loader LOCAL_SHARED_LIBRARIES := \ diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am index bb8ec9745d..c00e929fb4 100644 --- a/src/egl/Makefile.am +++ b/src/egl/Makefile.am @@ -161,7 +161,8 @@ libEGL_mesa_la_SOURCES = \ main/egldispatchstubs.c \ g_egldispatchstubs.c \ g_egldispatchstubs.h -libEGL_mesa_la_LIBADD = libEGL_common.la +libEGL_mesa_la_LIBADD = libEGL_common.la \ + $(top_builddir)/src/util/libmesautil.la libEGL_mesa_la_LDFLAGS = \ -no-undefined \ -version-number 0 \ @@ -173,7 +174,8 @@ else # USE_LIBGLVND lib_LTLIBRARIES = libEGL.la libEGL_la_SOURCES = -libEGL_la_LIBADD = libEGL_common.la +libEGL_la_LIBADD = libEGL_common.la \ + $(top_builddir)/src/util/libmesautil.la libEGL_la_LDFLAGS = \ -no-undefined \ -version-number 1:0 \ diff --git a/src/egl/SConscript b/src/egl/SConscript index 8f8b11a61c..927092d228 100644 --- a/src/egl/SConscript +++ b/src/egl/SConscript @@ -24,6 +24,8 @@ env.Append(CPPDEFINES = [ ]) egl_sources.append('drivers/haiku/egl_haiku.cpp') +env.Prepend(LIBS = [mesautil]) + egl = env.SharedLibrary( target = 'EGL', source = egl_sources, diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index bf2adbf63b..eb10a7dd13 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -42,6 +42,7 @@ #include "egl_dri2.h" #include "egl_dri2_fallbacks.h" #include "loader.h" +#include "util/debug.h" #include "util/u_vector.h" #include "eglglobals.h" @@ -1940,7 +1941,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp) { EGLBoolean initialized = EGL_TRUE; - int hw_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL); + bool hw_accel = !env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false); if (hw_accel) { if (!dri2_initialize_wayland_drm(drv, disp)) { diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 5ca5b912da..5d5eea3773 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -40,6 +40,7 @@ #endif #include <sys/types.h> #include <sys/stat.h> +#include "util/debug.h" #include "util/macros.h" #include "egl_dri2.h" @@ -1458,7 +1459,7 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp) { EGLBoolean initialized = EGL_FALSE; - if (!getenv("LIBGL_ALWAYS_SOFTWARE")) { + if (!env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false)) { #ifdef HAVE_DRI3 if (!getenv("LIBGL_DRI3_DISABLE")) initialized = dri2_initialize_x11_dri3(drv, disp); diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c index d665cd7e01..a491823917 100644 --- a/src/glx/apple/apple_visual.c +++ b/src/glx/apple/apple_visual.c @@ -90,7 +90,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m attr[numattr++] = kCGLPFAOffScreen; } - else if (getenv("LIBGL_ALWAYS_SOFTWARE") != NULL) { + else if (env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false)) { apple_glx_diagnostic ("Software rendering requested. Using kCGLRendererGenericFloatID.\n"); attr[numattr++] = kCGLPFARendererID; diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 3431f3e5ca..3415277bbe 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -908,7 +908,7 @@ __glXInitialize(Display * dpy) #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) glx_direct = (getenv("LIBGL_ALWAYS_INDIRECT") == NULL); - glx_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL); + glx_accel = env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false); dpyPriv->drawHash = __glxHashCreate(); -- Cheers, Eric _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev