Bug 453794 - Krita uses a lot of resources when off-screen but with a document open
Summary: Krita uses a lot of resources when off-screen but with a document open
Status: RESOLVED LATER
Alias: None
Product: krita
Classification: Applications
Component: General (other bugs)
Version First Reported In: 5.0.2
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-14 17:45 UTC by nagisa
Modified: 2022-05-14 19:25 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nagisa 2022-05-14 17:45:30 UTC
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
Comment 1 Halla Rempt 2022-05-14 19:25:37 UTC
We don't support wayland at the moment, at all, and aren't interested in supporting it until we can port Krita to Qt 6. This might be something we could check out by then, but not right now.