-
-
Notifications
You must be signed in to change notification settings - Fork 987
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
Fix VRR for constrained cursors #6877
Conversation
With this PR,
hyprland.conf
|
To address the rest of the tests:
With
|
GW2 internal fps limit doesn't seem to do a good job, fps fluctuates around the limit. Mangohud limit fixes that.
Note that there is an issue with switching |
Their limiter is pretty awful even on Windows. Before the latest commit, I retested with the MangoHUD limiter globally enabled with the result:
After f412e11, all previously mentioned issues with GW2/vrrtest except the mouse clicks causing refresh rate to jump seem to be fixed.
I reproduced on vrrtest (and GW2 as well) both before and after the latest commit by:
I cannot verify the exact numbers due to the lack of an OSD. On my system the spikes manifest as backlight flickering.
I only mentioned special workspaces in case it was not intentional for vrr to be broken in them given that fullscreen is possible. It is not working even without cursor movement, irrespective of Subjectively, I would expect any type of workspace to behave similarly and I have a preference for using scratchpads where possible, but named workspaces are fine. Perhaps a name change from "special workspace" could be justified if it's not planned to make them have feature parity (or if it's not possible).
I tested solely with
Understood. I was mainly referring to the |
This PR shouldn't change the |
I wasn't sure initially, but the latest commit reverted functionality to the same as Hyprland main @ bd52682, as far as I can tell. The spikes happen on both main and this PR for my system. It does not occur with a bluetooth controller nor the keyboard. None of the usual suspect keywords (under general, input, misc, or cursor) seem to have an effect on whether it spikes on click. Tested with hardware:
|
I can confirm what Myned is saying. Clicking M1, M2, M3 (mmb), M4, or M5 cause refresh rate spikes. as seen in the video below 20240716_182449.mp4On the other hand I've noticed another bug happening with mouse movements that I'd not encountered before. With 20240716_182921.mp4This can be mitigated by leaving a large gap between monitors (0x0 and 2000x0 vs 0x0 and 1920x0), however this means that you have to move the mouse fast to move between monitors normally and also means that you still get spikes when moving the mouse fast enough to that side. So this leads me to believe that the mouse is leaving the game and moving to the other monitor briefly which is what's causing the spikes in this case.
|
Ok after a quick test I can confirm this is just how Hyprland functions now on the latest git no matter the state of
Just to clarify, the mouse button spikes Myned and I mentioned have been a thing in all Hyprland versions I've ever used. I don't think this PR has anything to do with that. Recent Hyprland versions prior to this PR just don't work with vrr at all when looking around in games so that might have made it harder to notice the mouse button thing between 0.41.0 and this PR where vrr had completely broken. |
Does the spike happen on mouse down, mouse up or both? Can't test it myself, my osd doesn't refresh itself and I don't see such short spikes. |
I can test this tomorrow. But I'm not sure considering it doesn't happen on every single input as you can see from the video I posted. Which is just really odd. |
The spike occurs on mouse down only, for barely a millisecond as indicated above. Movement while mouse down does not incur additional spikes. If I had to guess it could've been a bind, but it still happens with all binds and window rules excluded from the config. I also tested without building with hyprbars to the same effect. I cannot test the multi-monitor issues as I only have one display. Additionally, I don't use hyprctl systeminfo
(Edited for clarity) |
Some additional testing in vrrtest:
|
I can reproduce the mouse click issue but only in some games and combinations of windowed/fullscreen. What's worse though is that VRR doesn't appear to work properly without inputs to begin with: When I run vrrtest at 139 fps, actual vfreq is 144 and stutters ~twice a second. When I run vrrtest at 130 fps, actual vfreq jumps between 144~130 and sometimes dips far below into the 80s-90s, quite stuttery overall. When I run vrrtest at 75 fps, actual vfreq appears to be quite stable but actually jumps around very often (causing stutter) and results in jumps to 90~100 in vfreq from time to time. (Vsync on and AMDGPU in the VR power profile (4).) BTW, if you have an LG monitor, the debug menu has a more frequent vfreq display without as much averaging that also stays on screen permanently via the service menu. Power off, left, left, left, right, power on and then settings, debug info. Other monitors may have similar service menus. |
If you're using |
It's definitely on mouse down for me too. Oddly enough, I found a "fix" for this back in 0.40.0 but that doesn't work on this PR. I'm not sure when that changed as I've been sticking with 0.40.0 since it's the last good vrr build I've found on my testing.
I can't reproduce this at all. My vfreq on all values in vrr test and other applications is within +-1hz from the reported fps. The only change is below 51fps when LFC kicks in, though oddly enough LFC is supposed to be 48 but idk. |
Also, in most games, VSync adds additional overhead without benefit for adaptive refresh, and vrrtest runs by default with it disabled. If there's no difference, it's usually better to disable it. |
Your linked comments sound like fullscreen wasn't being enabled. Did you confirm that VRR is active while the spikes do not occur? A decent way to visually see whether the window is fullscreened properly is with reserved space such as overlays (e.g. waybar). Generally, with normal workspaces, if the overlay is not hidden, the window isn't in true fullscreen. |
Yes I can confirm fullscreen was enabled and that vrr was functioning in both instances. I usually limit the fps to 60 or something in the high double digits when testing to make it very easy to tell if spikes occur both visually and by watching the reported vfreq spike from 2 digits to 3 digits. I have waybar at the top of my screen, it is not visible during fullscreen. On top of that, the testing to confirm that was done with the help of hyprctl's I have no idea why 20240717_155126.1.mp4This video was taken on a regular workspace with As you can see this bug is completely eliminated under these circumstances on 0.40.0. This however does not prevent it on this PR, so something has changed since then. This however really shouldn't be necessary and makes no sense as to why it works. But the weird thing is that it does and because of that I've written a script that checks for floating on fullscreen game windows and fixes it for me, essentially eliminating the bug in a hacky behind the scenes way for me. However since discovering this back on June 22nd I've not been effected by the spikes again until trying this new PR. EDIT: Just to add on another weird vrr oddity, 0.40.0's declaring the |
Do mouse clicks cause spikes with |
They do not! I can also confirm that |
No they do not. So it appears mouse buttons must be doing something like shifting the focus or refocusing for a single frame. Then why does this behaviour not happen on fullscreen applications in 0.40.0 when For reference I use |
Looks like these spikes are caused by |
Then wouldn't |
My bad, it does indeed spike on |
As for
|
It may well be something in my config, but it's definitely not that as that only changes the border color of maximized windows not fullscreened ones and removing that has no effect. The odd thing is nothing in my config changes between Hyprland versions outside of |
I tried the previous version again (7dc595e) and it does indeed feel better, so I wasn't imagining it. However, it also shows the issue I noticed on the newer version with the refresh rate jumping a bit. Though it appears not quite as much? It's that hard to tell. The small judder is not visible in vrrtest however (or at least not to a noticeable degree). |
The newest version is rebased on main and doesn't change anything for sw cursors. Adds some skips for hw. If there is a regression then it comes from changes on main. |
vrrtest and GW2 @ 3d3955f I don't notice anything different with software cursors myself and rapid fluctuations would result in pretty noticeable flicker on my monitor. With hardware cursors it still fluctuates on cursor movement, but very minorly and only in GW2. When the cursor is locked there is no noticeable difference to software cursors, so that's great. |
A merge conflict arose btw. |
Is this still being worked on? I miss having reliable vrr in hyprland without having to swap between versions depending on what input device I want to use. |
This is ready to be merged if there no other way to get rid of unwanted |
Tested this PR to see how games work with it. Quake champions worked well, but Apex legends was very laggy with this PR compared to main branch. I can't really check if vrr is working, because my monitor doesn't have an fps overlay, but I didn't notice any tearing with allow_tearing on. I can maybe add some logs or other details about the Apex legends issue later. Basically the game is running well (Mangohud frametimes), but appears extremely stuttery and possibly shows out of order frames. I also checked if this happens to fix #7414, but it didn't. |
@Cloudperry Have you ensured you're not running into https://gitlab.freedesktop.org/drm/amd/-/issues/1500? Also look up whether there's a debug/service menu for your display which shows this info. I believe all of them do for QA purposes but it's not always documented (usually unofficially). |
I have ran into that quirk before and fixed it, but actually that was the cause. My Corectrl autostart was somehow broken. Now VRR is working really nicely (no tearing when allow_tearing is on) with games capped to 142 fps using Mangohud. On main branch with no_break_fs_vrr I had occasional tearing with the same games, but that testing was with a 143 fps cap. |
when can we expect this to be merged? I would really love to see vrr working on the current build |
idk it's still a PoC |
FWIW, this makes VRR work much better than it did before; it's quite essential honestly. |
I finally found a way to spot the imperfections I've been feeling: Set vrrtest to the lowest speed. The stutters become immediately obvious. This needs a rebase btw. I've done it myself at https://github.com/Atemu/Hyprland/tree/vrr-new-rebased-rebased, resolving conflicts to the best of my ability but I have no way of verifying whether the changes still make sense in integration with the rest of the codebase. It appears to work just like before. (It's atop v43.0 but applies cleanly to 44.0.) |
I don't think there is a better way to fix it. Looks like something similar is required for HW cursors in general. Ready for merging |
Sorry, I'm not following. HW cursors are disabled in my case and it's not visible on screen. I'll have to re-test whether this is the status quo in which case we can move the discussion to another issue. @Gwenodai do you also notice the stutters in low-speed vrrtest? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, let's roll
@Atemu I didn't notice the stutters from my short testing of it. I was just giving a thumbs up for the rebasing and such. Sorry for the confusion 😅 |
Describe your PR, what does it fix/add?
cursor:no_break_fs_vrr
to work with locked cursorsm_pLastMonitor
instead ofgetMonitorFromCursor
with locked cursor in some placesWhen cursor is constrained (and maybe also locked)
g_pSeatManager->sendPointerFrame()
results in an extralistener_commitWindow
call which schedules a frame for monitor. These extra frames break VRR. #5918 (comment)Since there is no direct connection (at least I couldn't find one) between
sendPointerFrame
andlistener_commitWindow
and the latter also happens when an app sends a new frame it is hard to filter unnecessary frame schedules.This PR delays
sendPointerFrame
to be called when an app sends a new frame and then skips the damage from nextlistener_commitWindow
. This fixes VRRbut loses most of the cursor movement between the frames.I don't think that it is the correct way to fix this issue. If it is possible to not get those extra window commit events than it will be a better solution.
Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
If something is wrong with this PR as a whole consider cherry-picking 05de4f3
if clicked on a floating window make it top
comment is misleading.changeWindowZOrder
is called for every clicked window. Is it intended behaviour or a bug?CInputManager::onMouseMoved
might set the cursor position outside the constraint. Some code uses this incorrect position before the constraints are handled. This PR fixes several of such situations. There might be more.Works more reliable when the app is the only one on its workspace.
Is it ready for merging, or does it need work?
Ready if there is no better way to do it.
vrr = 0