[GH-ISSUE #14] Rumble event listening effectively caps framerate #5

Closed
opened 2026-10-15 12:51:05 +00:00 by bsakaguchi · 8 comments
Owner

Originally created by @maxdirocco on GitHub (Aug 16, 2024).
Original GitHub issue: https://github.com/games-on-whales/inputtino/issues/14

Hello! First of all, thank you for your hard work on this project.

I am using Sunshine on Fedora Linux 40.

GPU: RX 6900 XT
CPU: i7 14700K

Since this library has been adopted into Sunshine as of:
https://github.com/LizardByte/Sunshine/pull/2606

I have noticed that when my controller is rumbling continuously, the framerate is effectively capped at 50FPS. I believe I have narrowed down this issue to:
github.com/games-on-whales/inputtino@25e75254d1/src/uinput/joypad_utils.hpp (L169)

When modifying this line and recompiling Sunshine, the "capped" framerate changes to the inverse of the specified delay (provided the GPU / CPU can keep up, of course), e.g.

std::this_thread::sleep_for(20ms); // (1 / 20ms) = 50 FPS
std::this_thread::sleep_for(13ms); // (1 / 13ms) = 77 FPS

I am not sure what the proper fix for this is, but I've gone as low as 3ms without noticing any issues.

Please let me know if more information is required.

Thanks and have a great day.

Originally created by @maxdirocco on GitHub (Aug 16, 2024). Original GitHub issue: https://github.com/games-on-whales/inputtino/issues/14 Hello! First of all, thank you for your hard work on this project. I am using Sunshine on Fedora Linux 40. GPU: RX 6900 XT CPU: i7 14700K Since this library has been adopted into Sunshine as of: https://github.com/LizardByte/Sunshine/pull/2606 I have noticed that when my controller is rumbling continuously, the framerate is effectively capped at 50FPS. I believe I have narrowed down this issue to: https://github.com/games-on-whales/inputtino/blob/25e75254d1e40e04811faca78cb5dbb0b1bf03b0/src/uinput/joypad_utils.hpp#L169 When modifying this line and recompiling Sunshine, the "capped" framerate changes to the inverse of the specified delay (provided the GPU / CPU can keep up, of course), e.g. ``` std::this_thread::sleep_for(20ms); // (1 / 20ms) = 50 FPS std::this_thread::sleep_for(13ms); // (1 / 13ms) = 77 FPS ``` I am not sure what the proper fix for this is, but I've gone as low as 3ms without noticing any issues. Please let me know if more information is required. Thanks and have a great day.
Author
Owner

@ABeltramo commented on GitHub (Aug 17, 2024):

Thanks for the very detailed report, I'm in the middle of other stuff, but I'll check it out properly in the next few days.
Can you just confirm that this issue wasn't present in Sunshine before inputtino?

<!-- gh-comment-id:2294842760 --> @ABeltramo commented on GitHub (Aug 17, 2024): Thanks for the very detailed report, I'm in the middle of other stuff, but I'll check it out properly in the next few days. Can you just confirm that this issue wasn't present in Sunshine before inputtino?
Author
Owner

@maxdirocco commented on GitHub (Aug 17, 2024):

Hi, thanks for getting back to me!

When compiling Sunshine with the cmake flag SUNSHINE_USE_LEGACY_INPUT (https://github.com/LizardByte/Sunshine/pull/2606/commits/a11b69c38e64b5210e0fd4577dfb3f7592f99e6c), this issue is not present. This, plus the above experiment with changing the sleep duration suggests to me that the issue is tied to inputtino.

I'm not too familiar with the code here, but I'll conduct some additional experiments on my end.

Beyond that, if more information is required (logs, a video demonstration of the issue, etc.), I will do my best to produce that ASAP.

<!-- gh-comment-id:2294872933 --> @maxdirocco commented on GitHub (Aug 17, 2024): Hi, thanks for getting back to me! When compiling Sunshine with the cmake flag `SUNSHINE_USE_LEGACY_INPUT` (https://github.com/LizardByte/Sunshine/pull/2606/commits/a11b69c38e64b5210e0fd4577dfb3f7592f99e6c), this issue is not present. This, plus the above experiment with changing the sleep duration suggests to me that the issue is tied to inputtino. I'm not too familiar with the code here, but I'll conduct some additional experiments on my end. Beyond that, if more information is required (logs, a video demonstration of the issue, etc.), I will do my best to produce that ASAP.
Author
Owner

@ABeltramo commented on GitHub (Aug 17, 2024):

Thanks for confirming, that should narrow it down then. Just one last question: is this happening on any game or is it specific to some games? It seems odd that that part is causing a slowdown since it's running on a different thread but maybe the game (or the kernel itself) is accumulating those rumble events until we process them? 🤔

<!-- gh-comment-id:2294874137 --> @ABeltramo commented on GitHub (Aug 17, 2024): Thanks for confirming, that should narrow it down then. Just one last question: is this happening on any game or is it specific to some games? It seems odd that that part is causing a slowdown since it's running on a different thread but maybe the game (or the kernel itself) is accumulating those rumble events until we process them? 🤔
Author
Owner

@maxdirocco commented on GitHub (Aug 17, 2024):

Yeah I also found that strange.

I've been able to reproduce this on the following games:

  • Watch_Dogs (2014)
  • LEGO Star Wars: The Skywalker Saga (2022)

Both running on the latest version of Proton Experimental. I have yet to find a native Linux game in my library with a lot of rumble events.

I also tried Helldivers II, and I couldn't seem to reproduce the issue.

I will test more games / Proton configurations later today and will report back here.

<!-- gh-comment-id:2294887938 --> @maxdirocco commented on GitHub (Aug 17, 2024): Yeah I also found that strange. I've been able to reproduce this on the following games: - Watch_Dogs (2014) - LEGO Star Wars: The Skywalker Saga (2022) Both running on the latest version of _Proton Experimental_. I have yet to find a native Linux game in my library with a lot of rumble events. I also tried Helldivers II, and I _couldn't_ seem to reproduce the issue. I will test more games / Proton configurations later today and will report back here.
Author
Owner

@maxdirocco commented on GitHub (Aug 18, 2024):

A little bit more information:

  • Kernel 6.10.3
  • Gnome 46 (also tested KDE Plasma 6, same issue)

I tested another game, Dying Light (2015), and observed this issue in both the native Linux port and when running the game through proton.

Disabling "Vibration" in the in-game settings menu alleviates the issue.

<!-- gh-comment-id:2295308597 --> @maxdirocco commented on GitHub (Aug 18, 2024): A little bit more information: - Kernel 6.10.3 - Gnome 46 (also tested KDE Plasma 6, same issue) I tested another game, Dying Light (2015), and observed this issue in both the native Linux port and when running the game through proton. Disabling "Vibration" in the in-game settings menu alleviates the issue.
Author
Owner

@ABeltramo commented on GitHub (Aug 19, 2024):

I've just pushed a potential fix, when you've got a chance could you give it a go on your setup? This should completely remove the busy loop and potentially be even better than the old Sunshine implementation.

<!-- gh-comment-id:2296837405 --> @ABeltramo commented on GitHub (Aug 19, 2024): I've just pushed a potential fix, when you've got a chance could you give it a go on your setup? This should completely remove the busy loop and potentially be even better than the old Sunshine implementation.
Author
Owner

@maxdirocco commented on GitHub (Aug 19, 2024):

Seems like the fix works! I'm no longer experiencing frame drops in the above games.

Please let me know if there's anything else you need from me.

Thank you so much for the work you put into this project!

<!-- gh-comment-id:2296903710 --> @maxdirocco commented on GitHub (Aug 19, 2024): Seems like the fix works! I'm no longer experiencing frame drops in the above games. Please let me know if there's anything else you need from me. Thank you so much for the work you put into this project!
Author
Owner

@ABeltramo commented on GitHub (Aug 19, 2024):

Thank you for the incredibly detailed issue, it was a very easy fix thanks to all the info that you've provided!

<!-- gh-comment-id:2297036763 --> @ABeltramo commented on GitHub (Aug 19, 2024): Thank you for the incredibly detailed issue, it was a very easy fix thanks to all the info that you've provided!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
games-on-whales/inputtino#5
No description provided.