drisw: Disable automatic use of layered drivers with LIBGL_ALWAYS_SOFTWARE

If LIBGL_ALWAYS_SOFTWARE is set, then drisw is selected, and internally,
drisw should choose one of the actual software drivers. If it's not set,
but drisw is still selected (no hardware DRM driver, like in WSL), then
layered drivers are preferred over pure software.

Fixes: 4a3b42a7 ("drisw: Prefer hardware-layered sw-winsys drivers over pure sw")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4171
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8782>
This commit is contained in:
Jesse Natalie
2021-01-29 09:53:23 -08:00
committed by Marge Bot
parent 6ae726b799
commit a88cd98315
2 changed files with 8 additions and 4 deletions
@@ -4,6 +4,7 @@
#include "pipe/p_compiler.h"
#include "util/u_debug.h"
#include "util/debug.h"
#include "frontend/sw_winsys.h"
#include "target-helpers/inline_debug_helper.h"
@@ -77,13 +78,14 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
static inline struct pipe_screen *
sw_screen_create(struct sw_winsys *winsys)
{
UNUSED bool only_sw = env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false);
const char *drivers[] = {
debug_get_option("GALLIUM_DRIVER", ""),
#if defined(GALLIUM_ZINK)
"zink",
only_sw ? "" : "zink",
#endif
#if defined(GALLIUM_D3D12)
"d3d12",
only_sw ? "" : "d3d12",
#endif
#if defined(GALLIUM_LLVMPIPE)
"llvmpipe",
@@ -4,6 +4,7 @@
#include "pipe/p_compiler.h"
#include "util/u_debug.h"
#include "util/debug.h"
#include "target-helpers/sw_helper_public.h"
#include "frontend/sw_winsys.h"
@@ -82,13 +83,14 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
struct pipe_screen *
sw_screen_create(struct sw_winsys *winsys)
{
UNUSED bool only_sw = env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false);
const char *drivers[] = {
debug_get_option("GALLIUM_DRIVER", ""),
#if defined(GALLIUM_ZINK)
"zink",
only_sw ? "" : "zink",
#endif
#if defined(GALLIUM_D3D12)
"d3d12",
only_sw ? "" : "d3d12",
#endif
#if defined(GALLIUM_LLVMPIPE)
"llvmpipe",