Blender V5.3
prefetch.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <algorithm>
10#include <cstdlib>
11#include <cstring>
12#include <limits>
13
14#include "MEM_guardedalloc.h"
15
16#include "DNA_scene_types.h"
17#include "DNA_screen_types.h"
18#include "DNA_sequence_types.h"
19#include "DNA_space_types.h"
20
21#include "BLI_threads.hh"
22
23#include "IMB_imbuf.hh"
24
25#include "BKE_anim_data.hh"
26#include "BKE_animsys.hh"
27#include "BKE_context.hh"
28#include "BKE_global.hh"
29#include "BKE_layer.hh"
30#include "BKE_main.hh"
31#include "BKE_scene.hh"
32
33#include "DEG_depsgraph.hh"
37
38#include "GPU_context.hh"
39
40#include "SEQ_channels.hh"
41#include "SEQ_iterator.hh"
42#include "SEQ_prefetch.hh"
43#include "SEQ_relations.hh"
44#include "SEQ_render.hh"
45#include "SEQ_sequencer.hh"
46#include "SEQ_time.hh"
47
48#include "prefetch.hh"
49#include "render.hh"
50
51namespace blender {
52
53struct RenderResult;
54struct Scene;
55struct ThreadSlot;
56
57namespace seq {
58
59/* Prefetch several frames before the playhead, so that it is fast to move it a bit backwards. */
60static constexpr int before_playhead_frames = 5;
61
63 PrefetchJob *next = nullptr;
64 PrefetchJob *prev = nullptr;
65
66 Main *bmain = nullptr;
67 Main *bmain_eval = nullptr;
68 Scene *scene = nullptr;
69 Scene *scene_eval = nullptr;
70 Depsgraph *depsgraph = nullptr;
71
74
75 ListBaseT<ThreadSlot> threads = {};
76
77 /* context */
80
81 /* prefetch area */
82 int cfra = 0;
84 int timeline_end = 0;
87 int cache_flags = 0; /* Only used to detect cache flag changes. */
88
89 /* Control: */
90 /* Set by prefetch. */
91 bool running = false;
92 bool waiting = false;
93 bool stop = false;
94 /* Set from outside. */
95 bool is_scrubbing = false;
96
97 public:
98 void init_depsgraph();
99 void free_depsgraph();
100
101 void init_gpu();
102 void free_gpu();
103};
104
106{
107 if (scene && scene->ed) {
108 return scene->ed->runtime->prefetch_job;
109 }
110 return nullptr;
111}
112
114{
115 PrefetchJob *pfjob = seq_prefetch_job_get(scene);
116
117 if (!pfjob) {
118 return false;
119 }
120
121 return pfjob->running;
122}
123
124static void seq_prefetch_job_scrubbing_set(Scene *scene, bool is_scrubbing)
125{
126 PrefetchJob *pfjob = seq_prefetch_job_get(scene);
127
128 if (!pfjob) {
129 return;
130 }
131
132 pfjob->is_scrubbing = is_scrubbing;
133}
134
136{
137 PrefetchJob *pfjob = seq_prefetch_job_get(scene);
138
139 if (!pfjob) {
140 return false;
141 }
142
143 return pfjob->waiting;
144}
145
146static Strip *original_strip_get(const Strip *strip, ListBaseT<Strip> *seqbase)
147{
148 for (Strip &strip_orig : *seqbase) {
149 if (STREQ(strip->name, strip_orig.name)) {
150 return &strip_orig;
151 }
152
153 if (strip_orig.type == STRIP_TYPE_META) {
154 Strip *match = original_strip_get(strip, &strip_orig.seqbase);
155 if (match != nullptr) {
156 return match;
157 }
158 }
159 }
160
161 return nullptr;
162}
163
164static Strip *original_strip_get(const Strip *strip, Scene *scene)
165{
166 Editing *ed = scene->ed;
167 return original_strip_get(strip, &ed->seqbase);
168}
169
171{
172 PrefetchJob *pfjob = seq_prefetch_job_get(context->scene);
173 return pfjob ? &pfjob->context : nullptr;
174}
175
177{
178 Scene *scene = context->scene;
179 if (context->is_prefetch_render) {
180 context = get_original_context(context);
181 if (context != nullptr) {
182 scene = context->scene;
183 }
184 }
185 return scene;
186}
187
189{
190 Scene *scene = context->scene;
191 if (context->is_prefetch_render) {
192 context = get_original_context(context);
193 if (context != nullptr) {
194 scene = context->scene;
195 strip = original_strip_get(strip, scene);
196 }
197 }
198 return scene;
199}
200
202{
203 return evict_caches_if_full(scene);
204}
205
207{
208 int new_frame = pfjob->cfra + pfjob->num_frames_prefetched;
209 const ScenePlaybackRange playback_range = BKE_scene_get_playback_range(pfjob->scene);
210 if (new_frame >= playback_range.end_frame) {
211 /* Wrap around to where we will jump when we reach the end frame. */
212 new_frame = playback_range.start_frame + new_frame - playback_range.end_frame;
213 }
214 return new_frame;
215}
216
221
222void seq_prefetch_get_time_range(Scene *scene, int *r_start, int *r_end)
223{
224 /* When there is no prefetch job, return "impossible" negative values. */
225 *r_start = std::numeric_limits<int>::min();
226 *r_end = std::numeric_limits<int>::min();
227
228 PrefetchJob *pfjob = seq_prefetch_job_get(scene);
229 if (pfjob == nullptr) {
230 return;
231 }
232 if ((scene->ed->cache_flag & SEQ_CACHE_PREFETCH_ENABLE) == 0 || !pfjob->running) {
233 return;
234 }
235
236 *r_start = pfjob->cfra;
237 *r_end = seq_prefetch_cfra(pfjob);
238}
239
241{
242 if (this->depsgraph != nullptr) {
244 }
245 this->depsgraph = nullptr;
246 this->scene_eval = nullptr;
247}
248
250{
252 /* Prevent depsgraph from copying scene data to evaluated scene. It would reset updated frame. */
253 DEG_ids_clear_recalc(pfjob->depsgraph, false);
254}
255
257{
258 ViewLayer *view_layer = BKE_view_layer_default_render(this->scene);
259
260 this->depsgraph = DEG_graph_new(this->bmain_eval, this->scene, view_layer, DAG_EVAL_RENDER);
261 DEG_debug_name_set(this->depsgraph, "SEQUENCER PREFETCH");
262
263 /* Make sure there is a correct evaluated scene pointer. */
265
266 /* Update immediately so we have proper evaluated scene. */
268
271}
272
277
285
287{
288 int cfra = math::max(pfjob->scene->r.cfra - before_playhead_frames, pfjob->timeline_start);
289
290 /* rebase */
291 if (cfra > pfjob->cfra) {
292 int delta = cfra - pfjob->cfra;
293 pfjob->cfra = cfra;
294 pfjob->num_frames_prefetched -= delta;
295
296 pfjob->num_frames_prefetched = std::max(pfjob->num_frames_prefetched, 0);
297 }
298
299 /* reset */
300 if (cfra < pfjob->cfra) {
301 pfjob->cfra = cfra;
302 pfjob->num_frames_prefetched = 0;
303 }
304
305 /* timeline span changes */
306 const ScenePlaybackRange playback_range = BKE_scene_get_playback_range(pfjob->scene);
307 if (pfjob->timeline_start != playback_range.start_frame ||
308 pfjob->timeline_end != playback_range.end_frame)
309 {
310 pfjob->timeline_start = playback_range.start_frame;
311 pfjob->timeline_end = playback_range.end_frame;
312 pfjob->timeline_length = playback_range.end_frame - playback_range.start_frame;
313 /* Reset the number of prefetched frames as we need to re-evaluate which
314 * frames to keep in the cache.
315 */
316 pfjob->num_frames_prefetched = 0;
317 }
318
319 /* cache flag changes */
320 Scene *scene = pfjob->scene;
321 if (pfjob->cache_flags != scene->ed->cache_flag) {
322 pfjob->cache_flags = scene->ed->cache_flag;
323 pfjob->num_frames_prefetched = 0;
324 }
325}
326
328{
329 /* TODO(Richard): Use wm_jobs for prefetch, or pass main. */
330 for (Scene *scene = G.main->scenes.first(); scene; scene = static_cast<Scene *>(scene->id.next))
331 {
332 prefetch_stop(scene);
333 }
334}
335
337{
338 PrefetchJob *pfjob = seq_prefetch_job_get(scene);
339
340 if (!pfjob) {
341 return;
342 }
343
344 pfjob->stop = true;
345
346 while (pfjob->running) {
348 }
349}
350
351static void seq_prefetch_update_context(const RenderData *context)
352{
353 PrefetchJob *pfjob = seq_prefetch_job_get(context->scene);
354
356 pfjob->depsgraph,
357 pfjob->scene_eval,
358 context->rectx,
359 context->recty,
360 context->preview_render_size,
361 nullptr,
362 &pfjob->context_cpy);
363 pfjob->context_cpy.is_prefetch_render = true;
364
366 pfjob->depsgraph,
367 pfjob->scene,
368 context->rectx,
369 context->recty,
370 context->preview_render_size,
371 nullptr,
372 &pfjob->context);
373 pfjob->context.is_prefetch_render = false;
374}
375
377{
378 PrefetchJob *pfjob = seq_prefetch_job_get(scene);
379
380 if (!pfjob) {
381 return;
382 }
383
384 pfjob->scene = scene;
385 pfjob->free_depsgraph();
386 pfjob->init_depsgraph();
387}
388
390{
392 Editing *ed_eval = editing_get(pfjob->scene_eval);
393
394 if (ms_orig != nullptr) {
395 Strip *meta_eval = original_strip_get(ms_orig->parent_strip, pfjob->scene_eval);
396 ed_eval->current_meta_strip = meta_eval;
397 }
398 else {
399 ed_eval->current_meta_strip = nullptr;
400 }
401}
402
403static void seq_prefetch_resume(Scene *scene)
404{
405 PrefetchJob *pfjob = seq_prefetch_job_get(scene);
406
407 if (pfjob && pfjob->waiting) {
409 }
410}
411
413{
414 PrefetchJob *pfjob = seq_prefetch_job_get(scene);
415 if (!pfjob) {
416 return;
417 }
418
419 prefetch_stop(scene);
420
421 BLI_threadpool_remove(&pfjob->threads, pfjob);
425 pfjob->free_depsgraph();
426 pfjob->free_gpu();
428 scene->ed->runtime->prefetch_job = nullptr;
429 MEM_delete(pfjob);
430}
431
432static bool strip_renders_scene_strip(const Scene *scene,
433 ListBaseT<SeqTimelineChannel> *channels,
434 ListBaseT<Strip> *seqbase,
435 Strip *strip,
436 int frame,
437 SeqRenderState state);
438
439/* Find whether any strip shown in `seqbase` renders a camera-input or recursive scene strip. */
440static bool seqbase_renders_scene_strip(const Scene *scene,
441 ListBaseT<SeqTimelineChannel> *channels,
442 ListBaseT<Strip> *seqbase,
443 int frame,
445{
446 for (Strip *strip : query_rendered_strips_sorted(scene, channels, seqbase, frame, 0)) {
447 if (strip_renders_scene_strip(scene, channels, seqbase, strip, frame, state)) {
448 return true;
449 }
450 }
451 return false;
452}
453
454/* Find whether rendering `strip` directly or indirectly renders a camera-input or recursive scene
455 * strip. */
456static bool strip_renders_scene_strip(const Scene *scene,
457 ListBaseT<SeqTimelineChannel> *channels,
458 ListBaseT<Strip> *seqbase,
459 Strip *strip,
460 int frame,
462{
463 /* Recursive sequencer-input scene strip detected, no point in attempting to render it. */
464 if (state.strips_in_progress.contains(strip)) {
465 return true;
466 }
467
468 /* Camera-input scene strip detected. */
469 if (strip->type == STRIP_TYPE_SCENE && (strip->flag & SEQ_SCENE_STRIPS) == 0 &&
470 strip->scene != nullptr)
471 {
472 return true;
473 }
474
475 /* Recurse on effect input strips. */
476 if ((strip->input1 &&
477 strip_renders_scene_strip(scene, channels, seqbase, strip->input1, frame, state)) ||
478 (strip->input2 &&
479 strip_renders_scene_strip(scene, channels, seqbase, strip->input2, frame, state)))
480 {
481 return true;
482 }
483
484 /* Recurse on mask modifier strips. */
485 for (StripModifierData &smd : strip->modifiers) {
486 if (smd.mask_strip &&
487 strip_renders_scene_strip(scene, channels, seqbase, smd.mask_strip, frame, state))
488 {
489 return true;
490 }
491 }
492
493 /* Adjustment strips with 'replace' blending indirectly render all strips in channels below them.
494 * See #151629. */
495 if (strip->type == STRIP_TYPE_ADJUSTMENT && strip->blend_mode == STRIP_BLEND_REPLACE &&
496 strip->channel > 1)
497 {
498 for (Strip *below :
499 query_rendered_strips_sorted(scene, channels, seqbase, frame, strip->channel - 1))
500 {
501 if (strip_renders_scene_strip(scene, channels, seqbase, below, frame, state)) {
502 return true;
503 }
504 }
505 }
506
507 /* Recurse on all strips in the meta strip `seqbase`. */
508 if (strip->type == STRIP_TYPE_META) {
509 int meta_frame = give_frame_index(scene, strip, frame) + strip->content_start();
510 if (seqbase_renders_scene_strip(scene, &strip->channels, &strip->seqbase, meta_frame, state)) {
511 return true;
512 }
513 }
514
515 /* Recurse on all strips in the sequencer-input scene strip `seqbase`. */
516 if (strip->type == STRIP_TYPE_SCENE && (strip->flag & SEQ_SCENE_STRIPS) != 0 &&
517 strip->scene != nullptr && editing_get(strip->scene))
518 {
519 state.strips_in_progress.add(strip);
520
521 const Scene *target_scene = strip->scene;
522 Editing *target_ed = editing_get(target_scene);
523 int target_timeline_frame = give_frame_index(scene, strip, frame) + target_scene->r.sfra;
524
525 if (seqbase_renders_scene_strip(target_scene,
526 target_ed->current_channels(),
527 target_ed->current_strips(),
528 target_timeline_frame,
529 state))
530 {
531 return true;
532 }
533 }
534
535 return false;
536}
537
539{
540 const Scene *scene = pfjob->scene_eval;
541 const Editing *ed = editing_get(pfjob->scene_eval);
542 ListBaseT<Strip> *seqbase = active_seqbase_get(ed);
543 ListBaseT<SeqTimelineChannel> *channels = channels_displayed_get(ed);
544 int timeline_frame = seq_prefetch_cfra(pfjob);
545
546 /* Do not render the current frame from the prefetch: a user might be interactively
547 * editing some animated property, and the scene copy inside prefetch would not get
548 * that temporary edited value. */
549 if (timeline_frame == pfjob->scene->r.cfra) {
550 return true;
551 }
552
553 /* Pass in state to check for infinite recursion of "sequencer-type" scene strips. */
555
556 /* Camera-input scene strips are not supported, nor are recursive sequencer-input scene
557 * strips. */
558 return seqbase_renders_scene_strip(scene, channels, seqbase, timeline_frame, state);
559}
560
562{
563 return seq_prefetch_is_cache_full(pfjob->scene) || pfjob->is_scrubbing ||
564 (pfjob->num_frames_prefetched >= pfjob->timeline_length);
565}
566
568{
570 while (seq_prefetch_need_suspend(pfjob) &&
571 (pfjob->scene->ed->cache_flag & SEQ_CACHE_PREFETCH_ENABLE) && !pfjob->stop)
572 {
573 pfjob->waiting = true;
576 }
577 pfjob->waiting = false;
579}
580
581static void *seq_prefetch_frames(void *job)
582{
583 PrefetchJob *pfjob = static_cast<PrefetchJob *>(job);
584
585 while (true) {
586 if (pfjob->cfra < pfjob->timeline_start || pfjob->cfra > pfjob->timeline_end) {
587 /* Don't try to prefetch anything when we are outside of the timeline range. */
588 break;
589 }
590 pfjob->scene_eval->ed->runtime->prefetch_job = nullptr;
591
594 AnimationEvalContext anim_eval_context = seq_prefetch_anim_eval_context(pfjob);
596 &pfjob->context_cpy.scene->id, adt, &anim_eval_context, ADT_RECALC_ALL, false);
597
598 /* This is quite hacky solution:
599 * We need cross-reference original scene with copy for cache.
600 * However depsgraph must not have this data, because it will try to kill this job.
601 * Scene copy don't reference original scene. Perhaps, this could be done by depsgraph.
602 * Set to nullptr before return!
603 */
604 pfjob->scene_eval->ed->runtime->prefetch_job = pfjob;
605
606 if (seq_prefetch_must_skip_frame(pfjob)) {
607 pfjob->num_frames_prefetched++;
608 /* Break instead of keep looping if the job should be terminated. */
609 if (!(pfjob->scene->ed->cache_flag & SEQ_CACHE_PREFETCH_ENABLE) ||
610 !(pfjob->scene->ed->cache_flag & SEQ_CACHE_ALL_TYPES) || pfjob->stop)
611 {
612 break;
613 }
614 continue;
615 }
616
617 ImBuf *ibuf = render_give_ibuf(&pfjob->context_cpy, seq_prefetch_cfra(pfjob), 0);
618 pfjob->num_frames_prefetched++;
619 IMB_freeImBuf(ibuf);
620
621 /* Suspend thread if there is nothing to be prefetched. */
623
624 if (!(pfjob->scene->ed->cache_flag & SEQ_CACHE_PREFETCH_ENABLE) ||
625 !(pfjob->scene->ed->cache_flag & SEQ_CACHE_ALL_TYPES) || pfjob->stop)
626 {
627 break;
628 }
629
631 }
632
633 pfjob->running = false;
634 pfjob->scene_eval->ed->runtime->prefetch_job = nullptr;
635
636 return nullptr;
637}
638
639static PrefetchJob *seq_prefetch_start_ex(const RenderData *context, float cfra)
640{
641 PrefetchJob *pfjob = seq_prefetch_job_get(context->scene);
642
643 if (!pfjob) {
644 if (!context->scene->ed) {
645 return nullptr;
646 }
647 pfjob = MEM_new<PrefetchJob>("PrefetchJob");
648 context->scene->ed->runtime->prefetch_job = pfjob;
649
653
654 pfjob->bmain_eval = BKE_main_new();
655 pfjob->scene = context->scene;
656 pfjob->init_depsgraph();
657 pfjob->init_gpu();
658 }
659 pfjob->bmain = context->bmain;
660
661 Scene *scene = pfjob->scene;
662 const ScenePlaybackRange playback_range = BKE_scene_get_playback_range(pfjob->scene);
663 pfjob->timeline_start = playback_range.start_frame;
664 pfjob->timeline_end = playback_range.end_frame;
665 pfjob->timeline_length = playback_range.end_frame - playback_range.start_frame;
666
667 pfjob->cfra = math::max(int(cfra - before_playhead_frames), pfjob->timeline_start);
668
669 pfjob->num_frames_prefetched = 0;
670 pfjob->cache_flags = scene->ed->cache_flag;
671
672 pfjob->waiting = false;
673 pfjob->stop = false;
674 pfjob->running = true;
675
676 seq_prefetch_update_scene(context->scene);
679
680 BLI_threadpool_remove(&pfjob->threads, pfjob);
681 BLI_threadpool_insert(&pfjob->threads, pfjob);
682
683 return pfjob;
684}
685
686void seq_prefetch_start(const RenderData *context, float timeline_frame)
687{
688 Scene *scene = context->scene;
689 Editing *ed = scene->ed;
690 bool has_strips = bool(ed->current_strips()->first());
691
692 if (!context->is_prefetch_render) {
693 bool playing = context->is_playing;
694 bool scrubbing = context->is_scrubbing;
695 bool running = seq_prefetch_job_is_running(scene);
696 seq_prefetch_job_scrubbing_set(scene, scrubbing);
697 seq_prefetch_resume(scene);
698
699 /* conditions to start:
700 * prefetch enabled, prefetch not running, not scrubbing, not playing,
701 * cache storage enabled, has strips to render, not rendering, not doing modal transform -
702 * important, see D7820. */
703 if ((ed->cache_flag & SEQ_CACHE_PREFETCH_ENABLE) && !running && !scrubbing && !playing &&
704 (ed->cache_flag & SEQ_CACHE_ALL_TYPES) && has_strips && !G.is_rendering && !G.moving)
705 {
706 seq_prefetch_start_ex(context, timeline_frame);
707 }
708 }
709}
710
712{
713 bScreen *screen = CTX_wm_screen(C);
714 bool playing = screen->animtimer != nullptr;
715 bool scrubbing = screen->scrubbing;
716 bool running = seq_prefetch_job_is_running(scene);
717 bool suspended = seq_prefetch_job_is_waiting(scene);
718
719 SpaceSeq *sseq = CTX_wm_space_seq(C);
720 bool showing_cache = sseq->cache_overlay.flag & SEQ_CACHE_SHOW;
721
722 /* force redraw, when prefetching and using cache view. */
723 if (running && !playing && !suspended && showing_cache) {
724 return true;
725 }
726 /* Sometimes scrubbing flag is set when not scrubbing. In that case I want to catch "event" of
727 * stopping scrubbing */
728 if (scrubbing) {
729 return true;
730 }
731 return false;
732}
733
734} // namespace seq
735} // namespace blender
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define STREQ(a, b)
const int state
GPUSecondaryContextData GPU_create_secondary_context()
void GPU_destroy_secondary_context(GPUSecondaryContextData &data)
T max(const T &a, const T &b)
static void seq_prefetch_update_active_seqbase(PrefetchJob *pfjob)
Definition prefetch.cc:389
void prefetch_stop(Scene *scene)
Definition prefetch.cc:336
static bool seq_prefetch_must_skip_frame(PrefetchJob *pfjob)
Definition prefetch.cc:538
static PrefetchJob * seq_prefetch_job_get(Scene *scene)
Definition prefetch.cc:105
ImBuf * render_give_ibuf(const RenderData *context, float timeline_frame, int chanshown)
Definition render.cc:2139
bool seq_prefetch_job_is_running(Scene *scene)
Definition prefetch.cc:113
bool prefetch_need_redraw(const bContext *C, Scene *scene)
Definition prefetch.cc:711
static Strip * original_strip_get(const Strip *strip, ListBaseT< Strip > *seqbase)
Definition prefetch.cc:146
ListBaseT< Strip > * active_seqbase_get(const Editing *ed)
Definition sequencer.cc:463
static void seq_prefetch_update_depsgraph(PrefetchJob *pfjob)
Definition prefetch.cc:249
float give_frame_index(const Scene *scene, const Strip *strip, float timeline_frame)
Definition strip_time.cc:43
Editing * editing_get(const Scene *scene)
Definition sequencer.cc:304
void seq_prefetch_free(Scene *scene)
Definition prefetch.cc:412
static PrefetchJob * seq_prefetch_start_ex(const RenderData *context, float cfra)
Definition prefetch.cc:639
static bool seqbase_renders_scene_strip(const Scene *scene, ListBaseT< SeqTimelineChannel > *channels, ListBaseT< Strip > *seqbase, int frame, SeqRenderState state)
Definition prefetch.cc:440
static bool strip_renders_scene_strip(const Scene *scene, ListBaseT< SeqTimelineChannel > *channels, ListBaseT< Strip > *seqbase, Strip *strip, int frame, SeqRenderState state)
Definition prefetch.cc:456
static void seq_prefetch_resume(Scene *scene)
Definition prefetch.cc:403
static RenderData * get_original_context(const RenderData *context)
Definition prefetch.cc:170
static int seq_prefetch_cfra(PrefetchJob *pfjob)
Definition prefetch.cc:206
void seq_prefetch_start(const RenderData *context, float timeline_frame)
Definition prefetch.cc:686
MetaStack * meta_stack_active_get(const Editing *ed)
Definition sequencer.cc:484
static bool seq_prefetch_need_suspend(PrefetchJob *pfjob)
Definition prefetch.cc:561
Vector< Strip * > query_rendered_strips_sorted(const Scene *scene, ListBaseT< SeqTimelineChannel > *channels, ListBaseT< Strip > *seqbase, const int timeline_frame, const int chanshown)
Definition iterator.cc:253
void prefetch_stop_all()
Definition prefetch.cc:327
void render_new_render_data(Main *bmain, Depsgraph *depsgraph, Scene *scene, int rectx, int recty, eSpaceSeq_Proxy_RenderSize preview_render_size, Render *render, RenderData *r_context)
Definition render.cc:194
static void seq_prefetch_update_area(PrefetchJob *pfjob)
Definition prefetch.cc:286
static AnimationEvalContext seq_prefetch_anim_eval_context(PrefetchJob *pfjob)
Definition prefetch.cc:217
static bool seq_prefetch_job_is_waiting(Scene *scene)
Definition prefetch.cc:135
Scene * prefetch_get_original_scene_and_strip(const RenderData *context, const Strip *&strip)
Definition prefetch.cc:188
static void * seq_prefetch_frames(void *job)
Definition prefetch.cc:581
static void seq_prefetch_do_suspend(PrefetchJob *pfjob)
Definition prefetch.cc:567
bool evict_caches_if_full(Scene *scene)
static void seq_prefetch_update_context(const RenderData *context)
Definition prefetch.cc:351
static constexpr int before_playhead_frames
Definition prefetch.cc:60
static void seq_prefetch_update_scene(Scene *scene)
Definition prefetch.cc:376
ListBaseT< SeqTimelineChannel > * channels_displayed_get(const Editing *ed)
Definition channels.cc:26
static void seq_prefetch_job_scrubbing_set(Scene *scene, bool is_scrubbing)
Definition prefetch.cc:124
Scene * prefetch_get_original_scene(const RenderData *context)
Definition prefetch.cc:176
void seq_prefetch_get_time_range(Scene *scene, int *r_start, int *r_end)
Definition prefetch.cc:222
static bool seq_prefetch_is_cache_full(Scene *scene)
Definition prefetch.cc:201
BMesh Iterators.
void BLI_condition_init(ThreadCondition *cond)
Definition threads.cc:578
void DEG_graph_free(Depsgraph *graph)
Definition depsgraph.cc:307
void BLI_mutex_unlock(ThreadMutex *mutex)
Definition threads.cc:353
void BLI_threadpool_insert(ListBaseT< ThreadSlot > *threadbase, void *callerdata)
Definition threads.cc:189
Main * BKE_main_new()
Definition main.cc:93
Depsgraph * DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode)
Definition depsgraph.cc:279
void BLI_threadpool_end(ListBaseT< ThreadSlot > *threadbase)
Definition threads.cc:239
void BLI_condition_wait(ThreadCondition *cond, ThreadMutex *mutex)
Definition threads.cc:583
void DEG_ids_clear_recalc(Depsgraph *depsgraph, bool backup)
SpaceSeq * CTX_wm_space_seq(const bContext *C)
AnimationEvalContext BKE_animsys_eval_context_construct(Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
Definition anim_sys.cc:602
void BLI_condition_end(ThreadCondition *cond)
Definition threads.cc:603
ScenePlaybackRange BKE_scene_get_playback_range(const Scene *scene)
Definition scene.cc:2607
void DEG_graph_build_for_render_pipeline(Depsgraph *graph)
Global G
Definition blender.cc:57
AnimData * BKE_animdata_from_id(const ID *id)
Definition anim_data.cc:93
void BLI_condition_notify_one(ThreadCondition *cond)
Definition threads.cc:593
void BLI_mutex_lock(ThreadMutex *mutex)
Definition threads.cc:348
void IMB_freeImBuf(ImBuf *ibuf)
void DEG_debug_name_set(Depsgraph *depsgraph, const char *name)
void BLI_threadpool_remove(ListBaseT< ThreadSlot > *threadbase, void *callerdata)
Definition threads.cc:202
void BLI_mutex_end(ThreadMutex *mutex)
Definition threads.cc:363
void BKE_main_free(Main *bmain)
Definition main.cc:202
void BKE_animsys_evaluate_animdata(ID *id, AnimData *adt, const AnimationEvalContext *anim_eval_context, eAnimData_Recalc recalc, bool flush_to_original)
Definition anim_sys.cc:3716
pthread_cond_t ThreadCondition
pthread_mutex_t ThreadMutex
void DEG_evaluate_on_framechange(Depsgraph *graph, float frame, DepsgraphEvaluateSyncWriteback sync_writeback=DEG_EVALUATE_SYNC_WRITEBACK_NO)
bScreen * CTX_wm_screen(const bContext *C)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
ViewLayer * BKE_view_layer_default_render(const Scene *scene)
void BLI_mutex_init(ThreadMutex *mutex)
Definition threads.cc:343
void BLI_threadpool_init(ListBaseT< ThreadSlot > *threadbase, void *(*do_thread)(void *), int tot)
Definition threads.cc:123
seq::EditingRuntime * runtime
eEditingCacheFlag cache_flag
struct Editing * ed
struct RenderData r
eSpaceSeq_SequencerCacheOverlay_Flag flag
struct SequencerCacheOverlay cache_overlay
struct wmTimer * animtimer
ThreadMutex prefetch_suspend_mutex
Definition prefetch.cc:72
ListBaseT< ThreadSlot > threads
Definition prefetch.cc:75
ThreadCondition prefetch_suspend_cond
Definition prefetch.cc:73
gpu::GPUSecondaryContextData gpu_context
Definition SEQ_render.hh:59