diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 64f61d21e4d..b517e44e150 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -212,7 +212,12 @@ static BOOL X11DRV_desktop_get_gpus( struct x11drv_gpu **new_gpus, int *count ) gpu = heap_calloc( 1, sizeof(*gpu) ); if (!gpu) return FALSE; - lstrcpyW( gpu->name, wine_adapterW ); + if (!get_host_primary_gpu( gpu )) + { + WARN( "Failed to get host primary gpu.\n" ); + lstrcpyW( gpu->name, wine_adapterW ); + } + *new_gpus = gpu; *count = 1; return TRUE; diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 27876e02df0..3e9e4474d4c 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -259,6 +259,21 @@ RECT get_host_primary_monitor_rect(void) return rect; } +BOOL get_host_primary_gpu(struct x11drv_gpu *gpu) +{ + struct x11drv_gpu *gpus; + INT gpu_count; + + if (host_handler.get_gpus(&gpus, &gpu_count) && gpu_count) + { + *gpu = gpus[0]; + host_handler.free_gpus(gpus); + return TRUE; + } + + return FALSE; +} + RECT get_work_area(const RECT *monitor_rect) { Atom type; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 375fd1465fd..4a7a0e12d49 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -792,6 +792,7 @@ struct x11drv_display_device_handler }; extern HANDLE get_display_device_init_mutex(void) DECLSPEC_HIDDEN; +extern BOOL get_host_primary_gpu(struct x11drv_gpu *gpu) DECLSPEC_HIDDEN; extern void release_display_device_init_mutex(HANDLE) DECLSPEC_HIDDEN; extern void X11DRV_DisplayDevices_SetHandler(const struct x11drv_display_device_handler *handler) DECLSPEC_HIDDEN; extern void X11DRV_DisplayDevices_Init(BOOL force) DECLSPEC_HIDDEN;