Rémi Bernon : user32: Throttle device list updates from GetRawInputDeviceList.

Alexandre Julliard julliard at winehq.org
Wed Dec 15 14:25:57 CST 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Dec 14 21:24:23 2021 +0100

user32: Throttle device list updates from GetRawInputDeviceList.

Up to once every 2s.

This fixes a regression from c2c78a2fe0ac13e4fca7ab4c17977b65e358485c,
which caused severe FPS drop in Samurai Shodown.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51282
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/rawinput.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 2660874d12c..f3dc4ae67de 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -418,7 +418,8 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
  */
 UINT WINAPI GetRawInputDeviceList(RAWINPUTDEVICELIST *devices, UINT *device_count, UINT size)
 {
-    UINT i;
+    static UINT last_check;
+    UINT i, ticks = GetTickCount();
 
     TRACE("devices %p, device_count %p, size %u.\n", devices, device_count, size);
 
@@ -434,7 +435,11 @@ UINT WINAPI GetRawInputDeviceList(RAWINPUTDEVICELIST *devices, UINT *device_coun
         return ~0U;
     }
 
-    rawinput_update_device_list();
+    if (ticks - last_check > 2000)
+    {
+        last_check = ticks;
+        rawinput_update_device_list();
+    }
 
     if (!devices)
     {




More information about the wine-cvs mailing list