Comments (7)
I can reproduce this issue with the testgamecontroller
app on the Steam Deck with Gnome and both Wayland and X11.
In my test, I got an input latency of about 1 second.
I also patched the SDL_hidapi_steamdeck
driver so it tries to drain the buffer, see this branch. However, this did not fix the issue so I guess there is something else causing the issue outside of the driver.
from sdl.
@mmmaisel, can you take a look?
from sdl.
I had a quick look at the source code without doing some real tests and noted the following things:
- Once initialized, the HIDAPI driver only talks to the device when the function HIDAPI_DriverSteamDeck_UpdateDevice is called by SDL.
- The driver itself is independent of vsync and other graphics code. Actually, it does not even know if vsync is enabled or not.
With this information, I have the following untested theory:
There is some synchronization issue that delays the calls to HIDAPI_DriverSteamDeck_UpdateDevice when synchronizing to the screen which takes about 16 ms at 60 Hz. In the meantime, the HIDAPI fills data in a buffer much faster every 1-4 milliseconds so the next call to the HIDAPI_DriverSteamDeck_UpdateDevice processes some outdated data. Depending on the HIDAPI buffer size, the accumulated outdated data then causes input lag of about half a second.
When the HIDAPI driver is disabled by the SDL_SetHint, a kernel driver is used instead which always present up to date data to userspace when asked without buffering old values.
from sdl.
@jorio, Can you please try if my steamdeck-drain-buffer branch fixes your problem?
In my tests with the testgamecontroller
utility, it fixes the latency issue on the Steam Deck.
from sdl.
Oh yes, reading from the controller should definitely be done in a loop, like is done with all the other HIDAPI controllers.
from sdl.
That explains why it's related to framerate, since it's only reading one report every time through the frame loop.
from sdl.
@mmmaisel Sorry - it took me a while to get around to testing this. Can confirm that I can't perceive any more input lag. Thanks a lot!
from sdl.
Related Issues (20)
- SDL_CreateDirectories / SDL_CreatePath HOT 1
- SDL3: Mouse cursor gets locked when calling SDL_HideCursor() HOT 3
- WASAPI can't find requested audio endpoint: Element not found.
- SDL_CopyDirectory, SDL_RenameDirectory HOT 3
- SDL_SetSurfaceColorKey() sets wrong color HOT 4
- SDL_Init(SDL_INIT_AUDIO) randomly segfaults on init HOT 19
- NetBSD CI is down HOT 1
- SDL_GetHint does not work when not calling SDL_Init HOT 1
- main callbacks return enum values? HOT 1
- Missing Pen backends HOT 4
- SDL_AcquireCameraFrame returns frames at a higher FPS than specified on macOS 14.6.1 HOT 3
- SDL_ConvertSurfaceAndColorspace does not correctly palettize surfaces HOT 6
- SDL_Log not working on Windows with debugger attached HOT 10
- [SDL2] Gamepad Motion Sensors via Bluetooth don't work until you launch another SDL App with working Motion Sensors or swap older SDL2.dll files HOT 2
- Updates on dropping Apple frameworks not available on iOS? HOT 7
- Embed a SDL window by NativeControlHost control in AvaloniaUI, mouse cursor don't restore to default on Linux x11. HOT 1
- Feature request SDL_EVENT_FINGER_CANCELLED
- MFC window, pop a sdl window, break! HOT 1
- Decide and Document how planar data is stored in / accessed from Surfaces
- Always prefer downscaling in SDL_GetSurfaceImage HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdl.