From: Zhiyi Zhang <zzhang(a)codeweavers.com> For example, when GPU 1 has adapter 1 and GPU 2 has adapter 2, without this fix, the `adapter` variable in the for loop is always zero when forming GDI display names \\.\DISPLAY* because these two adapters are on different GPUs. Thus "\\.\DISPLAY1" is incorrectly passed to xrandr14_get_id() for the second adapter and eventually gets the wrong current display mode for the second adapter. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57610 --- dlls/winex11.drv/display.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 8d1a1dfd414..357e434ac5e 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -404,10 +404,10 @@ BOOL X11DRV_DisplayDevices_SupportEventHandlers(void) UINT X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, void *param ) { + INT gpu_count, adapter_count, monitor_count, current_adapter_count = 0; struct x11drv_adapter *adapters; struct gdi_monitor *monitors; struct x11drv_gpu *gpus; - INT gpu_count, adapter_count, monitor_count; INT gpu, adapter, monitor; DEVMODEW *modes; UINT mode_count; @@ -448,7 +448,7 @@ UINT X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage host_handler.free_monitors( monitors, monitor_count ); /* Get the settings handler id for the adapter */ - snprintf( buffer, sizeof(buffer), "\\\\.\\DISPLAY%d", adapter + 1 ); + snprintf( buffer, sizeof(buffer), "\\\\.\\DISPLAY%d", current_adapter_count + adapter + 1 ); asciiz_to_unicode( devname, buffer ); if (!settings_handler.get_id( devname, is_primary, &settings_id )) break; @@ -460,6 +460,7 @@ UINT X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage } } + current_adapter_count += adapter_count; host_handler.free_adapters( adapters ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7136