Bug 432284

Summary: Krita idles at non-zero CPU/GPU usage if a selection is active, when minimized
Product: [Applications] krita Reporter: Pieter-Jan Briers <pieterjan.briers>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 4.4.2   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Pieter-Jan Briers 2021-01-29 17:33:18 UTC
SUMMARY

Presumably due to the ants animation around the selection area, Krita idles at non-zero CPU/GPU when you have a selection active. Now obviously if you're actively using the program this makes sense (has to play the animation somehow), but when you aren't using it and have it minimized this probably shouldn't be the case?

On my system this results in about 0.3% CPU and 2.5% GPU usage.

This is far from significant of course (I have many other programs that are way worse offenders CPU wise) but it still isn't ideal for users on battery. Krita does still get listed as "very low" power usage in Task Manager but I figured every little bit helps?

Seems like just disabling the animation if the window is minimized might be easy enough? Spotify does the same from what I can tell. Disabling the animation when the window isn't in focus might be harder to justify since you could simply be focused on a window on another monitor or such, but minimized should have no such problem.

STEPS TO REPRODUCE
1. Create a new image
2. Hit ctrl+a to select all
3. Minimize Krita
4. Check task manager for CPU/GPU usage.

OBSERVED RESULT
Krita consumes about 0.3% CPU and 2.5% GPU 0 (iGPU) on my laptop.

EXPECTED RESULT
Krita to consume 0% CPU and 0% GPU like it does with no selection active.


SOFTWARE/OS VERSIONS
Windows 10 Pro, build 19042.746
Comment 1 Dmitry Kazakov 2022-07-12 11:36:01 UTC
Git commit 885bff93ec7765d7592583b89b8dfd4f4c755f76 by Dmitry Kazakov, on behalf of Bip Boop.
Committed on 12/07/2022 at 11:35.
Pushed by dkazakov into branch 'master'.

Reduce idle cpu usage when a selection is active

I made it so that when a canvas widget receives a show/hide event 
it notifies its decorations accordingly. This reduces idle cpu 
usage when the application is minimized and a selection is active
because it prevents the ant animation from updating.

M  +3    -0    libs/ui/canvas/kis_canvas_decoration.cc
M  +2    -0    libs/ui/canvas/kis_canvas_decoration.h
M  +6    -1    libs/ui/canvas/kis_canvas_widget_base.cpp
M  +1    -0    libs/ui/canvas/kis_canvas_widget_base.h
M  +12   -0    libs/ui/canvas/kis_qpainter_canvas.cpp
M  +3    -1    libs/ui/canvas/kis_qpainter_canvas.h
M  +8    -0    libs/ui/kis_selection_decoration.cc
M  +2    -0    libs/ui/kis_selection_decoration.h
M  +12   -1    libs/ui/opengl/kis_opengl_canvas2.cpp
M  +3    -0    libs/ui/opengl/kis_opengl_canvas2.h

https://invent.kde.org/graphics/krita/commit/885bff93ec7765d7592583b89b8dfd4f4c755f76
Comment 2 Dmitry Kazakov 2022-07-12 11:37:30 UTC
Git commit ddb334257d56ade639451d40265c5c47f173e474 by Dmitry Kazakov, on behalf of Bip Boop.
Committed on 12/07/2022 at 11:37.
Pushed by dkazakov into branch 'krita/5.1'.

Reduce idle cpu usage when a selection is active

I made it so that when a canvas widget receives a show/hide event 
it notifies its decorations accordingly. This reduces idle cpu 
usage when the application is minimized and a selection is active
because it prevents the ant animation from updating.

M  +3    -0    libs/ui/canvas/kis_canvas_decoration.cc
M  +2    -0    libs/ui/canvas/kis_canvas_decoration.h
M  +6    -1    libs/ui/canvas/kis_canvas_widget_base.cpp
M  +1    -0    libs/ui/canvas/kis_canvas_widget_base.h
M  +12   -0    libs/ui/canvas/kis_qpainter_canvas.cpp
M  +3    -1    libs/ui/canvas/kis_qpainter_canvas.h
M  +8    -0    libs/ui/kis_selection_decoration.cc
M  +2    -0    libs/ui/kis_selection_decoration.h
M  +12   -1    libs/ui/opengl/kis_opengl_canvas2.cpp
M  +3    -0    libs/ui/opengl/kis_opengl_canvas2.h

https://invent.kde.org/graphics/krita/commit/ddb334257d56ade639451d40265c5c47f173e474