Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Fix date format.
After some testing, it looks like the date is always stored in the MM-DD-YYYY format (and the format I initially used was just wrong).
dlls/winex11.drv/display.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 47e4733dba88..cf55a5c1fb67 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -51,6 +51,7 @@ DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCWORK, 0x233a9ef3, 0xafc4, 0x4abd, 0x DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 5);
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_dateW[] = {'D','r','i','v','e','r','D','a','t','e',0}; static const WCHAR driver_descW[] = {'D','r','i','v','e','r','D','e','s','c',0}; static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0}; static const WCHAR pciW[] = {'P','C','I',0}; @@ -107,6 +108,7 @@ static const WCHAR monitor_instance_fmtW[] = { static const WCHAR monitor_hardware_idW[] = { 'M','O','N','I','T','O','R','\', 'D','e','f','a','u','l','t','_','M','o','n','i','t','o','r',0,0}; +static const WCHAR driver_date_fmtW[] = {'%','u','-','%','u','-','%','u',0};
static struct x11drv_display_device_handler host_handler; struct x11drv_display_device_handler desktop_handler; @@ -403,14 +405,15 @@ static BOOL X11DRV_InitGpu(HDEVINFO devinfo, const struct x11drv_gpu *gpu, INT g SP_DEVINFO_DATA device_data = {sizeof(device_data)}; WCHAR instanceW[MAX_PATH]; DEVPROPTYPE property_type; + SYSTEMTIME systemtime; WCHAR bufferW[1024]; + FILETIME filetime; HKEY hkey = NULL; GUID guid; LUID luid; INT written; DWORD size; BOOL ret = FALSE; - FILETIME filetime;
TRACE("GPU id:0x%s name:%s.\n", wine_dbgstr_longlong(gpu->id), wine_dbgstr_w(gpu->name));
@@ -468,6 +471,11 @@ static BOOL X11DRV_InitGpu(HDEVINFO devinfo, const struct x11drv_gpu *gpu, INT g if (RegSetValueExW(hkey, driver_date_dataW, 0, REG_BINARY, (BYTE *)&filetime, sizeof(filetime))) goto done;
+ GetSystemTime(&systemtime); + sprintfW(bufferW, driver_date_fmtW, systemtime.wMonth, systemtime.wDay, systemtime.wYear); + if (RegSetValueExW(hkey, driver_dateW, 0, REG_SZ, (BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR))) + goto done; + RegCloseKey(hkey);
/* Retrieve driver value for adapters */
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- I picked the more or less current version of the AMD driver for the time being.
I think we should eventually move wined3d's GPU driver detection and override stuff to the display drivers (TBD how to share the code between the different drivers) so that everything has the same consistent view.
dlls/winex11.drv/display.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index cf55a5c1fb67..918339b05f31 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -53,6 +53,7 @@ DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, 0x233a9ef3, 0xafc4, 0x4ab 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_dateW[] = {'D','r','i','v','e','r','D','a','t','e',0}; static const WCHAR driver_descW[] = {'D','r','i','v','e','r','D','e','s','c',0}; +static const WCHAR driver_versionW[] = {'D','r','i','v','e','r','V','e','r','s','i','o','n',0}; static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0}; static const WCHAR pciW[] = {'P','C','I',0}; static const WCHAR video_idW[] = {'V','i','d','e','o','I','D',0}; @@ -109,6 +110,7 @@ static const WCHAR monitor_hardware_idW[] = { 'M','O','N','I','T','O','R','\', 'D','e','f','a','u','l','t','_','M','o','n','i','t','o','r',0,0}; static const WCHAR driver_date_fmtW[] = {'%','u','-','%','u','-','%','u',0}; +static const WCHAR driver_version_fallbackW[] ={'2','6','.','2','0','.','1','5','0','0','2','.','6','1',0};
static struct x11drv_display_device_handler host_handler; struct x11drv_display_device_handler desktop_handler; @@ -476,6 +478,10 @@ static BOOL X11DRV_InitGpu(HDEVINFO devinfo, const struct x11drv_gpu *gpu, INT g if (RegSetValueExW(hkey, driver_dateW, 0, REG_SZ, (BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR))) goto done;
+ if (RegSetValueExW(hkey, driver_versionW, 0, REG_SZ, (const BYTE *)driver_version_fallbackW, + sizeof(driver_version_fallbackW))) + goto done; + RegCloseKey(hkey);
/* Retrieve driver value for adapters */
On 10/1/20 5:01 PM, Matteo Bruni wrote:
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
I picked the more or less current version of the AMD driver for the time being.
I think we should eventually move wined3d's GPU driver detection and override stuff to the display drivers (TBD how to share the code between the different drivers) so that everything has the same consistent view.
Hi Matteo,
I would prefer making the move now. There are other bugs that rely on this as well. For example, some games need a consistent GPU name in DXGI and SetupAPI. As to how to share the code, what about something like a include/wine/wine_gpu_db.h header? I am thinking keeping the existing GPU detection code in wined3d there and only move the PCI ID related tables to wine_gpu_db.h. What do you think?
Thanks, Zhiyi
dlls/winex11.drv/display.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index cf55a5c1fb67..918339b05f31 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -53,6 +53,7 @@ DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, 0x233a9ef3, 0xafc4, 0x4ab 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_dateW[] = {'D','r','i','v','e','r','D','a','t','e',0}; static const WCHAR driver_descW[] = {'D','r','i','v','e','r','D','e','s','c',0}; +static const WCHAR driver_versionW[] = {'D','r','i','v','e','r','V','e','r','s','i','o','n',0}; static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0}; static const WCHAR pciW[] = {'P','C','I',0}; static const WCHAR video_idW[] = {'V','i','d','e','o','I','D',0}; @@ -109,6 +110,7 @@ static const WCHAR monitor_hardware_idW[] = { 'M','O','N','I','T','O','R','\', 'D','e','f','a','u','l','t','_','M','o','n','i','t','o','r',0,0}; static const WCHAR driver_date_fmtW[] = {'%','u','-','%','u','-','%','u',0}; +static const WCHAR driver_version_fallbackW[] ={'2','6','.','2','0','.','1','5','0','0','2','.','6','1',0};
static struct x11drv_display_device_handler host_handler; struct x11drv_display_device_handler desktop_handler; @@ -476,6 +478,10 @@ static BOOL X11DRV_InitGpu(HDEVINFO devinfo, const struct x11drv_gpu *gpu, INT g if (RegSetValueExW(hkey, driver_dateW, 0, REG_SZ, (BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR))) goto done;
if (RegSetValueExW(hkey, driver_versionW, 0, REG_SZ, (const BYTE *)driver_version_fallbackW,
sizeof(driver_version_fallbackW)))
goto done;
RegCloseKey(hkey);
/* Retrieve driver value for adapters */
On Mon, 5 Oct 2020 at 08:28, Zhiyi Zhang zzhang@codeweavers.com wrote:
On 10/1/20 5:01 PM, Matteo Bruni wrote:
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
I picked the more or less current version of the AMD driver for the time being.
I think we should eventually move wined3d's GPU driver detection and override stuff to the display drivers (TBD how to share the code between the different drivers) so that everything has the same consistent view.
Hi Matteo,
I would prefer making the move now. There are other bugs that rely on this as well. For example, some games need a consistent GPU name in DXGI and SetupAPI. As to how to share the code, what about something like a include/wine/wine_gpu_db.h header? I am thinking keeping the existing GPU detection code in wined3d there and only move the PCI ID related tables to wine_gpu_db.h. What do you think?
That's probably decent enough for a start, but note that ideally we'd be able to update GPU information independently from the source code. I.e., in the long term it may make more sense to move the GPU information DB to e.g. the registry.
On Mon, Oct 5, 2020 at 12:57 PM Henri Verbeet hverbeet@gmail.com wrote:
On Mon, 5 Oct 2020 at 08:28, Zhiyi Zhang zzhang@codeweavers.com wrote:
On 10/1/20 5:01 PM, Matteo Bruni wrote:
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
I picked the more or less current version of the AMD driver for the time being.
I think we should eventually move wined3d's GPU driver detection and override stuff to the display drivers (TBD how to share the code between the different drivers) so that everything has the same consistent view.
Hi Matteo,
I would prefer making the move now. There are other bugs that rely on this as well. For example, some games need a consistent GPU name in DXGI and SetupAPI. As to how to share the code, what about something like a include/wine/wine_gpu_db.h header? I am thinking keeping the existing GPU detection code in wined3d there and only move the PCI ID related tables to wine_gpu_db.h. What do you think?
That's probably decent enough for a start, but note that ideally we'd be able to update GPU information independently from the source code. I.e., in the long term it may make more sense to move the GPU information DB to e.g. the registry.
Sounds okay to me as well. My main concern with centralizing the GPU detection stuff is that, at the moment, wined3d allows overriding the advertised GPU [*] but, obviously, the display driver knows nothing about that. Also wined3d has some complex GPU detection code for both GL and Vulkan, while winex11 has recently got a VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2 path to basically gather the same info. That's a bit of code duplication at best and a potential source of trouble at worst. It feels like, eventually, the whole GPU detection / info gathering should be handled by the display driver. I guess the code could reside in wined3d, although something will need to be reworked (e.g. to avoid a loop like "display driver initialization" -> "wined3d GPU detection" -> "create a WGL / Vulkan context on a win32 window" -> "display driver initialization"). But that's a possible longer term plan. Creating a shared GPU info DB seems like a good first step.
[*]: Overriding the GPU is a bit of a hack but, unfortunately, one that we'll need to have around for the foreseeable future to support a number of games.
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Report NVIDIA as the provider when the vendor ID matches (as suggested by Paul).
dlls/winex11.drv/display.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 918339b05f31..a2692e88ef62 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -54,6 +54,7 @@ static const WCHAR driver_date_dataW[] = {'D','r','i','v','e','r','D','a','t','e static const WCHAR driver_dateW[] = {'D','r','i','v','e','r','D','a','t','e',0}; static const WCHAR driver_descW[] = {'D','r','i','v','e','r','D','e','s','c',0}; static const WCHAR driver_versionW[] = {'D','r','i','v','e','r','V','e','r','s','i','o','n',0}; +static const WCHAR provider_nameW[] = {'P','r','o','v','i','d','e','r','N','a','m','e',0}; static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0}; static const WCHAR pciW[] = {'P','C','I',0}; static const WCHAR video_idW[] = {'V','i','d','e','o','I','D',0}; @@ -111,6 +112,8 @@ static const WCHAR monitor_hardware_idW[] = { 'D','e','f','a','u','l','t','_','M','o','n','i','t','o','r',0,0}; static const WCHAR driver_date_fmtW[] = {'%','u','-','%','u','-','%','u',0}; static const WCHAR driver_version_fallbackW[] ={'2','6','.','2','0','.','1','5','0','0','2','.','6','1',0}; +static const WCHAR provider_name_amdW[] ={'A','d','v','a','n','c','e','d',' ','M','i','c','r','o',' ','D','e','v','i','c','e','s',',',' ','I','n','c','.',0}; +static const WCHAR provider_name_nvidiaW[] ={'N','V','I','D','I','A',0};
static struct x11drv_display_device_handler host_handler; struct x11drv_display_device_handler desktop_handler; @@ -482,6 +485,19 @@ static BOOL X11DRV_InitGpu(HDEVINFO devinfo, const struct x11drv_gpu *gpu, INT g sizeof(driver_version_fallbackW))) goto done;
+ if (gpu->vendor_id == 0x10de) + { + if (RegSetValueExW(hkey, provider_nameW, 0, REG_SZ, (const BYTE *)provider_name_nvidiaW, + sizeof(provider_name_nvidiaW))) + goto done; + } + else + { + if (RegSetValueExW(hkey, provider_nameW, 0, REG_SZ, (const BYTE *)provider_name_amdW, + sizeof(provider_name_amdW))) + goto done; + } + RegCloseKey(hkey);
/* Retrieve driver value for adapters */
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/winex11.drv/display.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index a2692e88ef62..acbd46775ceb 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -756,6 +756,12 @@ void X11DRV_DisplayDevices_Init(BOOL force)
for (gpu = 0; gpu < gpu_count; gpu++) { + /* Default to an AMD Radeon RX 5700 */ + if (!gpus[gpu].vendor_id) + gpus[gpu].vendor_id = 0x1002; + if (!gpus[gpu].device_id) + gpus[gpu].device_id = 0x731f; + if (!X11DRV_InitGpu(gpu_devinfo, &gpus[gpu], gpu, guidW, driverW, &gpu_luid)) goto done;