egl+glx: turn LIBGL_ALWAYS_SOFTWARE into a boolean
authorEric Engestrom <eric.engestrom@imgtec.com>
Fri, 8 Sep 2017 10:52:01 +0000 (11:52 +0100)
committerEric Engestrom <eric.engestrom@imgtec.com>
Tue, 12 Sep 2017 12:53:11 +0000 (13:53 +0100)
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.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
docs/envvars.html
docs/releasing.html
src/egl/Android.mk
src/egl/Makefile.am
src/egl/SConscript
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c
src/glx/apple/apple_visual.c
src/glx/glxext.c

index ca553e5397f18a911a984b2267b2cc4b00d281ed..b70528fa467eb52ff8abdd75a3ac8ad089270e13 100644 (file)
@@ -30,7 +30,7 @@ sometimes be useful for debugging end-user issues.
    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 @@ Mesa EGL supports different sets of environment variables.  See the
     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.
index 930de0edef76c7406703891ea4e146e11e43f0c9..66742b0bcb4bd4bc52614d9c442a64e1c8017238 100644 (file)
@@ -483,12 +483,12 @@ Here is one solution that I've been using.
        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
index 00553226773e9ba8be87e495be88c9cbf2637d0d..d7a6e88918f6fd169807d18099f9ac40a03b318a 100644 (file)
@@ -48,6 +48,7 @@ LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/egl/drivers/dri2
 
 LOCAL_STATIC_LIBRARIES := \
+       libmesa_util \
        libmesa_loader
 
 LOCAL_SHARED_LIBRARIES := \
index bb8ec9745dd924038d1e2a8ed6dee26d9e149155..8ff1ffaba18c39fcb5d8ec8f299af73830149603 100644 (file)
@@ -45,6 +45,7 @@ libEGL_common_la_SOURCES = \
        $(LIBEGL_C_FILES)
 
 libEGL_common_la_LIBADD = \
+       $(top_builddir)/src/util/libmesautil.la \
        $(EGL_LIB_DEPS)
 
 dri2_backend_FILES =
@@ -82,7 +83,6 @@ AM_CFLAGS += $(WAYLAND_CFLAGS)
 libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
 libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
 libEGL_common_la_LIBADD += $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la
-libEGL_common_la_LIBADD += $(top_builddir)/src/util/libmesautil.la
 dri2_backend_FILES += \
        drivers/dri2/platform_wayland.c \
        drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
index 8f8b11a61ce94b51cca5ca8558147ac55c61b55d..927092d22847dfbdb291b02dd65c511eef17f768 100644 (file)
@@ -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,
index bf2adbf63bdbb0db0352a06288bbba659db6db32..eb10a7dd137a00938159dbbdc215d9aacc1f9ea5 100644 (file)
@@ -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)) {
index 5ca5b912daba6e716f8cbe223892fc97644479f8..5d5eea3773b5d68cb2c540a5de5e5229e0cce7f8 100644 (file)
@@ -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);
index d665cd7e01c271d6368c7f8577e1c3c1dd20be2d..a4918239178189f1aa80363742cf18c2b35f6146 100644 (file)
@@ -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;
index 3431f3e5cae5e1fd6709eede3b01c4f605b56a67..cd9a3ba6ba0db9c356f17bb53e4c611af77e78d6 100644 (file)
@@ -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();