On the Linux boxes I tested, reading scaling_cur_freq usually takes about 12 ms per core.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47128 Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- FWIW it looks like the kernel does some kind of optimization and returns "immediately" if the file is accessed often enough (possibly faster than once per second?)
Heroes of the Storm calls NtPowerInformation() on the main rendering thread about once per second and, with enough cores, it means stalling the whole game for pretty sizeable amounts of time.
dlls/ntdll/unix/system.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 681d56a869f4..3756bd7cee03 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2907,11 +2907,12 @@ NTSTATUS WINAPI NtPowerInformation( POWER_INFORMATION_LEVEL level, void *input, FILE* f;
for(i = 0; i < out_cpus; i++) { - sprintf(filename, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", i); + sprintf(filename, "/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", i); f = fopen(filename, "r"); - if (f && (fscanf(f, "%d", &cpu_power[i].CurrentMhz) == 1)) { - cpu_power[i].CurrentMhz /= 1000; + if (f && (fscanf(f, "%d", &cpu_power[i].MaxMhz) == 1)) { + cpu_power[i].MaxMhz /= 1000; fclose(f); + cpu_power[i].CurrentMhz = cpu_power[i].MaxMhz; } else { if(i == 0) { @@ -2921,16 +2922,6 @@ NTSTATUS WINAPI NtPowerInformation( POWER_INFORMATION_LEVEL level, void *input, } else cpu_power[i].CurrentMhz = cpu_power[0].CurrentMhz; - if(f) fclose(f); - } - - sprintf(filename, "/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", i); - f = fopen(filename, "r"); - if (f && (fscanf(f, "%d", &cpu_power[i].MaxMhz) == 1)) { - cpu_power[i].MaxMhz /= 1000; - fclose(f); - } - else { cpu_power[i].MaxMhz = cpu_power[i].CurrentMhz; if(f) fclose(f); }
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Kind-of a fix for ef36a25aec33670cd2099e4bce379bd6e2ac42a0.
include/d3dx10core.idl | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/d3dx10core.idl b/include/d3dx10core.idl index c99ab82eb71d..88f13d07650e 100644 --- a/include/d3dx10core.idl +++ b/include/d3dx10core.idl @@ -71,4 +71,5 @@ cpp_quote(" HMODULE swrast, unsigned int flags, ID3D10Device **device);") cpp_quote("HRESULT WINAPI D3DX10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type,") cpp_quote(" HMODULE swrast, unsigned int flags, DXGI_SWAP_CHAIN_DESC *desc, IDXGISwapChain **swapchain,") cpp_quote(" ID3D10Device **device);") +interface ID3D10Device1; cpp_quote("HRESULT WINAPI D3DX10GetFeatureLevel1(ID3D10Device *device, ID3D10Device1 **device1);")
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- include/d3dx10math.h | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
diff --git a/include/d3dx10math.h b/include/d3dx10math.h index a96784b10893..c8bcfd2ce4e1 100644 --- a/include/d3dx10math.h +++ b/include/d3dx10math.h @@ -32,10 +32,65 @@ typedef enum _D3DX_CPU_OPTIMIZATION D3DX_SSE_OPTIMIZED } D3DX_CPU_OPTIMIZATION;
+typedef struct D3DXFLOAT16 +{ +#ifdef __cplusplus + D3DXFLOAT16(); + D3DXFLOAT16(float f); + D3DXFLOAT16(const D3DXFLOAT16 &f); + + operator float(); + + BOOL operator==(const D3DXFLOAT16 &f) const; + BOOL operator!=(const D3DXFLOAT16 &f) const; +#endif + WORD value; +} D3DXFLOAT16, *LPD3DXFLOAT16; + +typedef struct D3DXCOLOR +{ +#ifdef __cplusplus +public: + D3DXCOLOR(){}; + D3DXCOLOR(UINT color); + D3DXCOLOR(const float *color); + D3DXCOLOR(const D3DXFLOAT16 *color); + D3DXCOLOR(float r, float g, float b, float a); + + operator UINT() const; + operator float *(); + operator const float *() const; + + D3DXCOLOR & operator+=(const D3DXCOLOR &color); + D3DXCOLOR & operator-=(const D3DXCOLOR &color); + D3DXCOLOR & operator*=(float n); + D3DXCOLOR & operator/=(float n); + + D3DXCOLOR operator+() const; + D3DXCOLOR operator-() const; + + D3DXCOLOR operator+(const D3DXCOLOR &color) const; + D3DXCOLOR operator-(const D3DXCOLOR &color) const; + D3DXCOLOR operator*(float n) const; + D3DXCOLOR operator/(float n) const; + + friend D3DXCOLOR operator*(float n, const D3DXCOLOR &color); + + BOOL operator==(const D3DXCOLOR &color) const; + BOOL operator!=(const D3DXCOLOR &color) const; +#endif + float r, g, b, a; +} D3DXCOLOR, *LPD3DXCOLOR; + #ifdef __cplusplus extern "C" { #endif
+D3DXCOLOR *D3DXColorAdd(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2); +D3DXCOLOR *D3DXColorLerp(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2, float s); +D3DXCOLOR *D3DXColorModulate(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2); +D3DXCOLOR *D3DXColorScale(D3DXCOLOR *out, D3DXCOLOR c, float s); +D3DXCOLOR *D3DXColorSubtract(D3DXCOLOR *out, D3DXCOLOR c1, D3DXCOLOR c2); D3DX_CPU_OPTIMIZATION WINAPI D3DXCpuOptimizations(BOOL enable);
#ifdef __cplusplus
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/user32/sysparams.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index d4462e589e8a..52a32d5e1c59 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -313,6 +313,7 @@ static const WCHAR GUID_DEVINTERFACE_MONITOR[] = {'#','{','e','6','f','0','7','b /* Cached monitor information */ static MONITORINFOEXW *monitors; static UINT monitor_count; +static DWORD last_cache_check_time; static FILETIME last_query_monitors_time; static CRITICAL_SECTION monitors_section; static CRITICAL_SECTION_DEBUG monitors_critsect_debug = @@ -3952,13 +3953,19 @@ static BOOL update_monitor_cache(void) DWORD i = 0, j; DWORD type;
+ if (monitor_count && GetTickCount() - last_cache_check_time < 1000) + return TRUE; + /* Update monitor cache from SetupAPI if it's outdated */ if (!video_key && RegOpenKeyW( HKEY_LOCAL_MACHINE, VIDEO_KEY, &video_key )) return FALSE; if (RegQueryInfoKeyW( video_key, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &filetime )) return FALSE; if (CompareFileTime( &filetime, &last_query_monitors_time ) < 1) + { + last_cache_check_time = GetTickCount(); return TRUE; + }
mutex = get_display_device_init_mutex(); EnterCriticalSection( &monitors_section ); @@ -4020,6 +4027,7 @@ static BOOL update_monitor_cache(void) }
last_query_monitors_time = filetime; + last_cache_check_time = GetTickCount(); ret = TRUE; fail: SetupDiDestroyDeviceInfoList( devinfo );
On 7/24/20 5:14 PM, Matteo Bruni wrote:
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
dlls/user32/sysparams.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index d4462e589e8a..52a32d5e1c59 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -313,6 +313,7 @@ static const WCHAR GUID_DEVINTERFACE_MONITOR[] = {'#','{','e','6','f','0','7','b /* Cached monitor information */ static MONITORINFOEXW *monitors; static UINT monitor_count; +static DWORD last_cache_check_time; static FILETIME last_query_monitors_time; static CRITICAL_SECTION monitors_section; static CRITICAL_SECTION_DEBUG monitors_critsect_debug = @@ -3952,13 +3953,19 @@ static BOOL update_monitor_cache(void) DWORD i = 0, j; DWORD type;
if (monitor_count && GetTickCount() - last_cache_check_time < 1000)
return TRUE;
/* Update monitor cache from SetupAPI if it's outdated */ if (!video_key && RegOpenKeyW( HKEY_LOCAL_MACHINE, VIDEO_KEY, &video_key )) return FALSE; if (RegQueryInfoKeyW( video_key, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &filetime )) return FALSE; if (CompareFileTime( &filetime, &last_query_monitors_time ) < 1)
{
last_cache_check_time = GetTickCount(); return TRUE;
}
mutex = get_display_device_init_mutex(); EnterCriticalSection( &monitors_section );
@@ -4020,6 +4027,7 @@ static BOOL update_monitor_cache(void) }
last_query_monitors_time = filetime;
- last_cache_check_time = GetTickCount(); ret = TRUE;
fail: SetupDiDestroyDeviceInfoList( devinfo );
I think this will cause a bunch of test failures if monitor changes are not reflected immediately. The real overhead here is the wine server calls, which would need something like a wine server using shared memory to reduce latency.
Another way that might be acceptable is resetting last_cache_check_time in ChangeDisplaySettingsExW() when the current display mode is changed. So for at least the current process, the changes are reflected immediately. The downside is that other processes might have a 1 second delay, but that might be okay because before this monitor cache is implemented, other processes are not aware of the monitor changes happened in another process at all, and it seemed to be working fine at the time.
Thanks, Zhiyi
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76039
Your paranoid android.
=== debiant (32 bit report) ===
user32: monitor: Timeout msg: Timeout resource: Timeout scroll: Timeout static: Timeout sysparams: Timeout text: Timeout uitools: Timeout win: Timeout winstation: Timeout
=== debiant (build log) ===
0024:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0024:err:winediag:nodrv_CreateWindow The explorer process failed to start. Task: WineTest did not produce the win32_zh_CN report
=== debiant (32 bit WoW report) ===
user32: monitor: Timeout msg: Timeout resource: Timeout scroll: Timeout static: Timeout sysparams: Timeout text: Timeout uitools: Timeout win: Timeout winstation: Timeout
=== debiant (build log) ===
0024:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0024:err:winediag:nodrv_CreateWindow The explorer process failed to start. Task: WineTest did not produce the wow64 report
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Unnecessary since 293e2b55ad3949dd81ea3b63603339bb5fc5ad06: we're including initguid.h because we need to expose different variants of ID3D11ShaderReflection depending on the d3dcompiler_xx version.
This patch was suggested by Zebediah Figura on IRC, now many months ago.
dlls/d3dcompiler_43/Makefile.in | 1 - dlls/d3dcompiler_43/reflection.c | 1 - 2 files changed, 2 deletions(-)
diff --git a/dlls/d3dcompiler_43/Makefile.in b/dlls/d3dcompiler_43/Makefile.in index d273e278c3b8..8464113cd15d 100644 --- a/dlls/d3dcompiler_43/Makefile.in +++ b/dlls/d3dcompiler_43/Makefile.in @@ -1,5 +1,4 @@ MODULE = d3dcompiler_43.dll -IMPORTS = dxguid uuid EXTRADEFS = -DD3D_COMPILER_VERSION=43
EXTRADLLFLAGS = -mno-cygwin diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c index b29db47c71ea..7a8af39b07d1 100644 --- a/dlls/d3dcompiler_43/reflection.c +++ b/dlls/d3dcompiler_43/reflection.c @@ -20,7 +20,6 @@
#include "initguid.h" #include "d3dcompiler_private.h" -#include "winternl.h" #include "d3d10.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76040
Your paranoid android.
=== debiant (32 bit report) ===
user32: monitor: Timeout msg: Timeout resource: Timeout scroll: Timeout static: Timeout sysparams: Timeout text: Timeout uitools: Timeout win: Timeout winstation: Timeout
=== debiant (build log) ===
0024:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0024:err:winediag:nodrv_CreateWindow The explorer process failed to start. Task: WineTest did not produce the win32_zh_CN report
=== debiant (32 bit WoW report) ===
user32: monitor: Timeout
=== debiant (64 bit WoW report) ===
user32: input.c:2514: Test failed: 4: Unexpected cursor movement input.c:2514: Test failed: 5: Unexpected cursor movement input.c:2514: Test failed: 6: Unexpected cursor movement input.c:2514: Test failed: 7: Unexpected cursor movement input.c:2514: Test failed: 8: Unexpected cursor movement input.c:2235: Test failed: 9: foreground process expected WM_MOUSEMOVE message input.c:2514: Test failed: 9: Unexpected cursor movement input.c:2235: Test failed: 10: foreground process expected WM_MOUSEMOVE message input.c:2514: Test failed: 10: Unexpected cursor movement input.c:2235: Test failed: 11: foreground process expected WM_MOUSEMOVE message input.c:2514: Test failed: 11: Unexpected cursor movement input.c:2235: Test failed: 12: foreground process expected WM_MOUSEMOVE message input.c:2514: Test failed: 12: Unexpected cursor movement input.c:2514: Test failed: 13: Unexpected cursor movement input.c:2514: Test failed: 14: Unexpected cursor movement input.c:2514: Test failed: 15: Unexpected cursor movement input.c:2514: Test failed: 16: Unexpected cursor movement monitor: Timeout msg: Timeout resource: Timeout scroll: Timeout static: Timeout sysparams: Timeout text: Timeout uitools: Timeout win: Timeout winstation: Timeout