81 lines
2.8 KiB
Diff
81 lines
2.8 KiB
Diff
|
From 2a71f06f2938678d89d5ed1372cda6a7b55d964d Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= <jexposit@redhat.com>
|
||
|
Date: Thu, 16 Nov 2023 12:18:29 +0100
|
||
|
Subject: [PATCH] zink: allow software rendering only if selected
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
In environments where 3D acceleration is not available, like in a VM,
|
||
|
the behavior before commit 8cd44b884387 ("egl: add automatic zink
|
||
|
fallback loading between hw and sw drivers") was to fallback to swrast.
|
||
|
|
||
|
This was the output of `eglinfo` in that situation:
|
||
|
|
||
|
$ eglinfo
|
||
|
[...]
|
||
|
Wayland platform:
|
||
|
EGL driver name: swrast
|
||
|
OpenGL core profile renderer: llvmpipe (LLVM 17.0.4, 256 bits)
|
||
|
|
||
|
However, after commit 8cd44b884387 ("egl: add automatic zink fallback
|
||
|
loading between hw and sw drivers") Zink support is tested before
|
||
|
falling back to swrast.
|
||
|
Since the system doesn't support 3D acceleration, Zink + software
|
||
|
rendering is used instead of swrast causing issues like the ones
|
||
|
described in #10146.
|
||
|
|
||
|
In this case, `eglinfo` prints:
|
||
|
|
||
|
$ eglinfo
|
||
|
[...]
|
||
|
Wayland platform:
|
||
|
EGL driver name: zink
|
||
|
OpenGL core profile renderer: zink Vulkan 1.3(llvmpipe (LLVM 17.0.4,
|
||
|
256 bits) (MESA_LLVMPIPE))
|
||
|
|
||
|
This patch ensures that Zink + software rendering is used only when the
|
||
|
user opts-in by setting `LIBGL_ALWAYS_SOFTWARE` or `D3D_ALWAYS_SOFTWARE`
|
||
|
and swrast is used otherwise.
|
||
|
|
||
|
After the patch, the output of `eglinfo` is identical to the one before
|
||
|
the regression:
|
||
|
|
||
|
$ eglinfo
|
||
|
[...]
|
||
|
Wayland platform:
|
||
|
EGL driver name: swrast
|
||
|
OpenGL core profile renderer: llvmpipe (LLVM 17.0.4, 256 bits)
|
||
|
|
||
|
Resolves: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10146
|
||
|
Fixes: 8cd44b884387 ("egl: add automatic zink fallback loading between
|
||
|
hw and sw drivers")
|
||
|
|
||
|
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
|
||
|
Signed-off-by: José Expósito <jexposit@redhat.com>
|
||
|
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26220>
|
||
|
---
|
||
|
src/gallium/drivers/zink/zink_screen.c | 6 ++++++
|
||
|
1 file changed, 6 insertions(+)
|
||
|
|
||
|
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
|
||
|
index 29a377acfb6..50168d8daa1 100644
|
||
|
--- a/src/gallium/drivers/zink/zink_screen.c
|
||
|
+++ b/src/gallium/drivers/zink/zink_screen.c
|
||
|
@@ -1632,6 +1632,12 @@ choose_pdev(struct zink_screen *screen, int64_t dev_major, int64_t dev_minor)
|
||
|
}
|
||
|
VKSCR(GetPhysicalDeviceProperties)(screen->pdev, &screen->info.props);
|
||
|
|
||
|
+ /* allow software rendering only if forced by the user */
|
||
|
+ if (!cpu && screen->info.props.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU) {
|
||
|
+ screen->pdev = VK_NULL_HANDLE;
|
||
|
+ return;
|
||
|
+ }
|
||
|
+
|
||
|
screen->info.device_version = screen->info.props.apiVersion;
|
||
|
|
||
|
/* runtime version is the lesser of the instance version and device version */
|
||
|
--
|
||
|
2.41.0
|
||
|
|