hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
18.59k stars 773 forks source link

Monitor refresh rate fluctuates even with VRR off #5716

Open kohsine opened 3 months ago

kohsine commented 3 months ago

Hyprland Version

System/Version info ```sh Hyprland, built from branch at commit fe7b748eb668136dd0558b7c8279bfcd7ab4d759 (props: bump version to 0.39.1). Date: Tue Apr 16 16:01:03 2024 Tag: v0.39.1, commits: 4460 flags: (if any) System Information: System name: Linux Node name: kevinarch Release: 6.8.7-zen1-1-zen Version: #1 ZEN SMP PREEMPT_DYNAMIC Wed, 17 Apr 2024 15:20:00 +0000 GPU information: 2d:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] [1002:73bf] (rev c1) (prog-if 00 [VGA controller]) os-release: NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo plugins: ```

Bug or Regression?

Regression

Description

My monitor's refresh rate fluctuates from 165 to 141hz. Problem still persists even after turning VRR off.

How to reproduce

Open at least one window and check monitor refresh rate.

Crash reports, logs, images, videos

No response

vaxerski commented 3 months ago

if this is a regression, please provide a git bisect

generally this is expected to happen if you are looking at the debug:overlay, if nothing changes on screen, no additional frames will be pushed to save resources.

kohsine commented 3 months ago

if this is a regression, please provide a git bisect

Will do.

generally this is expected to happen if you are looking at the debug:overlay, if nothing changes on screen, no additional frames will be pushed to save resources.

That makes sense but there's still some strange behavior here. When I disable vrr from my monitor settings the fps in debug overlay maintains a static 165fps. When I enable vrr from my monitor settings the fps in debug overlay starts to fluctuate regardless of what the vrr option in my hyprland config is set to. My understanding of how it should work is that if I have vrr set to off in my hyprland config it should maintain a static 165fps regardless of whether my monitor has vrr set to on or off?

kohsine commented 3 months ago

In fewer words, if I have variable refresh rate disabled in the hyprland config my refresh rate should not vary.

vaxerski commented 3 months ago

that's not how this works

kohsine commented 3 months ago

Interesting, why only drop the fps to around 141fps or 85-90%? If nothing changes and power saving is the goal couldn't you drop it far lower?

kohsine commented 3 months ago

This can't be right, I've disabled my monitor's VRR fully and the fps shown by debug overlay is now stable... correct me if I'm wrong but Hyprland's fps should be completely independent of whatever the hell my monitor is doing. I'm starting to think this is a mesa driver bug since I noticed sway has the same issue.

The-Briel-Deal commented 3 months ago

This is not the case for me with a 6900xt and lg c2. When VRR is enabled, rr varies, when VRR is disabled, rr stays right at 120.

One problem I have had is vrr staying on until restarting the compositor. Maybe make sure you restart hyprland after enabling vrr?

Also, are you using HDMI or DP. I've definitely had problems similar in the past with HDMI because 2.1 isn't officially supported in amd driver. If thats it get a DP to HDMI 2.1 adapter so that you can use DP output on your card.

kohsine commented 3 months ago

@The-Briel-Deal My monitor's refresh rate is fine and follows what you described. The issue I'm having is Hyprland's fps shown by debug:overlay. It remains stable when my monitor VRR is off and fluctuates when my monitor VRR is on which makes no sense to me.

EDIT: I should specify this is with hyprland's vrr option set to off for both.

kohsine commented 3 months ago

https://github.com/hyprwm/Hyprland/assets/21131329/313fc754-7ac7-4033-8f95-a7aeff5471e1

As you can see from the video, my fps in the top left corner is having a field day and going up and down and up and down again. Monitor VRR is enabled and hyprland vrr is set to 0.

vaxerski commented 3 months ago

that's expected, though yea it should drop far lower, but iirc the overlay itself queues some frames so that it can be up-to-date. You can see that when animation occurs it is back up to speed. I don't see any issues here

kohsine commented 3 months ago

Sorry to keep going with this but still not entirely convinced. Sure maybe it should drop but why is it going up and down like that when there is absolutely nothing happening on screen. It should just drop to a steady 140 and back up to 165 during an animation instead of fluctuating like that. I will record again with an earlier version of hyprland (and wlroots) because I'm pretty sure this didn't always happen.

kohsine commented 3 months ago

https://github.com/hyprwm/Hyprland/assets/21131329/a224c0cf-de3c-4948-b3b8-2fa1f9b10f96

Video of Hyprland on v0.35.0. Same exact config and settings as the last video. Monitor VRR is enabled and hyprland VRR is 0. FPS is maintaining a stable 164 fps at all times. At one point it drops to 163 for a second but not a huge deal.

vaxerski commented 3 months ago

it's staying at 165 just because it renders the overlay every frame. If you disable it, the fps will drop likely to 0.

edit: it's also worth noting the fps have nothing to do with your refresh rate

The-Briel-Deal commented 3 months ago

Lol. I am absolutely not the person to ask about this but it seems like this isn't seriously impacting user experience?

Are there any problems in actual usage, or was this just a problem with the frame counter?

kohsine commented 3 months ago

edit: it's also worth noting the fps have nothing to do with your refresh rate

Incorrect, I have a VRR monitor so whatever fps is shown on the debug overlay is what my monitor's refresh rate is adjusting to. I can see my monitor refresh rate adjusting live to hyprland's fps.

Lol. I am absolutely not the person to ask about this but it seems like this isn't seriously impacting user experience?

~If you don't have a vrr monitor you probably wouldn't even notice~. In fact even with a vrr monitor you wouldn't. Maybe some flickering but thats a big maybe. You're right in that end users probably won't notice but I think outputting the correct frames and number of frames should be pretty important to a desktop.

EDIT: Users without a vrr monitor would not experience this issue at all. I know this because when I disable my monitor's VRR the fps maintains a steady 165 fps which is how I am working around this issue now.

vaxerski commented 3 months ago

if you want to always force your monitor to match 165fps, you can disable vfr, but it comes at a cpu usage penalty, so don't come crying later that hyprland is using 15% cpu at idle

kohsine commented 3 months ago

Tried disabling vfr and it's better. Doing nothing it maintains 165fps. It still dips for some reason but definitely a step in the right direction.

How do I re-enable vfr? Tried setting it back to true and removing it entirely but I think it's still disabled. Is there some way to check that I've re-enabled it?

vaxerski commented 3 months ago

if you enabled it, it's enabled

if there are any regressions, always provide a bisect. I still don't really know what the issue is.

kohsine commented 3 months ago

if there are any regressions, always provide a bisect.

My mistake. It's not a regression. I checked as far back as release v0.35.0 but the behavior is consistent.

I still don't really know what the issue is.

Monitor VRR Hyprland VRR Hyprland FPS
Enabled 0 141 - 165
Disabled 0 165
Enabled 1 48 - 165
Disabled 1 165

Rows 2, 3, and 4 all seem correct to me. My issue is with row 1. The only difference between row 1 and 2 is my monitor's VRR and the FPS. Is the compositor checking if my monitor has VRR capability and deciding to lower the fps? And for some reason only to 141fps?

These results were also checked without the debug overlay because it inserts its own frames and messes up the real fps.

vaxerski commented 3 months ago

No clue, that's up to wlroots

Atemu commented 1 month ago

I can reproduce at least the part where the monitor's front porch is being varied despite vrr = 0 and I have a repro:

  1. Set vrr = 0 and restart Hyprland (confirm it in hyprctl monitors)
  2. Enable Monitor's OSD debug display
  3. Open https://www.vsynctester.com/ in Firefox (switching to a tab of this site also works)
  4. Observe short drop from 144Hz to 125Hz

Monitor's refresh rate should remain constant and VRR not active.

No clue, that's up to wlroots

What parts of the chain here are "up to wlroots" exactly?

Atemu commented 1 month ago

I cannot reproduce this error in Sway using upstream wlroots 0.17.3.