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>
(cherry picked from commit a88cd98315)
This commit is contained in:
Jesse Natalie 2021-01-29 09:53:23 -08:00 committed by Dylan Baker
parent bf0b3c65c5
commit 664a5ef70b
3 changed files with 9 additions and 5 deletions

View file

@ -2551,7 +2551,7 @@
"description": "drisw: Disable automatic use of layered drivers with LIBGL_ALWAYS_SOFTWARE",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "4a3b42a717ce4fa4450066352f04f2e1ef78ad9a"
},

View file

@ -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",

View file

@ -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",