Bug 386620 - Canvas framerate limiter might not be working as intended
Summary: Canvas framerate limiter might not be working as intended
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: OpenGL Canvas (show other bugs)
Version: 4.0 pre-alpha
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Bernhard Liebl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-07 17:07 UTC by Neviril
Modified: 2019-09-25 06:09 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neviril 2017-11-07 17:07:46 UTC
Krita 4.0 pre-alpha (git 86851fa) exposes to the user a frame limiting function under "Settings > Configure Krita > Performance > Advanced > Limit Frames per Second while painting".

After fiddling around with it for a while, trying different settings (making sure to restart the program to apply the new values), I came to the conclusion that the frame limiting function might not be working as intended, producing as a result an *effective* canvas update framerate that is roughly (slightly more than) half the user set value.


==How to observe it?==

1) Try setting a low frame limit value, like for example 20 fps.
2) Reboot Krita.
3) Create a new image and proceed to recording a short video capture of the desktop/program at the frame rate of the display frequency rate (typically 60 Hz) using for example the open source OBS (Open Broadcast Studio) software, and a small brush at 100% canvas zoom in order to avoid any GPU bottleneck issue.
4) The framerate of the canvas in Krita can then be easily analyzed using a standard video player (e.g. VLC) advancing the video frame by frame.


==Results==

At a Krita canvas fps of 20 fps, and a video framerate of 60 fps, brush strokes and the brush cursor appear to update roughly every 5 or 6 frames (sometimes 4 or 7). This corresponds to an *effective* canvas frame rate of 10-12 fps, which is significantly lower than the user set value.

At a Krita canvas fps of 60 fps (equivalent to the display refresh rate) and again a recording video frame rate of 60 fps, bursh strokes appear to update most of the time 2 frames, less often every frame. In a test, the canvas updated 44 times over the course of 69 frames, implying an actual framerate of about 38 fps. That the canvas updates at a much lower rate than the screen refresh rate is also subjectively noticeable by eye during ordinary program operation.


==System configuration==

Windows 10 64bit Fall Creators Update
AMD Radeon RX480 with Radeon Software 17.11
Intel i5 3550 4-core GPU.
Comment 1 Halla Rempt 2017-11-08 10:39:03 UTC
Bernhard,

Could you take a look? I'm wondering whether this is related to 

commit 4cb82985c37e07d8e628094fb137169c35ac1df6
Author: Bernhard Liebl <poke1024@gmx.de>
Date:   Sun Oct 22 13:51:07 2017 +0200

    Adds a user configuration for maximum fps for canvas updates
    
    Under "Performance / Advanced / Limit Frames per Second" there is now a slider that allows the configuration of the targeted frames per second updates the canvas should receive. This configures the updateSignalCompressor in KisCanvas2 to not trigger update events more often. Having a lower fps gives the main thread more time to do other QT event processing, which could be beneficial one some machines/installations.
    
    Differential Revision: https://phabricator.kde.org/D8193

As Neviril's bisect seems to suggest.
Comment 2 Bernhard Liebl 2017-11-13 22:13:19 UTC
see https://phabricator.kde.org/D8804
Comment 3 Dmitry Kazakov 2019-09-25 06:09:01 UTC
I think I have fixed exactly this bug, when fixing bug 409460. Please check if the problem still persists in the nightly builds (I don't think it is available in 4.2 branch):

https://binary-factory.kde.org/job/Krita_Nightly_Windows_Build/

If the bug still present, please reopen this report :)