Skip to content

Laggy user experience when using VRR display #2294

Open

Description

@JosefNemec
  • .NET Core Version 3.1
  • Windows version: 1903
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes

Problem description:

When using display with variable refresh rate (I only tested it on G-Sync one, but my guess is that the issue will occur on FreeSync too due to the nature of this behavior) the general user experience is not smooth and feels very unresponsive. The issue is that WPF (being DirectX application) is picked up by the display driver and display refresh is adjusted based on framerate output of WPF. However since WPF's framerate is usually bellow 60, this has a big impact on general responsiveness of the interface because even things like moving mouse will be noticeable stuttery. More so if user has display with high refresh rate (like 144Hz), the switch to and from WPF application can be quite jarring.

Expected behavior:

WPF's framerate is not picked up by the graphics driver and refresh rate stays static when using said app. For example I didn't notice this being an issue with UWP or other desktop applications with accelerated GPU rendering.

I understand that technically this is working as intended, but in my opinion it doesn't make much sense for WPF application to be VRR compatible, given the type of applications that are generally created with it. I think it would make more sense to have VRR compatibly turned off by default, but have an option to enable old behavior if possible.

I think this shouldn't be taken lightly since VRR display use is on rise and it's become de facto standard in gaming related PCs (I develop gaming related app and quite a few users noticed this issue).

Minimal repro:

This simple example can be used to reproduce the behavior. Just moving mouse over list box items will force display to render at about 30 fps.

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Height="450" Width="800">
    <Grid>
        <ListBox>
            <ListBoxItem>test</ListBoxItem>
            <ListBoxItem>test</ListBoxItem>
            <ListBoxItem>test</ListBoxItem>
        </ListBox>
    </Grid>
</Window>

Activity

  1. added
    Enhancement Requested
    on Dec 10, 2019
  2. added this to the 5.0 milestone on Dec 10, 2019
  3. arpitmathur commented on Dec 10, 2019

    @arpitmathur
    Contributor

    @JosefNemec Thanks for bringing this up. We will take this into account for our .Net 5.0 planning process.

  4. grandsilence commented on Mar 13, 2020

    @grandsilence

    @arpitmathur any news?

  5. grandsilence commented on Mar 13, 2020

    @grandsilence

    A temporary solution is change adaptive sync mode in Nvidia Control Panel from windows + fullscreen to full screen only mode

  6. s-rog commented on Mar 31, 2020

    @s-rog

    This also breaks VRR when using a WPF rendered overlay while in a game or video playback with VRR.

    Edit: which also includes built in overlays like the volume hud

  7. d4g commented on Sep 4, 2020

    @d4g

    Is there any update on this issue?

  8. ryan-haver commented on Sep 26, 2020

    @ryan-haver

    I assume with the long list of open issues, this likely won't see a resolution any time soon. It would be nice to be able to use VRR without needing to force fullscreen exclusively, although setting fullscreen only mode doesn't seem to solve my issues completely.

  9. Tetedeiench commented on Apr 9, 2021

    @Tetedeiench

    Any update on that issue ? I am affected by this. If anyone know of a workaround that doesn't mean fiddling manually with Nvidia driver settings, I'm interested, I haven't found any.

  10. laurentksh commented on Jul 4, 2021

    @laurentksh

    @arpitmathur any news on this ? Quite ridiculous this issue exists to begin with.

  11. jmonachesi commented on Jul 9, 2021

    @jmonachesi

    Since you won't fix this, probably because it's a DirectX issue, we just need either a way to invalidate the screen at 60/120/144 fps or a way to add an exclusion from VRR/FreeSync/GSync features.

    For instance if we could know how to add into the registry the exclusion an installer could deal with this issue. The first option would be to create a control that would automatically invalidate itself after being painted.

  12. rubenalamina commented on Jul 10, 2021

    @rubenalamina

    This is a big issue and will only get worse as more PC users start using VRR/Gsync/Freesync monitors in their setups. I've been suffering from this issue in a few notable programs like Affinity Photo, Affinity Designer, SafeInCloud, even Windows Terminal has this issue but they have an option to use software rendering to helps as a workaround at least.

    I'm actually surprised that this problem has not been more prominent given many in the .NET dev team and contributors should be using VRR displays and probably already ran into this problem with some programs.

  13. Tetedeiench commented on Jul 11, 2021

    @Tetedeiench

    Spotify also ran into this : https://community.spotify.com/t5/Desktop-Windows/Low-Frame-Rate-with-Desktop-App/td-p/4617800/page/2 (and many others)

    The best solution is WPF not locking its frame rate and leave it at the user selected value (animations can be at whatever fps they want, they leave the refresh rate unlocked)

    Just like about every 3D game out there : a game can run at 40fps with a monitor refresh rate applied set at 120Hz. I wonder why a spinner in WPF couldn't do the same.

    We could argue Nvidia and AMD could leave desktop app out of their VRR feature, but this seems like fixing the problem on the wrong end of things.

    The sad part is that if your app requires a full framework to function (like mine, I want my app to be fully portable without installing some framework beforehand, so I basically target full framework right now), you're left sorry.

  14. rubenalamina commented on Jul 14, 2021

    @rubenalamina

    I finally found a way to alleviate this by using a profile in Nvidia's Control Panel. Previous attempts of setting a profile for the executable with Monitor Technology set to Fixed Refresh didn't work but after trial and error, I found a combination that finally does:

    • Monitor Technology: Fixed Refresh
    • Max Refresh Rate: 60 FPS
    • Preferred Refresh Rate: Highest Available
    • Vertical Sync: Let the 3D Application Decide

    The last one is changed automatically. Gsync recommended configuration is to run Vertical Sync On or let the Application Decide. For games, using it at On is desired to not have to change it on every game but Nvidia's control is changing it for the profile after you change one of the other 3 settings so I let it do that and tested several programs.

    No problems so far on programs like Windows Terminal, Affinity Photo/Designer, even the Windows Feedback Hub and the Xbox App had this issue on my system. With a profile for each executable with the settings above, there's no frame drops when those programs are in focus.

    Having said all that, this is a workaround that is not documented anywhere and is still an issue that should be addressed by either Microsoft, Nvidia, AMD or all of them. VRR usage will just keep increasing as time goes on.

  15. 13 remaining items

  16. elexor commented on Sep 27, 2022

    @elexor

    I'm not exactly sure how to compile and setup wpf. If I can figure it out, I will try.

  17. Symbai commented on Sep 27, 2022

    @Symbai
    Contributor

    @lindexi Why don't you just compile and upload binaries here so everyone with VRR display can test it? I think it would be more useful to get feedback from several VRR users instead of having this tested by only one.

  18. lindexi commented on Sep 27, 2022

    @lindexi
    Member

    @Symbai Thank you. Good idea.

  19. Mgamerz commented on Jan 26, 2023

    @Mgamerz

    This setting pretty much kills my app at 144hz - it depends on a lot of dragging and dropping, and it makes me think the app is always on the verge of a crash. It would be nice if I didn't have to give up 144hz to have a functional application.

  20. milos12345 commented on Jan 26, 2023

    @milos12345

    This should be prioritized and fixed, including for .NET framework, as at this point it makes current WPF software unusable and and hard to justify maintaining existing software, while also making any future WPF development out of consideration with more users getting advanced displays like these.

  21. bugproof commented on Jan 31, 2023

    @bugproof

    This should be prioritized and fixed, including for .NET framework, as at this point it makes current WPF software unusable and and hard to justify maintaining existing software, while also making any future WPF development out of consideration with more users getting advanced displays like these.

    WPF has no future. It's legacy, over-complicated tech. Web-like component frameworks you can style with CSS won. If I ever want to consider making new desktop app it's not going to be WPF. It's a miracle it's still being developed.

  22. milos12345 commented on Jan 31, 2023

    @milos12345

    This should be prioritized and fixed, including for .NET framework, as at this point it makes current WPF software unusable and and hard to justify maintaining existing software, while also making any future WPF development out of consideration with more users getting advanced displays like these.

    WPF has no future. It's legacy, over-complicated tech. Web-like component frameworks you can style with CSS won. If I ever want to consider making new desktop app it's not going to be WPF. It's a miracle it's still being developed.

    This is WPF-specific repo and a specific issue page. Please leave unsolicited advice, unrelated random opinions and pushing personal agendas for Twitter.

  23. MarkIngramUK commented on May 2, 2023

    @MarkIngramUK

    I'm using a .NET 6.0 app, and suffer from mouse movement and UI lagginess when G-Sync is enabled. I have to fully disable the option, I can't even have the Full Screen only option enabled. I'm using an Nvidia 2080 RTX SUPER with ASUS ROG Swift PG27U.
    image

  24. Aemony commented on Nov 4, 2023

    @Aemony

    I'm using a .NET 6.0 app, and suffer from mouse movement and UI lagginess when G-Sync is enabled. I have to fully disable the option, I can't even have the Full Screen only option enabled. I'm using an Nvidia 2080 RTX SUPER with ASUS ROG Swift PG27U. image

    This would suggest the UI app it happens with is triggering Windows modern MPO optimizations, as that allows VRR to engage for windowed applications, as if they were running in fullscreen. That approach is basically the replacement for Nvidia's Enable for windowed and full screen mode option.

    As it stands right now developers would have to make use of the NVAPI to disable G-Sync for their apps, or try to reach out to Nvidia and get their apps blacklisted from G-Sync (something I myself have been unsuccessful in doing so far). I am not aware of a method that would work for AMD or even Intel users, as those don't have the same sort of VRR/driver controls like Nvidia has with their NVAPI.

  25. sipso commented on Nov 18, 2024

    @sipso

    Is there any work being done on this issue?

  26. lindexi commented on Nov 19, 2024

    @lindexi
    Member

    @sipso Sorry no. Could you change the *puiRefreshRate to a larger value, see #2294 (comment)

  27. sipso commented on Nov 19, 2024

    @sipso

    @sipso Sorry no. Could you change the *puiRefreshRate to a larger value, see #2294 (comment)

    I'm not a dev, i use an, or rather would like to use, an app that uses WPF. Is this a simple config file edit?

    Why isn't this being worked on?

  28. Mgamerz commented on Nov 19, 2024

    @Mgamerz
  29. jtbrower commented on Nov 25, 2024

    @jtbrower

    Hello WPF team,

    Please add me as a veteran software engineer who owns a small firm and a large source code base with a 15-year history, licensed to corporate customers, some of whom serve significant end-user bases.

    It is nearly 2025, and after reading through all the comments on this issue, I hope you will forgive me if I am mistaken, but I have not seen any feedback directly from Microsoft beyond the initial acknowledgment of the issue. In a couple of weeks, this issue will have been open for exactly 5 years. From the outside, it appears that it has fallen between the cracks.

    **I wonder, if performance enhancement is truly the proper label? **

    If a WPF application does not take advantage of a monitor's refresh rate when it exceeds 60Hz, that might be classified as a performance request. However, in the context of the reports above, where users are experiencing significant performance degradation—including visible stuttering when dragging a window or moving the mouse, and in some cases, application crashes—this looks more like a bug.

    Specifically, consider the following:

    *pePresentationResults = MilPresentationResults::VSyncUnsupported;

    If this line of C++ code sets the pePresentationResults pointer to VSyncUnsupported, and this failure state is swallowed somewhere in the WPF stack, it leaves developers and end-users with no indication of why their WPF applications are performing poorly (meaning nearly unusable). This lack of error propagation wastes time for developers, tech support, and end-users as they try to identify the root cause.

    Instead, if this failure state were propagated up the WPF stack as an exception, developers would have the visibility needed to address or document the problem, such as recommending workarounds like setting a fixed refresh rate via the NVIDIA control panel.


    Summary

    • Supporting VRR (variable refresh rates) would indeed be a valid performance enhancement if the error weren't being swallowed somewhere in the WPF stack.
    • However, without such support, swallowing the error and leaving end-users without visibility into why their application is unusably slow (stuttering mouse movements, crashing) constitutes a bug.
    • By addressing this issue either as a performance enhancement with proper error handling or as a bug, significant frustration felt by developers, technical support teams, and end-users could be spared.

    The Small Print: When adding my comment, I did not trace through all of the WPF code to see where the VSyncUnsupported result was either addressed or ignored and since nobody else indicated they were seeing exceptions thrown, I made the assumption that this error condition was being swallowed. Though I feel confident in that assumption, this small text shall help cover me otherwise.

  30. Mgamerz commented on Nov 25, 2024

    @Mgamerz

    I write software in WPF for games, where lots of users have high refresh rate displays. This has slowly been becoming a bigger problem over the years. It's really frustrating to me and my affected users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NET FrameworkEnhancement Requested

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions