I've recently finally got my computer's MouseTester graphs stable with my dav3pro at 8000Hz. When I was digging into the last bits of jitter, I noticed in Windows Performance Aanalyzer that atieclxx.exe, a part of AMD's External Events Utility that is required for FreeSync and other things, calls `GetRawInputData` constantly. Killing that thread in particular fixes the MouseTester graphs, but also breaks FreeSync.
I threw the .exe into Ghidra and found the attached processing loop. Seems that atieclxx does calculations for Radeon Boost/Chill even with those features disabled, like getting the euclidean magnitude of mouse inputs. The `QueryPerformanceCounter` call I believe is needed for FreeSync, and is luckily cheap.
Regardless, turned out to be very easy to just NOP-out the RegisterRawInputDevices and GetRawInputData calls, for FreeSync without mouse input interference. Attached is a python script I made to patch atieclxx.exe automatically; it's also on my gitlab but I'm apparently not allowed to link there?
Note that you may need to use a tool like AdvancedRun to replace the .exe in C:\Windows\System32\DriverStore since it's owned by TrustedInstaller, or use a tool like RadeonSoftwareSlimmer to unpack and clean the installer.
Edit:
To run the script:
1: Install python 3.
2: In a normal cmd/powershell prompt run "pip install pefile" to install pefile, a required dependency of the script.
3: Open Task Manager, go to the Details tab, right-click atieclxx.exe and click Properties to find where it is, then end the task.
4: Extract patch_atieclxx.py from the attached zip and copy atieclxx.exe into the same directory.
5: Go to that directory in a cmd/powershell prompt with cd, or by holding shift and right-clicking in the directory and choosing "Open PowerShell window here".
6: Run "py patch_atieclxx.py" in that prompt to patch the exe.
7: Use a tool like nirsoft's Advanced Run to open any tool that can copy a file (other than explorer.exe) as TrustedInstaller; personally I love Everything search.
8: Copy the patched atieclxx.exe back to its original location.
9: Restart the "AMD External Events Utility" in Services, or restart the computer.
Alternatively after step 3, you can set the INPATH and OUTPATH variables in the script to where your used atieclxx.exe is, then run cmd/powershell as TrustedInstaller, cd do the script's location, and run it from there. Just be very very careful when running anything as TrustedInstaller.
[Radeon+MouseHz Interference] atieclxx calls GetRawInputData causing mouse jitter - patched w/ python!
[Radeon+MouseHz Interference] atieclxx calls GetRawInputData causing mouse jitter - patched w/ python!
- Attachments
-
- patch_atieclxx.zip
- (1.06 KiB) Downloaded 103 times
-
- Screenshot 2024-02-22 005532.png (121.24 KiB) Viewed 5674 times
Last edited by Aeodyn on 13 Mar 2024, 19:03, edited 1 time in total.
- Chief Blur Buster
- Site Admin
- Posts: 11680
- Joined: 05 Dec 2013, 15:44
- Location: Toronto / Hamilton, Ontario, Canada
- Contact:
[Radeon+MouseHz Interference] Re: atieclxx calls GetRawInputData causing mouse jitter - patched w/ python!
Your tweak may be a very interesting improvement for high-Hz mouse users on AMD systems!
As you get more posts, this restriction will get removed (typically after the 3rd post approved).
May you post the URL but replace the periods with spaces? Like www gitlab com/etc/etc
This is due to spammers that the forum software doesn't let new members post URLs.
As you get more posts, this restriction will get removed (typically after the 3rd post approved).
May you post the URL but replace the periods with spaces? Like www gitlab com/etc/etc
Head of Blur Busters - BlurBusters.com | TestUFO.com | Follow @BlurBusters on Twitter
Forum Rules wrote: 1. Rule #1: Be Nice. This is published forum rule #1. Even To Newbies & People You Disagree With!
2. Please report rule violations If you see a post that violates forum rules, then report the post.
3. ALWAYS respect indie testers here. See how indies are bootstrapping Blur Busters research!
[Radeon+MouseHz Interference] atieclxx calls GetRawInputData causing mouse jitter - patched w/ python!
Ah gotcha, sure! Didn't want to evade a rule or anything.Chief Blur Buster wrote: ↑01 Mar 2024, 19:59This is due to spammers that the forum software doesn't let new members post URLs.
May you post the URL but replace the periods with spaces? Like www gitlab com/etc/etc
https://www.gitlab.com/Aeodyn/amdpatch
[Edit by Chief Blur Buster -- Converted to Clicky]
- Chief Blur Buster
- Site Admin
- Posts: 11680
- Joined: 05 Dec 2013, 15:44
- Location: Toronto / Hamilton, Ontario, Canada
- Contact:
[Radeon+MouseHz Interference] atieclxx calls GetRawInputData causing mouse jitter - patched w/ python!
We have discovered that sometimes there's interference between FreeSync and a high-Hz mouse.Aeodyn wrote: ↑01 Mar 2024, 20:03Ah gotcha, sure! Didn't want to evade a rule or anything.
https://www.gitlab.com/Aeodyn/amdpatch
I wonder if this is one of the bigger causes of the interference? I'll have to forward this to an AMD engineer.
With a mouse running at 8000Hz, there are some critical loop weak links that needs optimizing on a system.
Head of Blur Busters - BlurBusters.com | TestUFO.com | Follow @BlurBusters on Twitter
Forum Rules wrote: 1. Rule #1: Be Nice. This is published forum rule #1. Even To Newbies & People You Disagree With!
2. Please report rule violations If you see a post that violates forum rules, then report the post.
3. ALWAYS respect indie testers here. See how indies are bootstrapping Blur Busters research!
Re: [Radeon+MouseHz Interference] atieclxx calls GetRawInputData causing mouse jitter - patched w/ python!
Bad programming strikes again.
I noticed same behaviour on my setup (Radeon Software 24.2.1, latest version). When you check the stack that calls this subroutine unconditionally, it is possible to follow it until the function that initializes the actual driver. Driver checks the OS, enumerates the GPU version and does more but doesn't check if Radeon Boost or Chill is activated. So this subroutine that calls GetRawInputData() works all the time, in a do...while(true) loop. My educated guess is, it calculates mouse movement delta which is needed for Radeon Boost and Chill. They need to add a condition to check if those are enabled.
I noticed same behaviour on my setup (Radeon Software 24.2.1, latest version). When you check the stack that calls this subroutine unconditionally, it is possible to follow it until the function that initializes the actual driver. Driver checks the OS, enumerates the GPU version and does more but doesn't check if Radeon Boost or Chill is activated. So this subroutine that calls GetRawInputData() works all the time, in a do...while(true) loop. My educated guess is, it calculates mouse movement delta which is needed for Radeon Boost and Chill. They need to add a condition to check if those are enabled.
Re: [Radeon+MouseHz Interference] atieclxx calls GetRawInputData causing mouse jitter - patched w/ python!
Hello. I have an AMD system with an AMD processor and a Vega56 video card and a dav3 mouse with a frequency of 8khz and 1600dpi.
I'm using a modified 24.1.1 driver with Radeon Chill, FreeSync and Vsync (in games) enabled. Amd Chill allows you to accurately limit FPS in games, and other functions synchronize the monitor and video card. This way I get perfect image smoothness without breaks or friezes.
Please tell me what is wrong with your graphs in the Mouse Tester program? Is your mouse polling rate inconsistent or what is your problem? Maybe I have it too.
-
- Posts: 35
- Joined: 22 Dec 2022, 15:50
-
- Posts: 27
- Joined: 11 Jan 2024, 03:42
Re: [Radeon+MouseHz Interference] atieclxx calls GetRawInputData causing mouse jitter - patched w/ python!
How can i tell the script worked? When i run .py script the console flashes for a moment, does it mean it worked?
Re: [Radeon+MouseHz Interference] atieclxx calls GetRawInputData causing mouse jitter - patched w/ python!
I don't actually use Boost or Chill, but my understanding is that Boost varies your resolution depending on mouse movement, and Chill varies framerate depending on mouse movement (and is more a power-saving feature than anything else). atieclxx.exe seems to be a way for the driver to get that mouse movement data, but it does so unecessarily even when these features are disabled. Two different programs constantly calling GetRawInputData means both get a bunch of extra variance in polling timings.F1zus wrote: ↑02 Mar 2024, 10:42Hello. I have an AMD system with an AMD processor and a Vega56 video card and a dav3 mouse with a frequency of 8khz and 1600dpi.
I'm using a modified 24.1.1 driver with Radeon Chill, FreeSync and Vsync (in games) enabled. Amd Chill allows you to accurately limit FPS in games, and other functions synchronize the monitor and video card. This way I get perfect image smoothness without breaks or friezes.
Please tell me what is wrong with your graphs in the Mouse Tester program? Is your mouse polling rate inconsistent or what is your problem? Maybe I have it too.
ISR-GetRawInputData latencies (in nanoseconds) before and after the patch:
Pretty much. The weird bitwise lines calculate absolute value of x, y, and scrolling inputs, and it takes those, combines them into euclidean magnitude and a couple diffent orderings of max() and abs(), and stores them all along with the QPC result into a memory-mapped shared object/file.Plyra wrote: ↑02 Mar 2024, 05:27Bad programming strikes again.
I noticed same behaviour on my setup (Radeon Software 24.2.1, latest version). When you check the stack that calls this subroutine unconditionally, it is possible to follow it until the function that initializes the actual driver. Driver checks the OS, enumerates the GPU version and does more but doesn't check if Radeon Boost or Chill is activated. So this subroutine that calls GetRawInputData() works all the time, in a do...while(true) loop. My educated guess is, it calculates mouse movement delta which is needed for Radeon Boost and Chill. They need to add a condition to check if those are enabled.
Put atieclxx.exe in the same folder as the script or vice-versa and run the script, then put atieclxx.exe back in its original location if you moved it. You can see where exactly it is by finding it in the Details page of Task Manager, right-click→properties. Again though, you may need to use a tool like AdvancedRun to move atieclxx.exe as the TrustedInstaller "user".RealTweaker wrote: ↑05 Mar 2024, 10:22How can i tell the script worked? When i run .py script the console flashes for a moment, does it mean it worked?
You can tell if it worked by comparing hashes of the exe before/after running the patcher, or comparing graphs, or using xperf+WPA to see if atieclxx.exe is making any NtUserGetRawInputDataCalls.
Re: [Radeon+MouseHz Interference] atieclxx calls GetRawInputData causing mouse jitter - patched w/ python!
Okay, thanks for the answer. I downloaded python 3 on win10 and tried to run your script. It throws an error on the first line.Aeodyn wrote: ↑09 Mar 2024, 15:01I don't actually use Boost or Chill, but my understanding is that Boost varies your resolution depending on mouse movement, and Chill varies framerate depending on mouse movement (and is more a power-saving feature than anything else). atieclxx.exe seems to be a way for the driver to get that mouse movement data, but it does so unecessarily even when these features are disabled. Two different programs constantly calling GetRawInputData means both get a bunch of extra variance in polling timings.
ISR-GetRawInputData latencies (in nanoseconds) before and after the patch:
Screenshot 2024-03-09 144113.pngScreenshot 2024-03-09 144711.png
PS: I would like to add that if you set min fps = max fps, then AMD chill will work like a regular fps limiter.
But it limits it more correctly than the in-game limiter.
And also, after using your script with AMD chill enabled, will there be problems with the mouse?
- Attachments
-
- error.PNG (14.39 KiB) Viewed 3397 times