https://bugs.kde.org/show_bug.cgi?id=453794

            Bug ID: 453794
           Summary: Krita uses a long of CPU when off-screen but with a
                    document open
           Product: krita
           Version: 5.0.2
          Platform: Other
                OS: Other
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: General
          Assignee: krita-bugs-n...@kde.org
          Reporter: k...@kazlauskas.me
  Target Milestone: ---

SUMMARY

When krita is off-screen (on Wayland, so frame callbacks are not being sent),
krita keeps both a CPU and GPU in high power states by continuously giving them
work to do. This only happens when a document is open. Otherwise krita appears
to be idle.

The strace would suggest that krita continues running its rendering loop in a
way that's not tied to frame present events from the compositor:

```
getpid()                                = 905987
getpid()                                = 905987
getpid()                                = 905987
getpid()                                = 905987
ioctl(11, DRM_IOCTL_I915_GEM_EXECBUFFER2, 0x7ffd6b4c4a00) = 0
ioctl(11, DRM_IOCTL_I915_GEM_MADVISE, 0x7ffd6b4c490c) = 0
ioctl(11, DRM_IOCTL_SYNCOBJ_DESTROY, 0x7ffd6b4c4980) = 0
ioctl(11, DRM_IOCTL_I915_GEM_MADVISE, 0x7ffd6b4c48dc) = 0
ioctl(11, DRM_IOCTL_SYNCOBJ_WAIT, 0x7ffd6b4c4760) = 0
ioctl(11, DRM_IOCTL_I915_GEM_MADVISE, 0x7ffd6b4c484c) = 0
ioctl(11, DRM_IOCTL_SYNCOBJ_CREATE, 0x7ffd6b4c4950) = 0
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6,
[{iov_base="\221\1\22\0\"\0\0\1\362\1\0\1\216\4\7\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
iov_len=72}], 1) = 72
poll([{fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 2, 1) = 0 (Timeout)
poll([{fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 2, 10) = 0 (Timeout)
poll([{fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 2, 10) = 0 (Timeout)
poll([{fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 2, 10) = 0 (Timeout)
poll([{fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 2, 9) = 0 (Timeout)
poll([{fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 2, 10) = 0 (Timeout)
poll([{fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 2, 89) = 0 (Timeout)
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
poll([{fd=5, events=POLLIN}, {fd=14, events=POLLIN}], 2, 0) = 1 ([{fd=5,
revents=POLLIN}])
read(5, "\1\0\0\0\0\0\0\0", 16)         = 8
getpid()                                = 905987
futex(0x92bcb40, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x92bcaf0, FUTEX_WAKE_PRIVATE, 1) = 1
ioctl(11, DRM_IOCTL_SYNCOBJ_WAIT, 0x7ffd6b4c4020) = 0
ioctl(11, DRM_IOCTL_SYNCOBJ_WAIT, 0x7ffd6b4c4020) = 0
ioctl(11, DRM_IOCTL_SYNCOBJ_WAIT, 0x7ffd6b4c4020) = 0
futex(0x92bcb44, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x92bcaf0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x92bcb40, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x92bcaf0, FUTEX_WAKE_PRIVATE, 1) = 1
ioctl(11, DRM_IOCTL_I915_GEM_EXECBUFFER2, 0x7ffd6b4c4bc0) = 0
ioctl(11, DRM_IOCTL_I915_GEM_MADVISE, 0x7ffd6b4c4a9c) = 0
ioctl(11, DRM_IOCTL_SYNCOBJ_WAIT, 0x7ffd6b4c4920) = 0
ioctl(11, DRM_IOCTL_I915_GEM_MADVISE, 0x7ffd6b4c4a0c) = 0
ioctl(11, DRM_IOCTL_SYNCOBJ_CREATE, 0x7ffd6b4c4b10) = 0
getpid()                                = 905987
getpid()                                = 905987
getpid()                                = 905987
getpid()                                = 905987
```


STEPS TO REPRODUCE
1. Open krita, and within it a new document in a Wayland environment;
2. Minimize or otherwise hide the window in such a way that the compositor
stops sending frame callbacks to the application (on sway I did so by leaving
krita to run in another workspace);
3. Observe the resource utilization of krita with strace and/or top and/or
powertop and/or other introspection utilities.

OBSERVED RESULT

Krita continues rendering to void.

EXPECTED RESULT

Krita should stop its render loop.

SOFTWARE/OS VERSIONS
Windows: N/A
macOS: N/A
Linux/KDE Plasma: nixOS (nixpkgs from bc41b01dd7a9fdffd32d9b03806798797532a5fe)
KDE Plasma Version: N/A
KDE Frameworks Version: N/A
Qt Version: 5.15.3

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to