Skip to content

Detecting refresh rate changes #14674

@flibitijibibo

Description

@flibitijibibo

An FNA developer ran into an interesting performance issue that turned out to be caused by the framerate limiter on SteamOS:

The compositor on Steam Deck will stall your main thread to control frame pacing. I assumed it would adjust the Hz of the display, but it actually doesn't: eg, on OLED, after setting it to 60Hz, it still reports to SDL that it's a 90Hz display.

This negatively affected my game because I time slice my main thread to build geometry in the background. I time how long update and draw calls run for to heuristically determine how much work I can do. The compositor stalling my thread made my engine think that it had no time left for background processing.

This makes sense in practice since you wouldn't want to perform a whole entire modeset every time you moved the framerate limit slider, but it made me wonder two things:

  • Is SDL currently set up to detect refresh rate changes, like we already do for other display mode changes? If so, does this work on x11?
  • Does either gamescope or the SteamOS overlay expose the user's intended framerate limit in some way? Should gamescope be sending display events for this somehow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions