Returning player, *severely* low FPS on mouse movement.

Discussion in 'Support!' started by a2razor, July 6, 2015.

  1. a2razor

    a2razor Member

    Messages:
    32
    Likes Received:
    24
    YEP! It sounds just like the issue in this thread:
    https://forums.uberent.com/threads/solved-zero-fps-while-moving-mouse.69149/


    Essentially if I move my mouse cursor the game completely freezes, or drops to a very low framerate, until the mouse stops movement.

    --If I pan the camera holding the middle-mouse button, I get roughly < 5 fps on a fresh game.
    --If on the otherhand I move via the keyboard bindings, the camera pans at over 130 fps.


    Already have played around with all drivers, as I've recently bought one of those new Radeon Fury X cards.

    **The release drivers did not work correctly, so I reverted to the 15.6 OGL drivers instead of the Fury / R300 launch drivers. I have however tried every driver from 13.12 up through the latest 15.200.1040's (OpenGL component only), and so I don't believe that the stuttering is video-driver related.

    It honestly feels like the game is relying on mouse-hooks, and is processing every single move event that comes in.


    I've tried disabling RTSS' hooking, closing down all programs on the system that install mouse hooks (such as the ROCCAT CP), using --software-ui flag, disabling steam ingame overlay + using non-stream version, enabling and Disabling FreeSync, on / off vsync enforcement, windowed mode / fullscreen mode, triple buffering on / off, force-installing Win7 Intel USB drivers, using stock mouse-drivers instead of correct ROCCAT drivers, lowering mouse DPI to the lowest that it can go for my ROCCAT, etc..

    **Lowering DPI 'helps' the situation but doesn't resolve it, if I drop DPI to 1000, I can get about 10fps while moving the mouse. This is definitely on the right track & related to the problem.



    That said, I stopped playing PA some months ago and decided to check out what this awesome game has to offer ... as I've recently gotten back out of the MMORPG scene (and thus have alot of time on my hands!).

    The machine is:
    -ASROCK X99 WS mobo w/ latest bios
    -Xeon E5 1650 v3
    -Radeon Fury X (see above notes on drivers)
    -32GB DDR4 2133 ECC
    -Windows 8.1 Pro, all Windows updates installed

    Not sure there's much else worth noting. The game runs fluid even deep into a game, and it's only isolated to mouse movement that causes the FPS dips.

    Unfortunately I'm always moving the mouse during battle though.


    Any suggestions guys?
    Last edited: July 6, 2015
  2. dom314

    dom314 Post Master General

    Messages:
    896
    Likes Received:
    1,196
    Hey, so did a driver update fix it?

    Side note: I am jelly of dem rams bru.
  3. a2razor

    a2razor Member

    Messages:
    32
    Likes Received:
    24
    Sadly it did not. Downgrading OGL drivers does fix the graphical artifacts though. With the release drivers for the card onward (anything past 15.6, starting from 15.15), the visibility ring and selection rings are stair stepped blocks, that I can only describe as looking like compression artifacts.

    I didn't take a screenshot, but could get one later on. Performance wise, still having issues.


    I take back what I said on it feeling like "mouse hooks", because as far as I can tell PA doesn't call SetWindowsHookEx. It's not referenced in user32 as seen from Dependency Walker, nor is it loaded manually from LoadLibrary.

    [The only hook creation that I see is from ati6axx.dll, for WH_CALLWNDPROC]


    If I did see a mouse hook, I was going to write some code to do mouse update coalescing so to speak. But it doesn't look like that's how PA does input.
    Last edited: July 6, 2015
  4. a2razor

    a2razor Member

    Messages:
    32
    Likes Received:
    24
    Ah, guessing that PA is doing its mouse input through SDL2 (don't see much in the lines of GetCursorPos use). I see a ton of WM_MOUSEMOVE events coming in from the SDL2 window.


    I'll play around with hooking SDL and see if I can drop the mouse input rate a bit to get the game playable (filter PA from getting some of those messages). But still would appreciate if someone has an idea for an easier solution.
  5. cdrkf

    cdrkf Post Master General

    Messages:
    5,721
    Likes Received:
    4,793
    Someone else had this, high polling rate on mouse is likely your problem, see this thread:
    https://forums.uberent.com/threads/lag-when-middle-mouse-panning.69093/#post-1092213

    That was polling rate rather than driver related (btw seriously jealous of that graphics card ;) more than double my poor old R9 280 card haha).

    The other thing that might be an issue is if you have any software installed that interferes with OGL (overlays are usually the culprit). Have a look through this list just in case:
    http://steamcommunity.com/app/233250/discussions/2/558751813508748383/

    Also worth noting you should disable the overlay if you use the AMD Raptr software (or even uninstall it) as I've heard this causes problems (actually works ok for me but removing it did solve someone elses issues in PA). With respect to the artifacts, that is probably down to the new memory compression built into the Fury cards (only other card with this tech is the R9 285 / R9 380 but not heard of anyone with either card on forums).
  6. a2razor

    a2razor Member

    Messages:
    32
    Likes Received:
    24
    Just to keep everyone updated on my progress here. I've produced a full workaround for this issue that does NOT involve lowering mouse polling-rate or DPI, and PA is now completely playable and buttery smooth for me again (under all conditions).


    That workaround is implemented via API Hooking, and specifically targeting messages between OpenGL and SDL. This is done in order to provide an extra layer for coalescing input-events so to speak, and discarding duplicate input events as well as capping the frequency of movement events without reducing overall input detail (*where possible not to*).

    Aka: I do not throw out critical events such as a movement event coupled with mouse-up, down, scroll-wheel, etc, state changes ... yet at the same time try to put some constraint on what's sent to SDL and ultimately the game's message queue (prevent message flooding). Overall I'm trying to keep input as responsive as I can, though.



    I'm doing some final cleanups and tracking down a few elusive memory leaks before releasing any builds, yet this is something that I'll be trying to put out VERY soon to at least some testers. I'd be curious if any of you guys out there who have had a similar problem are interested, as so far of course I am only experimenting on my own systems (of which two AMD rigs were unplayable).


    --That said, this is executable code / a DLL. I'm doing some IAT patching, hooking CallWindowProc, creating an additional two threads, and injecting my code into the game process. I ultimately did not go with reducing updates globally on the system with mouse hooks (eg, reducing mouse updates to the system). I do not know what Uber's policies are on something like this, if it'll cause issues with online play, etc ... and so it's also something that I'll have to read up on a bit before I make anything public on the forums.


    Input handling in games and by OS's is something that's always interested me, and something that I've worked with extensively in products, so hopefully this will be a good chance to make a contribution to PA's community and help others out.
  7. cdrkf

    cdrkf Post Master General

    Messages:
    5,721
    Likes Received:
    4,793
    Nice work! I think @mkrater and @jables should probably be made aware of your findings.
  8. crizmess

    crizmess Well-Known Member

    Messages:
    434
    Likes Received:
    317
    Just out of curiosity: Is this slowdown just caused by the sheer amount of mouse input-events, or is this an issue of how many cpu time is spend to process a single moue event? (Did you investigate what took so much cpu time in the input loop of the game)
  9. a2razor

    a2razor Member

    Messages:
    32
    Likes Received:
    24
    Absolutely. It'll be alot easier for the developers to filter out the excess mouse events in their message-pump rather than my indirect approach here honestly. Most of the effort was getting a means to get inbetween GL and SDL's window.


    -It also doesn't seem that this is a problem for my machines that have NVidia cards in them, so it's very possible that it's specific to AMD's driver in some way (or that NVidia does something special / has implemented a workaround of their own). I have not looked yet into if there's a difference in message-rate through NVidia's drivers (that reach SDL), but will probably look into this soon as I'm curious now.
  10. a2razor

    a2razor Member

    Messages:
    32
    Likes Received:
    24
    I did not take a look at if it's the game's processing of mouse events or the sheer number of events. However, there is a massive number of events generated with a 9000 DPI mouse and 1000hz polling.

    You could say that I'm doing my inspection purely at the API level, and am trying to avoid modifying the behavior of the game itself.


    I can probably go a step further in saying that the number of mouse events is high enough that during mouse movement that WM_TIMER never gets processed in the OpenGL thread [which, was initially the reason that I spawned additional threads]. The flood of movement messages is pretty massive. In a sweep of the mouse cursor over the screen, I can generate literally close to 1k WM_MOUSEMOVE events in a single second (@ a 1600p resolution display).

    -- This is just at input handling in GL, before it's passed to SDL / the game window.
    Last edited: July 8, 2015
    crizmess and dom314 like this.
  11. dom314

    dom314 Post Master General

    Messages:
    896
    Likes Received:
    1,196
    I am not sure if this may help you in any way, but for me I had no issues with mouse slowdown on my AMD gpu (Radeon HD 6780). Then after Uber made an update to resolve some linux issues with the mouse cursor not appearing, suddenly the fact that my gpu drivers were out of date became relevant.

    I have a Razor Chroma, so it is a pretty high DPI mouse and I think the poll rate is probably high also. Anyway, when I moved my mouse, the fps would actually be 0 with no client-side updates until I stop moving my mouse.

    After updating my driver the problem went away completely, no fps drop whatsoever. My gut says it could be some bug introduced with the patch, which certain versions of the amd and nvidia drivers fix - at least transiently.
    a2razor likes this.
  12. a2razor

    a2razor Member

    Messages:
    32
    Likes Received:
    24
    Think I have most of the initial issues tracked down. Can make it through full games with everything behaving properly, and I'm not noticing any types of leaks (at least not from my hooks or message handling).


    PA Input-Fix 1.0.zip
    Md5: 5E833586A6B7FDDE257F0368B9E3E2FA

    PA Input-Fix 1.1.zip
    Md5: 8CBAB6C3691AA39074F78543293C79B6

    *Supports 64bit PA only*
    PS: Please fully read over ReadMe.txt. The hooks will create a "BEEP" on startup, this is not an error message -- just a notice that it was loaded.


    If any moderator finds what I'm doing here objectionable, you can of course just take down the download and I will not re-post it. Alas, I'm quite eager to get in some testing, yet I do understand that this is manipulation of the game and not through the official mods system. Either way .. my intent is to help here.

    I couldn't find much in terms of forum policies on something like this.


    --I've included my Skype contact in the ReadMe that's in there. [via forum messages is also fine]
    If any of you guys find issues, please tell me so that I can try to fix them. Or, even if it's just to say that everything is working for you. (that's equally useful feedback)
    Last edited: July 8, 2015
    FSN1977, Remy561 and DeathByDenim like this.
  13. a2razor

    a2razor Member

    Messages:
    32
    Likes Received:
    24
    That may very well be the case, but I've not had luck changing around drivers. What driver version are you using on your GPU (base / GL)? One big problem that I have with the Fury, is that I don't have much freedom with my base driver version as it's a pretty new card (at least without modifying the driver INF's / going outside the drivers that officially support it).

    I've essentially only touched the OpenGL drivers and kept my base as 15.15.


    I'm also finding that my problem is partially because I've applied "NoDTToDITMouseBatch" shim to explorer.exe as a solution for low update rate in FPS's. On removing that shim, the mouse events are drastically reduced. This may explain why some people notice issues and others don't. Taking that shim off does improve things, though I still do get FPS drops on mouse movement even without it applied.


    Also, I kindof like high polling rate on the desktop and not in games, as I do use 144hz on the desktop on my main screen. So it's not something I'd really want to remove too.
    Remy561 likes this.
  14. a2razor

    a2razor Member

    Messages:
    32
    Likes Received:
    24
    PA Input-Fix 1.1.zip
    Md5: 8CBAB6C3691AA39074F78543293C79B6
    *Supports 64bit PA only*

    1.1 Changes:
    -Discard additional redundant mouse-events
    -Improve responsiveness of mouse-clicks and thread-coordination
    -Fixed a bug that was causing UNICODE BOM to be appended to log file (not just at the start)

    Remy561 likes this.
  15. masterdigital

    masterdigital Uber Alumni

    Messages:
    438
    Likes Received:
    833
    I'll make sure the correct engineer takes a look at this issue (on Monday). Thanks for looking this.
  16. Remy561

    Remy561 Post Master General

    Messages:
    1,016
    Likes Received:
    641
    You are awesome!

    Not that I have this problem since I own an Nvidia, but still, awesome! Especially for the small subset of players having this issue and have been waiting for a fix for a while now!
  17. reader999

    reader999 New Member

    Messages:
    1
    Likes Received:
    0
    Hi a2razor,

    I found your posts here while searching for another similar problem, maybe you can help out here, too.

    There exists an unfixed problem in an older game called F.E.A.R. 1 that causes the game even on modern hardware to stutter and it is reported to be USB polling.
    Link: forums.steampowered.com/forums/showthread.php?t=1939893

    Can you imagine if this may be able to be resolved with api hooks, too?

    Could you point into the direction, and in more details what calls in what dll might causing this and how you fixed it?

    Thank you very much in advance!

Share This Page