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

Alexandre Julliard julliard at winehq.org
Tue Aug 18 16:34:23 CDT 2020


Module: wine
Branch: master
Commit: aadae4d1ea173dfa30e09d6cc816bb174e35f90d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=aadae4d1ea173dfa30e09d6cc816bb174e35f90d

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Mon Aug 17 16:36:23 2020 +0800

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winex11.drv/desktop.c |  7 ++++++-
 dlls/winex11.drv/display.c | 15 +++++++++++++++
 dlls/winex11.drv/x11drv.h  |  1 +
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c
index 64f61d21e4..b517e44e15 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 27876e02df..3e9e4474d4 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 375fd1465f..4a7a0e12d4 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;




More information about the wine-cvs mailing list