This patch implements frame prefetching as discussed in https://devtalk.blender.org/t/sequencer-cache-improvement-proposal/2151
Code is unfinished and ugly, but sufficient to present functionality. Sorry for unrelated changes - will fix that.
Prefetching is triggered by rendering a frame.
First, prefetching job is initialized. Essentially SeqRenderData is copied as it will be freed eventually in main thread, and mainly a new Scene is created as a copy of original. This copy of Scene is used for rendering and animdata evaluation.
Number of frames to be prefetched is calculated by simulated run of prefetch.
Prefetch thread will render required amount of frames and store them in cache.
- cache is now member of Scene struct and no longer global.
- Cache limiter is "bypassed"
- Removal of old prefetch code.
- Limit multithreaded effects to keep 1 thread free, when called from prefetch thread. This is because using all possible threads lead to framerate drops.
- Added DNA struct PrefetchSource, some operators and RNA API
Bugs / problems:
- There is still thread collision in blf lib. So please test this not using text strip. Will look at it next time. Don't know that lib, will probably just add some public mutex(multithreaded proxies can use that also)...
- Need to check order of processing of raw data. Did not see color transformation in preprocessing fn. Then merge all preprocessing. Maybe do this in separate patch.
- PrefetchSource list is not restored on reopening the file. Don't know if we want to always start fresh, or restore them.
- Some mem blocks are not freed because I am lazy. But in some cases it seems that cache items are not freed properly. They seems to be allocated without any identifying string and I haven't found, what that is yet.
- fix bugs
- review scene cpy
- support depsgraph - should be separate patch, as a port to 2.8?