[PATCH 3/4] winex11.drv: Add a RandR provider ID property for GPUs.

Zhiyi Zhang zzhang at codeweavers.com
Fri Jun 12 02:21:13 CDT 2020


A RandR provider ID is needed to identify the corresponding GPU.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/winex11.drv/display.c | 13 ++++++++++++-
 dlls/winex11.drv/x11drv.h  |  2 ++
 dlls/winex11.drv/xrandr.c  |  2 ++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c
index 1dedf32a52f..0a8d809cc71 100644
--- a/dlls/winex11.drv/display.c
+++ b/dlls/winex11.drv/display.c
@@ -43,11 +43,12 @@ DEFINE_DEVPROPKEY(DEVPROPKEY_GPU_LUID, 0x60b193cb, 0x5276, 0x4d0f, 0x96, 0xfc, 0
 DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_GPU_LUID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 1);
 DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_OUTPUT_ID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 2);
 
-/* Wine specific monitor properties */
+/* Wine specific properties */
 DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_STATEFLAGS, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 2);
 DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCMONITOR, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 3);
 DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCWORK, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 4);
 DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 5);
+DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_GPU_RANDR_PROVIDER_ID, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5c, 2);
 
 static const WCHAR driver_date_dataW[] = {'D','r','i','v','e','r','D','a','t','e','D','a','t','a',0};
 static const WCHAR driver_descW[] = {'D','r','i','v','e','r','D','e','s','c',0};
@@ -357,6 +358,16 @@ static BOOL X11DRV_InitGpu(HDEVINFO devinfo, const struct x11drv_gpu *gpu, INT g
                                    (const BYTE *)&present, sizeof(present), 0))
         goto done;
 
+    /* Write WINE_DEVPROPKEY_GPU_RANDR_PROVIDER_ID property */
+    if (gpu->randr_provider_id)
+    {
+        TRACE("RandR provider ID: 0x%s.\n", wine_dbgstr_longlong(gpu->randr_provider_id));
+        if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_GPU_RANDR_PROVIDER_ID,
+                                       DEVPROP_TYPE_UINT64, (const BYTE *)&gpu->randr_provider_id,
+                                       sizeof(gpu->randr_provider_id), 0))
+            goto done;
+    }
+
     /* Write DEVPROPKEY_GPU_LUID property */
     if (!SetupDiGetDevicePropertyW(devinfo, &device_data, &DEVPROPKEY_GPU_LUID, &property_type,
                                    (BYTE *)&luid, sizeof(luid), NULL, 0))
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index a9eaed20cab..d9f8b250f51 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -690,6 +690,8 @@ struct x11drv_gpu
     UINT device_id;
     UINT subsys_id;
     UINT revision_id;
+    /* Optional RandR provider ID. If it's not supported, set it to zero */
+    UINT64 randr_provider_id;
 };
 
 /* Represent an adapter in EnumDisplayDevices context */
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index 76e76806c55..ce7efc9deb4 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -711,6 +711,7 @@ static BOOL xrandr14_get_gpus( struct x11drv_gpu **new_gpus, int *count )
     {
         WARN("XRandR implementation doesn't report any providers, faking one.\n");
         lstrcpyW( gpus[0].name, wine_adapterW );
+        gpus[0].randr_provider_id = 1;
         *new_gpus = gpus;
         *count = 1;
         ret = TRUE;
@@ -742,6 +743,7 @@ static BOOL xrandr14_get_gpus( struct x11drv_gpu **new_gpus, int *count )
         }
 
         gpus[i].id = provider_resources->providers[i];
+        gpus[i].randr_provider_id = provider_resources->providers[i];
         MultiByteToWideChar( CP_UTF8, 0, provider_info->name, -1, gpus[i].name, ARRAY_SIZE(gpus[i].name) );
         /* PCI IDs are all zero because there is currently no portable way to get it via XRandR. Some AMD drivers report
          * their PCI address in the name but many others don't */
-- 
2.25.1




More information about the wine-devel mailing list