winex11.drv: Report a GPU same as the host primary GPU in virtual desktop mode.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49631
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-08-17 16:36:23 +08:00 committed by Alexandre Julliard
parent 41acd014d8
commit aadae4d1ea
3 changed files with 22 additions and 1 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;