[PATCH v2 0/2] MR6301: Introduce a new WINE_VIDEO_DRIVER variable.
This variable is the Wine's equivalent of the SDL_VIDEODRIVER/ SDL_VIDEO_DRIVER variable in SDL 2 and 3 (it explicitly selects a list of graphics/video drivers to be used). -- v2: man: Add documentation for the WINE_VIDEO_DRIVER variable. explorer: Introduce a new WINE_VIDEO_DRIVER variable. https://gitlab.winehq.org/wine/wine/-/merge_requests/6301
From: Aida Jonikienė <aidas957(a)gmail.com> This variable is the Wine's equivalent of the SDL_VIDEODRIVER/ SDL_VIDEO_DRIVER variable in SDL 2 and 3 (it explicitly selects a list of graphics/video drivers to be used). --- programs/explorer/desktop.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index fb59258ad36..c573417fc9c 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -963,7 +963,7 @@ static void load_graphics_driver( const WCHAR *driver, GUID *guid ) { static const WCHAR device_keyW[] = L"System\\CurrentControlSet\\Control\\Video\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\0000"; - WCHAR buffer[MAX_PATH], libname[32], *name, *next; + WCHAR buffer[MAX_PATH], *env_name, libname[32], *name, *next; WCHAR key[ARRAY_SIZE( device_keyW ) + 39]; BOOL null_driver = FALSE; HMODULE module = 0; @@ -975,7 +975,9 @@ static void load_graphics_driver( const WCHAR *driver, GUID *guid ) lstrcpyW( buffer, default_driver ); /* @@ Wine registry key: HKCU\Software\Wine\Drivers */ - if (!RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Wine\\Drivers", &hkey )) + if ((env_name = _wgetenv( L"WINE_VIDEO_DRIVER" )) && env_name[0] != '\0') + lstrcpynW( buffer, env_name, ARRAY_SIZE( buffer )); + else if (!RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Wine\\Drivers", &hkey )) { DWORD count = sizeof(buffer); RegQueryValueExW( hkey, L"Graphics", 0, NULL, (LPBYTE)buffer, &count ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6301
From: Aida Jonikienė <aidas957(a)gmail.com> --- loader/wine.man.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/loader/wine.man.in b/loader/wine.man.in index 9d7822eaf88..10f068f7b19 100644 --- a/loader/wine.man.in +++ b/loader/wine.man.in @@ -235,6 +235,18 @@ WINE_D3D_CONFIG="renderer=vulkan;VideoPciVendorID=0xc0de" If an individual setting is specified in both the environment variable and the registry, the former takes precedence. .TP +.B WINE_VIDEO_DRIVER +Specifies the list of graphics drivers Wine should try to load. It +can be used instead of modifying the +.B HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Drivers\\\\Graphics +registry value. The value is a comma-separated list of driver names +(same as the registry one). For example: +.IP +WINE_VIDEODRIVER="x11,wayland" +.IP +If the driver list is specified in both the environment variable +and the registry, the former takes precedence. +.TP .B DISPLAY Specifies the X11 display to use. .TP -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6301
I don't think this can work, an environment variable is inherently a per-process setting and the graphics driver needs to be the same for the entire prefix (or at least for a given desktop). Wine doesn't restrict how prefix are started and it would be up to downstream wrappers to change the prefix driver when starting it, based on an environment variable if they want and only allow prefixes to be started with the main process. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6301#note_79102
On Mon Aug 19 12:03:23 2024 +0000, Rémi Bernon wrote:
I don't think this can work, an environment variable is inherently a per-process setting and the graphics driver needs to be the same for the entire prefix (or at least for a given desktop). Wine doesn't restrict how prefix are started and it would be up to downstream wrappers to change the prefix driver when starting it, based on an environment variable if they want and only allow prefixes to be started with the main process. This is intended as a quicker and less permanent way (registry is relatively permanent) to test new graphics drivers (like winewayland) or the X11 support on macOS (the latter case is probably much rarer though)
Once explorer.exe loads along with the prefix initialization, the driver variable probably has no effect (so there shouldn't be weird issues like loading X11 driver after winewayland is driving the Wine prefix); I haven't tested that theory yet though -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6301#note_79105
On Mon Aug 19 12:03:23 2024 +0000, Aida Jonikienė wrote:
This is intended as a quicker and less permanent way (registry is relatively permanent) to test new graphics drivers (like winewayland) or the X11 support on macOS (the latter case is probably much rarer though) Once explorer.exe loads along with the prefix initialization, the driver variable probably has no effect (so there shouldn't be weird issues like loading X11 driver after winewayland is driving the Wine prefix); I haven't tested that theory yet though For testing you can simply set/unset DISPLAY, there's no need for a separate variable.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/6301#note_79106
For testing you can simply set/unset DISPLAY
That won't work in vanilla Wine unless !5583 is merged -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6301#note_79107
On Mon Aug 19 12:16:37 2024 +0000, Aida Jonikienė wrote:
For testing you can simply set/unset DISPLAY That won't work in vanilla Wine (with a clean prefix) unless !5583 is merged Of course you have to set the registry key once.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/6301#note_79109
Of course you have to set the registry key once.
And this change removes that permanent registry value requirement -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6301#note_79393
On Wed Aug 21 08:17:12 2024 +0000, Aida Jonikienė wrote:
Of course you have to set the registry key once. And this change removes that permanent registry value requirement Having to add a registry key manually without X11 is really cumbersome, because `wine regedit` doesn't work so the user has to resort to `wine reg` which isn't exactly a pleasant tool to use. So this WINE_VIDEO_DRIVER variable is pretty much needed.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/6301#note_79555
On Thu Aug 22 09:11:43 2024 +0000, Manuel Alfayate wrote:
Having to add a registry key manually without X11 is really cumbersome, because `wine regedit` doesn't work so the user has to resort to `wine reg` which isn't exactly a pleasant tool to use. So this WINE_VIDEO_DRIVER variable is pretty much needed. The wayland driver will be added to the defaults once it's ready for general use.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/6301#note_79558
!5583 was merged, closing. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6301#note_87381
This merge request was closed by Alexandre Julliard. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6301
participants (4)
-
Aida Jonikienė -
Alexandre Julliard (@julliard) -
Manuel Alfayate (@vanfanel) -
Rémi Bernon