Currently, when GPUs are being added and display driver only provides a fake one (like e.g. winex11.drv does on Xwayland), its default name and empty UUID and PCI IDs will be preferred over ones reported by Vulkan. When Vulkan-only GPUs are added later, the resulting list will look like so:
``` Xrandr GPU 0x0000:0x0000 {00000000-0000-0000-0000-000000000000} NVIDIA GeForce RTX 4080 Laptop GPU 0x10de:0x27e0 {13938ad6-4925-b628-c068-30558bc4b489} ```
Instead, when default or empty properties were provided, we should prefer ones from Vulkan as they are more likely to be accurate:
``` Intel(R) Graphics (RPL-S) 0x8086:0xa788 {a7888086-0004-0000-0002-000000000000} NVIDIA GeForce RTX 4080 Laptop GPU 0x10de:0x27e0 {13938ad6-4925-b628-c068-30558bc4b489} ```
This is important for LUIDs to be later correctly assigned by winevulkan which searches for matching GPU by UUID.
I'm not exactly sure if this implementation is the way to go (especially reporting and checking name for `"Wine GPU"`) but it's probably one of the simplest possible. Let me know if we already have some empty UUID around I could use for the comparison.
-- v2: win32u: Prefer Vulkan UUIDs over empty ones.
From: Krzysztof Bogacki krzysztof.bogacki@leancode.pl
Signed-off-by: Krzysztof Bogacki krzysztof.bogacki@leancode.pl --- dlls/win32u/sysparams.c | 4 ++-- dlls/wineandroid.drv/init.c | 2 +- dlls/winewayland.drv/display.c | 2 +- dlls/winex11.drv/xinerama.c | 2 +- dlls/winex11.drv/xrandr.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 54f514f557e..4fb0772a01d 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1249,7 +1249,7 @@ static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID * if (vulkan_uuid) ctx->gpu.vulkan_uuid = *vulkan_uuid; else if (vulkan_gpu) ctx->gpu.vulkan_uuid = vulkan_gpu->uuid;
- if (!name && vulkan_gpu) name = vulkan_gpu->name; + if ((!name || !strcmp( name, "Wine GPU" )) && vulkan_gpu) name = vulkan_gpu->name; if (name) RtlUTF8ToUnicodeN( ctx->gpu.name, sizeof(ctx->gpu.name) - sizeof(WCHAR), &len, name, strlen( name ) );
snprintf( ctx->gpu.path, sizeof(ctx->gpu.path), "PCI\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X\%08X", @@ -1796,7 +1796,7 @@ static NTSTATUS default_update_display_devices( struct device_manager_ctx *ctx ) struct gdi_monitor monitor = {0}; DEVMODEW mode = {.dmSize = sizeof(mode)};
- add_gpu( "Default GPU", &pci_id, NULL, ctx ); + add_gpu( "Wine GPU", &pci_id, NULL, ctx ); add_source( "Default", source_flags, ctx );
if (!read_source_mode( ctx->source_key, ENUM_CURRENT_SETTINGS, &mode )) diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index dd102375e44..d48c4153b06 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -281,7 +281,7 @@ UINT ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manag }; DEVMODEW current = mode;
- device_manager->add_gpu( "Android GPU", &pci_id, NULL, param ); + device_manager->add_gpu( "Wine GPU", &pci_id, NULL, param ); device_manager->add_source( "Default", source_flags, param ); device_manager->add_monitor( &gdi_monitor, param );
diff --git a/dlls/winewayland.drv/display.c b/dlls/winewayland.drv/display.c index 002bcd0f542..9b4ebe7cdc1 100644 --- a/dlls/winewayland.drv/display.c +++ b/dlls/winewayland.drv/display.c @@ -193,7 +193,7 @@ static void wayland_add_device_gpu(const struct gdi_device_manager *device_manag
TRACE("\n");
- device_manager->add_gpu("Wayland GPU", &pci_id, NULL, param); + device_manager->add_gpu("Wine GPU", &pci_id, NULL, param); }
static void wayland_add_device_source(const struct gdi_device_manager *device_manager, diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c index c394c8a49b4..1fd170b0e07 100644 --- a/dlls/winex11.drv/xinerama.c +++ b/dlls/winex11.drv/xinerama.c @@ -199,7 +199,7 @@ static BOOL xinerama_get_gpus( struct x11drv_gpu **new_gpus, int *count, BOOL ge if (!gpus) return FALSE;
- gpus[0].name = strdup( "Xinerama GPU" ); + gpus[0].name = strdup( "Wine GPU" ); *new_gpus = gpus; *count = 1;
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index d255864fe57..9a4284f493f 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -787,7 +787,7 @@ static BOOL xrandr14_get_gpus( struct x11drv_gpu **new_gpus, int *count, BOOL ge if (!provider_resources->nproviders) { WARN("XRandR implementation doesn't report any providers, faking one.\n"); - gpus[0].name = strdup( "Xrandr GPU" ); + gpus[0].name = strdup( "Wine GPU" ); *new_gpus = gpus; *count = 1; ret = TRUE;
From: Krzysztof Bogacki krzysztof.bogacki@leancode.pl
Signed-off-by: Krzysztof Bogacki krzysztof.bogacki@leancode.pl --- dlls/win32u/sysparams.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 4fb0772a01d..6492eef8266 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1249,6 +1249,8 @@ static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID * if (vulkan_uuid) ctx->gpu.vulkan_uuid = *vulkan_uuid; else if (vulkan_gpu) ctx->gpu.vulkan_uuid = vulkan_gpu->uuid;
+ if (!pci_id->vendor && !pci_id->device && vulkan_gpu) pci_id = &vulkan_gpu->pci_id; + if ((!name || !strcmp( name, "Wine GPU" )) && vulkan_gpu) name = vulkan_gpu->name; if (name) RtlUTF8ToUnicodeN( ctx->gpu.name, sizeof(ctx->gpu.name) - sizeof(WCHAR), &len, name, strlen( name ) );
From: Krzysztof Bogacki krzysztof.bogacki@leancode.pl
Signed-off-by: Krzysztof Bogacki krzysztof.bogacki@leancode.pl --- dlls/win32u/sysparams.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 6492eef8266..357e9af3c2a 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1217,6 +1217,8 @@ static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID * HKEY hkey, subkey; DWORD len;
+ static const GUID empty_uuid; + TRACE( "%s %04X %04X %08X %02X\n", debugstr_a( name ), pci_id->vendor, pci_id->device, pci_id->subsystem, pci_id->revision );
@@ -1246,7 +1248,7 @@ static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID * debugstr_guid(&vulkan_gpu->uuid), debugstr_a(vulkan_gpu->name)); }
- if (vulkan_uuid) ctx->gpu.vulkan_uuid = *vulkan_uuid; + if (vulkan_uuid && !IsEqualGUID( vulkan_uuid, &empty_uuid )) ctx->gpu.vulkan_uuid = *vulkan_uuid; else if (vulkan_gpu) ctx->gpu.vulkan_uuid = vulkan_gpu->uuid;
if (!pci_id->vendor && !pci_id->device && vulkan_gpu) pci_id = &vulkan_gpu->pci_id;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=145868
Your paranoid android.
=== debian11b (build log) ===
error: patch failed: dlls/win32u/sysparams.c:1217 Task: Patch failed to apply
On Tue May 28 08:21:11 2024 +0000, Krzysztof Bogacki wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/5736/diffs?diff_id=115397&start_sha=7126e21685069dfd2d20003146da6992fb6a0637#85770a8b187bd82db4dbb9a2b8a5f34616049d0f_1220_1220)
Thanks, fixed.
On Tue May 28 08:21:11 2024 +0000, Krzysztof Bogacki wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/5736/diffs?diff_id=115397&start_sha=7126e21685069dfd2d20003146da6992fb6a0637#85770a8b187bd82db4dbb9a2b8a5f34616049d0f_1251_1251)
Good to know, I wasn't aware it's a `#define` I could use here because it's not used by any other function in this file, not even `find_vulkan_gpu_from_uuid`. Fixed.
v2: Applied suggestions from review (`memcmp` → `!IsEqualGUID` and removal of `static const`'s initializer).
This merge request was approved by Rémi Bernon.