Commit graph

51 commits

Author SHA1 Message Date
Joshua Ashton
cae9b3efb7 vr: Fix usage of HAVE_OPENVR macro 2023-01-11 21:20:24 +00:00
Joshua Ashton
f4f0239b31 vr_session: Initial implementation 2023-01-11 21:20:24 +00:00
Joshua Ashton
677e3b6624 vblankmanager: Fix build 2022-10-19 18:59:09 +01:00
Joshua Ashton
ec6bd30bb6 drm, steamcompmgr: Support for VRR
Exposes GAMESCOPE_VRR_ENABLED, GAMESCOPE_VRR_CAPABLE and GAMESCOPE_VRR_FEEDBACK
2022-10-19 18:57:14 +01:00
Joshua Ashton
a8592be47d vblankmanager: Push back drawtime if we are compositing
Avoids getting into a feedback loop with clocks when we need to composite.

Fixes stutter when using FSR on Steam Deck.
2022-08-16 23:13:56 +00:00
Joshua Ashton
30b74a762a vblankmanager: Fix build 2022-07-27 15:58:56 +00:00
Joshua Ashton
9c81cd1d80 vblankmanager: Only move back redzone by refresh for external screens
Deck screen can handle this with our custom clocks and this just increases latency otherwise.
2022-07-27 15:44:17 +00:00
Joshua Ashton
312a616501 vblankmanager: Scale vblank redzone against target refresh
Fixes frametimings at 4K@30Hz
2022-07-27 10:46:49 +00:00
Joshua Ashton
4ed0c26364 vblankmanager: Nuke FPS limiter code for now
Not baked enough right now, needs a rework for several reasons.

Keeps dynamic refresh.
2022-02-17 21:58:14 +00:00
Joshua Ashton
fd3e8182fd vblankmanager: Rework fps limiter a bunch
Tracks consecutive missed frames much better, handles latent buffers much better.

Disable mangoapp hack for now -- it's obscuring useful data, need a better solution.

Disable low latency by default, still controlable by atom.
2022-02-16 00:55:21 +00:00
Joshua Ashton
ecdf214130 vblankmanager: Fix offsetting by vblank time -- use 0 for min sleepy time 2022-02-14 20:08:19 +00:00
Joshua Ashton
a8d59607b3 vblankmanager: Don't resize latency graph when misaligned from vblank + latent frames 2022-02-14 19:54:21 +00:00
Joshua Ashton
f65339de0f vblankmanager: Don't disable latency graph when latent
Causes a bunch of mangoapp resizing which affects frametime, just make it 0 if we don't know.
2022-02-14 19:51:29 +00:00
Joshua Ashton
7ec498af0a vblankmanager: Track latent frames 2022-02-14 19:15:52 +00:00
Joshua Ashton
765ddd74b1 Revert "vblankmanager: Make min sleepy time 0"
This reverts commit 0c3eb8f83d.
2022-02-14 15:01:07 +00:00
Joshua Ashton
0c3eb8f83d vblankmanager: Make min sleepy time 0 2022-02-14 14:56:54 +00:00
Joshua Ashton
82d372e95d vblankmanager: Change sleepyTime min values
Allows us to be more consistent at high GPU loads
2022-02-14 14:45:48 +00:00
Joshua Ashton
392a63d62b steamcompmgr: Add GAMESCOPE_LOW_LATENCY atom 2022-02-14 14:13:47 +00:00
Joshua Ashton
7f2696f51a vblankmanager: Be more aggressive about ramping back up 2022-02-14 14:11:18 +00:00
Joshua Ashton
561d7c4552 vblankmanager: Tune vblank redzone values
Couldn't do the other thing, causes some wackiness when compositing.
2022-02-14 13:48:12 +00:00
Joshua Ashton
fde42a4323 vblankmanager: Fix mangoapp latency value when late frame 2022-02-14 12:52:48 +00:00
Joshua Ashton
a2e01b5701 mangoapp: Handle frametimes from fps limiting better
Also logs latency and app's real frametime
2022-02-14 10:19:10 +00:00
Joshua Ashton
d3b5a758d1 vblankmanager: Put some of the vblank redzone into a min value
Just matters that we call drmAtomicCommit before 1.6ms, we can keep this value more stable for 99% of cases this way.
2022-02-13 18:35:59 +00:00
Joshua Ashton
12ee4304ec vblankmanager: Use vblank offset for alignment in FPS limiter 2022-02-13 10:38:41 +00:00
Joshua Ashton
555bf125c6 vblankmanager: Fix leftover FPS_LIMIT_DEBUG 2022-02-13 09:40:17 +00:00
Joshua Ashton
40fba97cea vblankmanager: Fix targeting framerates less than current with FPS limiter 2022-02-13 09:36:28 +00:00
Joshua Ashton
1594e02c84 vblankmanager: Discard first non-missed frames after a missed frame
Additionally fix some vblank limiting stuff for FSR at 4K.

This is our late frame.
2022-02-13 09:16:10 +00:00
Joshua Ashton
8fe9322578 vblankmanager: Explain divergence situation in a comment 2022-02-12 18:24:12 +00:00
Joshua Ashton
e690b00f7b vblankmanager: Allow going back in time by fixed redzones
Going back a little bit okay, it's when we use varying values to go back, we become divergent from target over time with varying clocks
2022-02-12 18:13:45 +00:00
Joshua Ashton
f156763458 vblankmanager: Don't sleep back in time
Fixes getting stuck in a feedback loop with high variance
2022-02-12 17:59:20 +00:00
Joshua Ashton
2cac416000 vblankmanager: When calculating fps limiter sleep time, take the min of the rolling max frame time against target interval - redzone
We account for redzone later, and don't want to go over vblank time and preceed into previous vblank or whatever here.
2022-02-12 13:46:36 +00:00
Joshua Ashton
29060cc87c steamcompmgr: Detect stalls in fps limiter latent buffer heuristic 2022-02-12 12:11:00 +00:00
Joshua Ashton
a5c660e54f vblankmanager: More value tuning
Based on some rough data across a variety of games that are both GPU bound and also ones that are very not and cause GPU clocks to vary wildly
2022-02-12 11:54:51 +00:00
Joshua Ashton
e53f986048 vblankmanager: Tune FPS limiter and dynamic vblank heuristics 2022-02-11 05:28:03 +00:00
Joshua Ashton
d759bd5efd vblankmanager: Fix shutting down fps limiter thread
Closes: #406
2022-02-10 02:34:03 +00:00
Joshua Ashton
c5ab6f388b vblankmanager: Implement FPS limiter by strategic buffer withholding 2022-02-09 00:34:58 +00:00
Joshua Ashton
0bc3a2493d steamcompmgr: Add tuneables for vblank red zone + decay rate 2022-01-31 23:49:39 +00:00
Joshua Ashton
797ee59cbb vblankmanager: Estimate draw buffer time based on max rolling average draw time
Handles spikes much better and allows us to have a lower buffer when not needed.
2022-01-31 23:49:39 +00:00
Joshua Ashton
a659fef806 drm: Use vblank time from page flip handler 2022-01-31 23:49:39 +00:00
Simon Ser
f3865a73bd Name our threads
Unfortunately the name length is limited to 15 characters, and the
executable name is dropped from the name if we don't include it.
2021-10-27 17:18:29 +02:00
Simon Ser
470756029d Stop using X11 events for vblankmanager
Instead, use a pipe. Check if the pipe is readable in the
steamcompmgr event loop.

This avoids a roundtrip through the X11 server.

Closes: https://github.com/Plagman/gamescope/issues/201
2021-06-09 18:42:38 +02:00
Pierre-Loup A. Griffais
2bb4907993 Also spew wayland display name through session pipe. 2021-04-27 21:17:36 -07:00
Simon Ser
29d00dbc68 tracing: use {begin,end}_ctx helpers, remove unnecessary newlines 2021-03-11 11:25:34 +01:00
Pierre-Loup A. Griffais
fd7a81547a vblankmanager: obey nested refresh rate if set 2020-09-15 14:46:12 -07:00
Joshua Ashton
9af5c3f254 Cleanup vblankmanager
Keep everything on the same timescale.
Avoid using floats here when we can just use integer maths.
Add demarcations.
Misc. cleanup.
2020-09-12 22:26:31 -07:00
Joshua Ashton
bb9d0cdf8f Use nanoseconds for vblank timing
Avoids locking on-vblank
STL's clock's accuracy can be funky also.
2020-09-12 22:26:31 -07:00
Joshua Ashton
50a508ae74 Encode vblank time in client message
Eliminates the atomic hack here
2020-09-12 22:26:31 -07:00
Pierre-Loup A. Griffais
81b8e8c33c steamcompmgr: ignore vblank messages if we get them too late. 2020-09-01 22:59:44 -07:00
Simon Ser
bae255ee1a
Get rid of C_SIDE
wlroots headers can mostly be included with extern "C" blocks. Two
exceptions are the use of `static` for array args and `class` as a
struct field. These can be #define'ed to avoid C++ build errors.

This allows the whole project to be built as a single C++ codebase,
without having to maintain hybrid header files.
2020-06-11 12:44:36 +02:00
Pierre-Loup A. Griffais
b4893840eb vblank: more tweaks, align to DRM vblank. 2020-01-26 16:28:35 -08:00