-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
commit 299bc34 causes erratic frametime graph when VRR is in use and mangoapp is displaying #1369
Comments
well, using mangohud to monitor UI performance ended up throwing a slight wrench in the report... the UI seems to lag the most for me only while presenting mangohud. if mangohud is not on screen the UI performance is much closer to expectations. force compositing still fixes the performance when showing mangohud though |
was able to narrow down the effects of this revert further to VRR being enabled on panels that support it. if VRR is on, the revert brings the steam ui performance up from a shakey ~48fps to a stable ~60fps at 3440x1440@60hz on a 7900xtx within gamescope-session |
with the new |
@matte-schwartz I would advise you to try the above gpuvis profiler first, but there’s also another alternative profiling integration I’ve been working on: Tracy profiler: #1328
Note that when building gamescope w/ my Tracy integration, you have to add
Now that I think about it, I should probably add some code to use the Tracy custom data plotting functionality w/ the frametime info that’s passed to mangoapp… |
this is all tested from SteamOS Main in the shipped gamescope-session, with gamescope compiled from latest git using the SteamOS PKGBUILD paired with the steamos devkit client. I will give Tracy profiling a test in a bit, but the devkit makes gpuvis stupidly easy to use. from boot (with adaptive sync disabled): the gpu-trace.zip: https://drive.filen.io/d/69d86e9d-f12e-4b84-9d19-3d7be92f8f8f#flpeGVfwN6bFhRsi9B70uOWI6pFIpLaY Hopefully this offers a bit more insight into the issue. Let me know if you need me to recapture anything. |
Thanks for the new gamescopectl commits @sharkautarch running tracy with sudo in drm mode has its own set of issues (running steam as root is a big no) but even without sudo hardware vblank logs the tracy profiler has showed some interesting stuff. Here we have Here we have It seems like these repeated longer I also exported my tracy session since I'll be honest, most of the code in gamescope is still a big ??? for me 🐸 Edit: It seems like adaptive sync also gives me this lockable which does not seem to show up when gamescope is not using adaptive sync. This could be as designed so maybe it's a nothingburger but that's the other major difference between the two states (aside from the very erratic vblanking of course) Just as a side note - it seems tracy profiling triggers some instability in gamescope-session if monitoring for too long. |
edit: on the left is adaptive_sync 0 and the right is adaptive_sync 1, with continuously rendered frames in the Steam UI on the Home page of Game Mode took some time to dive deeper into gpuvis today after packaging it for Fedora, and the results are pretty similar to what I was seeing with Tracy (although I've still only been able to run that as non-root so gamescope/steam don't complain) but that's a good indication of its accuracy @sharkautarch |
@matte-schwartz
Unless you changed the setting yourself, Tracy profiler only displays lock-events wherein at least one thread is blocked waiting to take a lock (meaning a different thread has already acquired the lock). So it could be an issue in a different scenario, but from looking at your screenshot, there's no lock contention during the long 24ms gamescope-xwm frame so it is extremely unlikely that it is directly causing lag. However, it's possible that the increased lock contention is a symptom of the underlying cause of increased lag when using mangohud + adaptive sync is on. |
No more crashing, was using it merged on top of gamescope master for a bit yesterday |
@sharkautarch I'll wait and see what @Joshua-Ashton makes of this when they get the chance to check out the issue |
@matte-schwartz W/ the two screenshots above, the vertical bars at the top show the 'frame-timing' for vblankmanager. So the yellow bars are vblank times of ~19-20ms, and the green bars are around ~11ms The weird thing I'm seeing is that gamescope is sometimes trying to present in the middle of a vblank 'frame'. as can be seen in the second screenshot. That being said, I also noticed that at one point, a vblank 'frame' somehow fully overlapped one present, and then also partially overlapped a tiny bit of the present before that: When I last tested my tracy profiler integration w/ gamescope, (which was only in nested mode on my x11 desktop), I definitely saw some more innocuous looking overlap between vblank and present, but there was only ever a tiny bit of overlap... Also, see the frame-timing overview for And now that I look back at screenshot 2 and the vblankmanager frames, I've realized that all or most of the 19-20ms vblankmanager frames overlap a ~10ms present, and that ~10ms present somehow isn't inside of
Looking at this fifth screenshot, where we have a 2.68ms normal |
Something else I've noticed is that there is a significant amount of "hitching" between direct scan-out and gamescope compositing when VRR is enabled that is not present with VRR disabled. There's a solid 1-2 seconds of laggy response time I'd say. It's pretty noticeable if you're using the |
@matte-schwartz |
@matte-schwartz |
Cool, grabbed a new .tracy although I only made it ~30 seconds before gamescope crashed without me really doing anything. |
@matte-schwartz |
@matte-schwartz |
@sharkautarch no change, that was a different LE Deck specific issue with only those 3 refresh rates. This issue happens on all my devices, including the LE Deck. |
@matte-schwartz |
3.14.28 with a revert: adaptive-sync-with-revert.tracy.zip 3.14.28 without a revert adaptive-sync-no-revert.tracy.zip the revert I'm using:
|
actually @sharkautarch, on closer analysis, I am starting to wonder if this revert is just hiding a different adaptive sync issue... let me explain my though process on this The Steam Client beta for Steam Deck has a new blur effect on the left side menu when you invoke it from gamescope-session. This blur effect makes gamescope start compositing when it's opened. On 3.14.28 with the revert, I notice that opening this side menu tanks frametiming in a similar way to the bisected bad commit here made it happen with the entire Steam UI - just by toggling adaptive sync. The fact lag happens under different conditions (i.e. even with gamescope compositing unlike the issue report) just by toggling adaptive sync makes me suspect perhaps we are barking up the wrong tree here... and I wonder if it's actually something to do with adaptive sync itself? My repro steps with the revert from SteamOS 3.7:
adaptive-sync-side-menu-with-revert.tracy.zip and then a fun slow-mo video clip since this is kind of tough to explain without showing: IMG_1923.movYou can see it slow down considerably when I send the adaptive sync on signal ~0:07 in to that clip. Let me know what you think. Might just be grasping at straws here but the similarity in how adaptive sync makes this other issue happen is suspicious to me. |
@matte-schwartz Try doing one trace running gamescope with the env variable |
edit: |
adaptive sync on, `mangohudctl set no_display 0` to unhide HUD when first entering session, seemingly no lag yet?
Things look okay for now, let's start tinkering. adaptive sync on, mangohud on, previously good, after using left side menu on the steam deck beta client
it starts to go a bit haywire here, with seemingly rhythmic switching between delta flight timing on the page flip handler. this brings my Home page ui from 120fps down to ~90fps on my ROG Ally adaptive sync on, mangohud on, previously good, steam notification received
now this seems to send every delta consistently to around double what it should be, and brings my UI performance on the Home page down even further to ~70fps. adaptive sync on, UI lagging @70fps, `mangohudctl set no_display 1` to hide mangohud
this brings deltas back into the range of exactly where they should be. and then finally: adaptive sync on -> adaptive sync off with mangohud unhidden
this also brings deltas back into an acceptable range, even when mangohud is unhidden. So basically, the best that I can conclude is that something about adaptive sync and the way the Steam UI utilizes window focus is what's actually causing problems here... what I'm lost on is exactly where this could be happening when kernel drm debugging logs don't really show anything noteworthy. perhaps why exactly this does work, albeit briefly, until you interact with the side menus or happen to get a steam notification offers a clue? edit: oh, and deltas go back to the ~8332000 range under every circumstance if you force compositing |
this seems to be fixed with the changes since 3.15.0 today on all devices I've tested on. will report any new issues that pop up separately. |
this issue has not gone away after all. #1513 is a potential duplicate of this, as the same base commit is what causes errors to arise overplay planes seem to pull away VRR focus between the overlay and the primary plane when in-game now. this issue can be mitigated with |
my latest findings on this are that now, regardless of compositing status, having any mangoapp overlay displayed in embedded gamescope while VRR is enabled will cause erratic frametimings and delta times to become staggered. This is especially visible on monitors where you can use an on-board OSD to verify the refresh rate the monitor is lighting up at, and in games where performance does not reach the maximum monitor refresh rate. With mangoapp on display, you can see the OSD switch between 120hz and the game's actual refresh rate. The issue is mitigated with I'm beginning to wonder if mangoapp itself is now causing VRR issues, although I'm not quite certain how to debug that... in any case, gpu-trace really does not show anything too unusual beyond staggered delta times between when VRR is in use vs not in use. gpu-trace in Ghost of Tsushima with overlay visible and VRR on: https://drive.filen.io/d/53bb9723-bf4e-45a6-b810-ff026ce96937#vgb4tIwSZRyoR7vVFMPLl9pl5K4FMO29 gpu-trace in Ghost of Tsushima with overlay disabled and VRR on: https://drive.filen.io/d/e8a48d41-022b-4dc1-9c10-fdd87ab90db1#nSCE5bI7ip31uVqAUhbnmbpNeWYCuM3u |
after spending many hours debugging this, most of this issue is honestly a pretty inaccurate summary of the real problem. will file a report for the actual bug instead. |
299bc34 causes the Steam UI to lag when gamescope is not actively compositing, as determined by the compositor debugging squares (enabled the entire time) with MangoHud overlay. unfortunately, this issue is unrelated to the other gamescope compositing issues I reported because of course life can't be that simple 🐸
Before reverting 299bc34 - stutter and ~40fps (from 6f4bc2e):
IMG_1611-1.mov
After reverting 299bc34 - no stutter and 60fps (from 6f4bc2e):
IMG_1612-1.mov
The text was updated successfully, but these errors were encountered: