https://bugs.winehq.org/show_bug.cgi?id=55262
Bug ID: 55262 Summary: [POTENTIAL PERFORMANCE BOOST] [POTENTIAL CPU USAGE REDUCTION] [PATCH PROVIDED] SIMPLE CODE CHANGE FOUND TO BOOST FPS AND SEVERELY DECREASE CPU USAGE CAUSED BY "wined3d_cs_run" Product: Wine Version: 8.11 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: d3d Assignee: wine-bugs@winehq.org Reporter: CHECK_1234543212345@protonmail.com CC: z.figura12@gmail.com Distribution: ---
Created attachment 74878 --> https://bugs.winehq.org/attachment.cgi?id=74878 WINED3D_CS_QUERY_POLL_INTERVAL_from_10u_to_200000u_remove_high_cpu_usage_caused_by_WINED3D_CS_SPIN_COUNT.patch
⬤ FOUND CODE THAT CAN BE CHANGED TO BOOST FPS AND REDUCE CPU USAGE CAUSED BY "wined3d_cs_run" BY ALOT
- A way to boost FPS by increasing number of "WINED3D_CS_QUERY_POLL_INTERVAL" has been FOUND!!!
- A way to reduce the CPU USAGE caused by "wined3d_cs_run" has been FOUND!!!
⬤ SETTINGS: - Default Wine 8.11 - Ryzen 7 1700 locked to 2.5GHZ (to keep fps stable) - RX 580 locked CORE/MEMORY locked to 300MHZ (echo "low" > /sys/class/drm/card0/device/power_dpm_force_performance_level) (to keep fps stable) - Window Manager: OpenBox - Compositor: No Compositor, Xorg TearFree Disabled - 16 bit color used to boost FPS - Used Wine to run the Windows version of Steam to run these games - "perf top" command used to see overhead caused by "wined3d_cs_run" - DXVK not used
⬤ GAMES USED: - Grapple (Free) (Heavy on GPU) (https://store.steampowered.com/app/1428870/Grapple/) - Brawlhalla (Free) (Light on GPU) (https://store.steampowered.com/app/291550/Brawlhalla/)
⬤ RESULTS: --------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 10u (Wine Default) WINED3D_CS_SPIN_COUNT 10000000u (Wine Default) Grapple Level 1: 89 FPS Brawlhalla Character Select CPU USAGE: 130.2% Brawlhalla "perf top" wined3d_cs_run overhead: 63.12% ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 10u (Wine Default) WINED3D_CS_SPIN_COUNT 10000u Grapple Level 1: 89 FPS Brawlhalla Character Select CPU USAGE: 42.8% Brawlhalla "perf top" wined3d_cs_run overhead: 1.50% ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 10u (Wine Default) WINED3D_CS_SPIN_COUNT 1000u Grapple Level 1: 86 FPS Brawlhalla Character Select CPU USAGE: 41.1% Brawlhalla "perf top" wined3d_cs_run overhead: 0.43% ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 100u WINED3D_CS_SPIN_COUNT 1000u Grapple Level 1: 91 FPS ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 1000u WINED3D_CS_SPIN_COUNT 1000u Grapple Level 1: 94 FPS ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 10000u WINED3D_CS_SPIN_COUNT 1000u Grapple Level 1: 94-95 FPS ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 100000u WINED3D_CS_SPIN_COUNT 1000u Grapple Level 1: 94-95 FPS ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 200000u WINED3D_CS_SPIN_COUNT 1000u Grapple Level 1: 94-95 FPS Brawlhalla Character Select CPU USAGE: 41.0% Brawlhalla "perf top" wined3d_cs_run overhead: 0.40% ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 200000u WINED3D_CS_SPIN_COUNT 10000000u (Wine Default) Grapple Level 1: 94-95 FPS Brawlhalla Character Select CPU USAGE: 130.2% Brawlhalla "perf top" wined3d_cs_run overhead: 63.07% ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 250000u WINED3D_CS_SPIN_COUNT 1000u Grapple Level 1: 94 FPS ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 300000u WINED3D_CS_SPIN_COUNT 1000u Grapple Level 1: 94 FPS ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 1000000u WINED3D_CS_SPIN_COUNT 1000u Grapple Level 1: 93-94 FPS ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- WINED3D_CS_QUERY_POLL_INTERVAL 10000000u WINED3D_CS_SPIN_COUNT 1000u Grapple Level 1: 52 FPS ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- 2nd BEST: WINED3D_CS_QUERY_POLL_INTERVAL 200000u WINED3D_CS_SPIN_COUNT 1u Grapple Level 1: 96 FPS Brawlhalla Character Select CPU USAGE: 40.7% Brawlhalla "perf top" wined3d_cs_run overhead: "wined3d_cs_run" overhead too low, not able to see ---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- BEST: PATCH PROVIDED WINED3D_CS_QUERY_POLL_INTERVAL 200000u "++spin_count >= WINED3D_CS_SPIN_COUNT && " removed in "dlls/wind3d/cs.c" Grapple Level 1: 96 FPS Brawlhalla Character Select CPU USAGE: 39.1% Brawlhalla "perf top" wined3d_cs_run overhead: "wined3d_cs_run" overhead too low, not able to see ---------------------------------------------------------------------------------------------------------------
⬤ CONCLUSION:
- 1. Increasing "WINED3D_CS_QUERY_POLL_INTERVAL" from "10u" to "200000u" BOOSTED the FPS!!!
- 2. Decreasing "WINED3D_CS_SPIN_COUNT" from "10000000u" to "1u" or removing "++spin_count >= WINED3D_CS_SPIN_COUNT && " in "dlls/wind3d/cs.c" fixes what causes games that are light on the GPU to have high CPU USAGE caused by "wined3d_cs_run" when checking using "perf top"!!!
- 3. I also tested other games and saw reduced CPU Usage by alot because of "wined3d_cs_run" now taking less CPU USAGE!!!
- 4. HOPEFULLY A DEVELOPER SEES THIS SO THAT THIS COULD BE APPLIED INTO WINE, CHANGING THOSE CODE GAVE A GOOD FPS BOOST AND REDUCED CPU USAGE CAUSED BY "wined3d_cs_run"!!!
- 5. I have not checked if changing those code increases the FPS when using DXVK
⬤ HOW TO APPLY PATCH:
- 1. "cd" into wine source code
- 2. do "patch -p0 < WINED3D_CS_QUERY_POLL_INTERVAL_from_10u_to_200000u_remove_high_cpu_usage_caused_by_WINED3D_CS_SPIN_COUNT.patch"