Bug 436642 - Infinite "update" loop with transform mask
Summary: Infinite "update" loop with transform mask
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resize/Scale Image/Layer (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-05-05 16:50 UTC by grum999
Modified: 2021-06-14 22:22 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Example of inifite loop update clearly visible (1.59 MB, video/webm)
2021-05-05 16:50 UTC, grum999
Details

Note You need to log in before you can comment on or make changes to this bug.
Description grum999 2021-05-05 16:50:27 UTC
Created attachment 138173 [details]
Example of inifite loop update clearly visible

SUMMARY

When a transform mask is applied, krita is entering in an infinite loop to update again and again and again the render...

STEPS TO REPRODUCE
1. Create a paint layer, draw some stuff
2. Add a transform mask apply a transformation 
   - A basic transformation (scale+rotation) is enough to reproduce bug
3. Krita apply transformation again and again and again

Ok, here we can tell "how do you see it?"
So let's continue a little bit in steps to clearly see what's happening

4. Add filter a layer "halftone", mode "intensity", screen generator "DITH 0404 WAVE"
5. Activate log docker
   - You'll see:
PatternGeneratorConfiguration::pattern "DITH 0404 WAVE"
LocalResourceSource::resourceForName "DITH 0404 WAVE"

6. wait for a while
   - On my side after 1h30 without doing nothing, thousands of log lines are generated 

Worst situation: in my situation, I have multiple filters layers (gaussian blur,  HSV adjustment, ...)
7. Add some other filter layers
   - We can see in layer stack all filter layer are continuously refreshed, more filter layer you have, more it's visible

8. Deactivate transform mask, infinite loop is stopped, until transform mask is reactivated


OBSERVED RESULT
- See STEPS TO REPRODUCE for observed results
- According to image complexity (dimension, number of filters layer to recalculate and their type) krita is consumming 100%CPU on many cores
- I've attached a webm file where we can see:
  . the "update" progress bar in status bar (right-bottom side)
  . the log docker, in which log are added (difficult to see, but when I select content we can it disappear)
  . the layer stack: we can see activity when tiles are recalculated, there's a "blink" of white areas that is occurring in a kind of loop cycle



EXPECTED RESULT
- Once transformation layer is applied, it shouldn't be refreshed in a loop


SOFTWARE/OS VERSIONS
 Version: 5.0.0-prealpha (git 91625c4)

Note: with Krita 4.4.3, problem doesn't appear; we can expect that Krita 5.0.0 is working as well as Krita 4.4.3 :-)



Grum999
Comment 1 grum999 2021-05-05 17:08:39 UTC
Note: maybe a consequence of bug fix for https://bugs.kde.org/show_bug.cgi?id=435296
?

Grum999
Comment 2 Ahab Greybeard 2021-05-06 09:44:49 UTC
I can confirm this for the May 06 5.0.0-prealpha (git 0967b8a37e) portable .zip on Windows 10.

Tested with a single paint layer and a simple transform mask as advised above.

There is activity on the transform mask every four seconds as observed on its progress bar and also corresponding CPU activity as observed using the Windows Task Manager.
Comment 3 Halla Rempt 2021-05-14 10:21:31 UTC
This is a regression then?
Comment 4 grum999 2021-05-14 10:24:06 UTC
Hi

As it's working properly in Krita 4.4.3, we can consider it as a regression I think.



Grum999
Comment 5 Halla Rempt 2021-05-14 10:24:48 UTC
Thanks for confirming that.
Comment 6 Dmitry Kazakov 2021-05-18 12:05:22 UTC
The bug is introduced by this commit: 2edd4823e656cc0c4d3177aaeb8000165d1e1606
Comment 7 Dmitry Kazakov 2021-05-20 11:01:00 UTC
Git commit 348d57b23bffaca39c51e0b558460158c5e745c1 by Dmitry Kazakov.
Committed on 20/05/2021 at 11:00.
Pushed by dkazakov into branch 'master'.

Fix rendering of the final projection if the transform mask

There was a misprint in KisTransformMaskAdapter::transformDevice(),
which called a wrong function override.
Related: bug 435296, bug 435599

M  +1    -1    libs/image/kis_recalculate_transform_mask_job.cpp
M  +1    -1    plugins/tools/tool_transform2/kis_transform_mask_adapter.cpp

https://invent.kde.org/graphics/krita/commit/348d57b23bffaca39c51e0b558460158c5e745c1
Comment 8 Dmitry Kazakov 2021-05-20 11:01:06 UTC
Git commit 8af1c65e17039ae5deacff860a1f629771d3e366 by Dmitry Kazakov.
Committed on 20/05/2021 at 07:41.
Pushed by dkazakov into branch 'master'.

Revert "Fixed two bugs regarding animated content and transforms."

This reverts commit 2edd4823e656cc0c4d3177aaeb8000165d1e1606.

This patch introduces infinite transform mask updates:
https://bugs.kde.org/show_bug.cgi?id=436642

M  +0    -4    libs/image/kis_layer_utils.cpp
M  +2    -4    libs/image/kis_recalculate_transform_mask_job.cpp

https://invent.kde.org/graphics/krita/commit/8af1c65e17039ae5deacff860a1f629771d3e366
Comment 9 grum999 2021-05-20 22:07:41 UTC
Hi Dmitry


Thanks!
Just tested, seems to be Ok now :) 

I'll try to do additional tests with transform layer this week-end


Grum999
Comment 10 grum999 2021-06-14 22:22:05 UTC
Hi

I find a case in which I'm able to reproduce the "infinite update loop".
But it's also related with animation (the way to produce bug is not the same, need to use transform mask + animation curves)

Do I reopen this bug with additional information to reproduce problem (as it's the same consequence), or do I create a new dedicated bug (as condition to produce it is not exactly the same) ?


Grum999