Page MenuHome

VSE: 'Prefetch frames' causes excessive CPU usage whenever there is animation on a strip (freezes when tweaking animation [Graph Editor, Dopesheet, typing in new values])
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Linux-5.2.15-200.fc30.x86_64-x86_64-with-fedora-30-Thirty 64 Bits
Graphics card: Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2) Intel Open Source Technology Center 4.5 (Core Profile) Mesa 19.1.6

Blender Version
Broken: version: 2.81 (sub 12), branch: master, commit date: 2019-09-22 20:38, hash: rB52bdf522afcd
Worked: (optional)

Short description of error
When using the Graph Editor Slider on f-curve with Sequencer "Prefetch Frames" ON, Blender Freezes

Exact steps for others to reproduce the error

  • Start New Video Editing File
  • Activate "Prefetch Frames" in the "Sequencer Preview" N-Panel
  • Create a simple "Animation" with a "Color Strip"
  • Go to "Graph Editor", menu "View > Show Sliders"
  • Move the Slider on the animation f-curve -> Freeze

Example File

Event Timeline

Philipp Oeser (lichtwerk) lowered the priority of this task from 90 to High.Sep 24 2019, 2:53 PM

Can confirm the freeze.

This is actually true for all keyframe transforms [be it Graph Editor, Dopesheet, can be sliders, keyframes, tangents...]
Should call BKE_sequencer_prefetch_stop(scene) or similar in the appropriate places in transform code, I guess...

CC @Richard Antalik (ISS)

Philipp Oeser (lichtwerk) renamed this task from [FREEZE] Graph Editor Slider with Prefetch Frames to [FREEZE] tweaking animation on a VSE strip [Graph Editor, Dopwsheet, ...].Sep 24 2019, 3:13 PM

Just noticed that it actually hangs in BKE_sequencer_prefetch_stop, for some reason the thread is not suspended, loops infinitely here

while (pfjob->running) {
  BLI_condition_notify_one(&pfjob->prefetch_suspend_cond);
}

Also: just opening that file seems to spawn a thread that never really finishes?
(keeps one CPU core busy here all the time -- without doing anything in that file)

Can even be reproduced much simpler:

  • File > New > Video Editing
  • in the Sequencer Editor: Add > Color
  • on the created Color strip: insert a keyframe (e.g. on Opacity)
  • in the Preview Editor: enable Prefetch frames
  • inspect CPU usage :( [never finishes...]

Guess this should be fixed asap?
CC @Sergey Sharybin (sergey)

Philipp Oeser (lichtwerk) renamed this task from [FREEZE] tweaking animation on a VSE strip [Graph Editor, Dopwsheet, ...] to VSE: 'Prefetch frames' causes excessive CPU usage whenever there is animation on a strip (freezes when tweaking animation [Graph Editor, Dopesheet, typing in new values]).Sep 25 2019, 12:15 PM

Yes, caused by rBab3a9dc1ed2.

Adding this to 2.81 milestone, if this cant be fixed until then it should probably be reverted?

@Sergey Sharybin (sergey)
I modified prefetch to use same method as pipeline.c to update animdata (not sure if that has changed), but I get random crashes in depsgraph module.

I am using depsgraph to generate scene copy, and rendering it in separate thread. Not sure if method I use (copied from pipeline.c) is designed to do what I need. This was suggested to me by brecht, but I was not 100% sure about what I was doing.

I can revert to making scene copy using scene API, but this may be bug in depsgraph itself.
You can check my attempt to fix this by patching P1118, and messing with animation, while prefetch is enabled.

To confirm bug in depsgraph, I tried to mess with animation while rendering - no crash and no effect on original data.
(did crash when rendering movie strip, but thats unrelated)