Bug 416706 - Krita last-used filter performance problem
Summary: Krita last-used filter performance problem
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Filters (show other bugs)
Version: 4.2.7
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: vanyossi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-24 18:44 UTC by Kruthers
Modified: 2020-01-28 09:50 UTC (History)
2 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 Kruthers 2020-01-24 18:44:03 UTC
Krita appears to be executing the last-used-filter every time you bring up the filter dialog, then throwing the result away, before allowing you to make adjustments.  I only noticed this when the "halftone" filter was remembered as the last-used filter, because it's very slow to calculate.

See this forum topic for more details if interested: https://forum.kde.org/viewtopic.php?f=139&t=164322
(ie. Halftone filter "virus" infected my files)

Also, this might be a second bug, but the other reason this was so noticable is that krita would remember the last-used filter as "halftone" even after I used the HSV adjust filter many times.  So every HSV adjustment I made would have a long wait while the halftone filter was run then discarded.  Tell me if you want me to open a 2nd report for this.

The last-used filter ends up saved in the kritarc prefs file, so the problem continues even after quitting and restarting krita.


STEPS TO REPRODUCE
1. Make a new document, make a stroke or something visible
2. Bring up the HSV filter dialog with the sidebar, go to artistic -> halftone, let it preview, then click cancel
2a. You may have to save the result of the halftone, then undo it?  Hard to tell exactly when krita gets stuck on this filter
3. Bring up the HSV filter again, and there will be a long wait with a blue progress bar on the layer


OBSERVED RESULT

Long wait when bringing up the HSV dialog.

EXPECTED RESULT

No waiting.


krita version:  krita-4.2.7-beta1-x86_64.appimage
(also happened in 4.2.8 when halftone was saved in prefs)

Ubuntu 18.04.3 LTS
kde plasma version: 5.12.9
kde frameworks version: 5.44.0
qt version: 5.9.5

kernel version: 4.15.0-74-generic
Comment 1 Ahab Greybeard 2020-01-24 21:49:37 UTC
I was initially unable to reproduce this on 4.2.6 to 4.2.9(Stable) appimages

The kritarc entry for me  was FilterSelector/LastUsedFilter=gaussian blur  and was unchanged no matter which filter I used.

I found filterdialog/rememberlastpreset=false and changed it to true and was unable to reproduce the fault.
The entry for FilterSelector/LastUsedFilter=  did not change no matter which filter I used.

If I changed it to FilterSelector/LastUsedFilter=halftone then I could not reproduce the fault.

However, if I deleted kritarc and restarted with fresh configuration the entry for FilterSelector/LastUsedFilter= did not get recorded in kritarc.

I manually made filterdialog/rememberlastpreset=true and the FilterSelector/LastUsedFilter= line did not appear in kritarc after filter uses and restarts.

Then I manually entered FilterSelector/LastUsedFilter=halftone and then the fault appeared exactly as described in the initial report.

There are probably other entries in kritarc which I'm not aware of that may be significant in this matter.

Maybe if you edit kritarc to have filterdialog/rememberlastpreset=false (if it is set to true for you)?

Does your FilterSelector/LastUsedFilter= entry ever change after using the filters?
Comment 2 vanyossi 2020-01-24 23:58:08 UTC
Confirming the strange behaviour.

filterdialog/rememberlastpreset controls as far as the code is telling me, if a user preset for the current filter should reopen next session. It has no control over FilterSelector/LastUsedFilter

FilterSelector/LastUsedFilter always gets written to the last entry, and from what I can see it also gets "triggered" to render when the filterGallery is open.

This is indeed a bug.
Comment 3 Kruthers 2020-01-25 01:23:18 UTC
(In reply to Ahab Greybeard from comment #1)
.
.
.
 > Maybe if you edit kritarc to have 
filterdialog/rememberlastpreset=false (if
 > it is set to true for you)?
 >
 > Does your FilterSelector/LastUsedFilter= entry ever change after 
using the
 > filters?

I just quit out of Krita and checked my ~/.config/kritarc file and found 
the following:

filterdialog/rememberlastpreset=false
FilterSelector/LastUsedFilter=levels

I didn't change rememberlastpreset so it was already false.  And 
LastUsedFilter should not be levels; I haven't used that filter at all 
today (that I recall).  The one I probably used last is the HSV/HSL 
filter which I'm using constantly.  So that's confusing...

Anyway, hope this is helpful.
Comment 4 Ahab Greybeard 2020-01-25 05:20:00 UTC
I forgot that I'd changed showFilterGallery because I was fixating on filterdialog/rememberlastpreset

In my 'normal/usual' kritarc file (the one I restore from backup after any tests or config clearing) I have the following, in order:

Selector/LastUsedFilter=gaussian blur (this does not change after any filter use)
filterdialog/rememberlastpreset=false
setShowFilterGalleryLayerMaskDialog=true
showFilterGallery=false

In a totally fresh kritarc file those entries do not exist. After use of gaussian blur then HSV adjustment then Quit, I have, in order:

filterdialog/rememberlastpreset=false
showFilterGallery=false
setShowFilterGalleryLayerMaskDialog (is not present)
Selector/LastUsedFilter= (is not present after repeated use of filters and restarts)

In the fresh config kritarc file that shows the reported fault after manual changes, I have, in order:

FilterSelector/LastUsedFilter=halftone (manually entered and set, does not change)
filterdialog/rememberlastpreset=true (manually set, I don't know how it's supposed to change)
showFilterGallery=true (manually set, I don't know how it's supposed to change)
setShowFilterGalleryLayerMaskDialog (is not present)
Comment 5 vanyossi 2020-01-25 06:41:45 UTC
This bug is fixed and awaiting revision: https://invent.kde.org/kde/krita/merge_requests/229

(In reply to Ahab Greybeard from comment #4)
> In a totally fresh kritarc file those entries do not exist. After use of
> gaussian blur then HSV adjustment then Quit, I have, in order:
>
kritarc entries are created as they are needed, if you have keys missing its because you have not performed the action so they are created. That does not mean there is a problem with your krita installation.

toSelector/LastUsedFilter is only created if you choose a filter from the filter list on the left of the filter dialog.

filterdialog/rememberlastpreset is only created when you tick the ckeckbox on top of all filters to remember custom user fitler presets and the dialog is closed.

showFilterGallery: is created when you press "Ok" to apply the filter.

setShowFilterGalleryLayerMaskDialog is created after you have used at least one Filter Mask.
Comment 6 Ahab Greybeard 2020-01-25 08:40:18 UTC
@vanyossi

Thank you for the fix and the explanation.
I now see that if I use a filter layer/mask then the LastUsedFilter does get updated.
Comment 7 Halla Rempt 2020-01-27 10:58:29 UTC
Git commit b4687e72717eaf9ec077cb9ea46ac2297b85dc72 by Boudewijn Rempt, on behalf of Ivan Yossi.
Committed on 27/01/2020 at 10:29.
Pushed by rempt into branch 'master'.

Don't load LastUsedFilter using Menu Filter

When the filter was called from the Menu, we dont load the LastUsedFilter as we change the filter later and 
some filters may take a long time to process.

M  +1    -1    libs/ui/widgets/kis_filter_selector_widget.cc

https://invent.kde.org/kde/krita/commit/b4687e72717eaf9ec077cb9ea46ac2297b85dc72
Comment 8 Halla Rempt 2020-01-28 09:50:29 UTC
Git commit a299ddefa133a158da81af445367fd4087c95f88 by Boudewijn Rempt, on behalf of Ivan Yossi.
Committed on 28/01/2020 at 09:18.
Pushed by rempt into branch 'krita/4.2'.

Don't load LastUsedFilter using Menu Filter

When the filter was called from the Menu, we dont load the LastUsedFilter as we change the filter later and 
some filters may take a long time to process.
(cherry picked from commit b4687e72717eaf9ec077cb9ea46ac2297b85dc72)

M  +1    -1    libs/ui/widgets/kis_filter_selector_widget.cc

https://invent.kde.org/kde/krita/commit/a299ddefa133a158da81af445367fd4087c95f88