![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Drawlayer realtime worker thread and FIFO event queue. More...
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | drawlayer_rt_callbacks_t |
| Per-worker callback vtable. More... | |
| struct | drawlayer_rt_worker_t |
| One worker thread runtime including event ring buffer. More... | |
| struct | drawlayer_finished_stroke_job_t |
| One finished stroke queued for deferred full-resolution replay. More... | |
| struct | dt_drawlayer_worker_t |
| Drawlayer worker global state shared with drawlayer module. More... | |
| struct | drawlayer_paint_backend_ctx_t |
| struct | drawlayer_fullres_replay_scratch_t |
| struct | drawlayer_rt_thread_ctx_t |
Macros | |
| #define | DRAWLAYER_BATCH_TILE_SIZE 128 |
| #define | DRAWLAYER_OUTER_LIVE_BATCH_MULTIPLIER 2u |
| #define | DRAWLAYER_OUTER_FULLRES_BATCH_MULTIPLIER 4u |
Enumerations | |
| enum | drawlayer_rt_worker_kind_t { DRAWLAYER_RT_WORKER_BACKEND = 0 , DRAWLAYER_RT_WORKER_COUNT = 1 } |
| Internal worker slot kinds (currently backend only). More... | |
Functions | |
| static gboolean | _paint_build_dab_cb (void *user_data, dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_paint_raw_input_t *input, dt_drawlayer_brush_dab_t *out_dab) |
| static gboolean | _paint_layer_to_widget_cb (void *user_data, float lx, float ly, float *wx, float *wy) |
| static void | _paint_emit_backend_dab_cb (void *user_data, const dt_drawlayer_brush_dab_t *dab) |
| static void | _paint_emit_noop_cb (void *user_data, const dt_drawlayer_brush_dab_t *dab) |
| static void | _paint_stroke_seed_cb (void *user_data, uint64_t stroke_seed) |
| static void | _publish_backend_progress (drawlayer_paint_backend_ctx_t *ctx, gboolean flush_pending) |
| static void | _process_backend_input (dt_iop_module_t *self, const dt_drawlayer_paint_raw_input_t *input, dt_drawlayer_paint_stroke_t *stroke) |
| static void | _process_backend_dab (dt_iop_module_t *self, const dt_drawlayer_brush_dab_t *dab, drawlayer_paint_backend_ctx_t *ctx) |
| static drawlayer_rt_worker_t * | _backend_worker (dt_drawlayer_worker_t *rt) |
| static const drawlayer_rt_worker_t * | _backend_worker_const (const dt_drawlayer_worker_t *rt) |
| static gint64 | _live_publish_interval_us (void) |
| static gboolean | _live_publish_deadline_reached (const dt_drawlayer_worker_t *rt, const gint64 input_ts, const gint64 interval_us) |
| static drawlayer_paint_backend_ctx_t | _make_backend_ctx (dt_iop_module_t *self, dt_drawlayer_worker_t *worker, dt_drawlayer_paint_stroke_t *stroke) |
| static guint | _rasterize_pending_dab_batch (drawlayer_paint_backend_ctx_t *ctx, gint64 budget_us) |
| static void | _drain_queued_raw_inputs_locked (dt_drawlayer_worker_t *worker) |
| static gboolean | _rt_queue_pop_locked (dt_drawlayer_worker_t *rt, dt_drawlayer_paint_raw_input_t *event) |
| Pop one event from ring queue (lock must be held). | |
| static drawlayer_fullres_replay_scratch_t * | _get_fullres_replay_scratch (void) |
| static float * | _ensure_fullres_replay_float_buffer (float **buffer, size_t *capacity_values, size_t needed_values) |
| static guint | _worker_batch_min_size (void) |
| static gboolean | _dab_batch_supports_outer_loop (const GArray *dabs, guint count) |
| static void | _log_worker_batch_timing (const char *tag, guint processed_dabs, guint thread_count, double elapsed_ms, gboolean outer_loop) |
| gboolean | dt_drawlayer_build_worker_input_dab (dt_iop_module_t *self, dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_paint_raw_input_t *input, dt_drawlayer_brush_dab_t *dab) |
| void | dt_drawlayer_worker_publish_backend_stroke_damage (dt_iop_module_t *self) |
| Publish accumulated backend stroke damage into drawlayer process/runtime state. | |
| static void | _destroy_fullres_replay_scratch (gpointer data) |
| gboolean | dt_drawlayer_worker_replay_finished_stroke_to_base_patch (dt_iop_module_t *self, const GArray *raw_inputs) |
| Replay one finished stroke into the authoritative base patch from preserved raw inputs. | |
| static void | _stop_worker (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Stop worker thread and clear transient state. | |
| static gboolean | _enqueue_finished_stroke (dt_drawlayer_worker_t *rt) |
| Queue preserved finished stroke for deferred full-resolution replay (lock must be held). | |
| static void | _finished_stroke_job_destroy (drawlayer_finished_stroke_job_t *job) |
| Destroy one finished-stroke replay job and owned history. | |
| static void | _stroke_destroy (dt_drawlayer_worker_t *rt) |
| Deep-copy preserved stroke history into one deferred replay job. | |
| static gboolean | _stroke_create (dt_drawlayer_worker_t *rt) |
| Create stroke runtime if missing. | |
| static gboolean | _stroke_begin (dt_drawlayer_worker_t *rt) |
| Start new stroke runtime and reset history/path state. | |
| static void | _stroke_clear (dt_drawlayer_worker_t *rt) |
| Clear current stroke state while preserving allocations. | |
| static void | _reset_backend_path (dt_drawlayer_worker_t *rt) |
| static void | _reset_live_publish (dt_drawlayer_worker_t *rt) |
| static void | _rt_queue_clear_locked (dt_drawlayer_worker_t *rt) |
| Clear queued events (lock must be held). | |
| static gboolean | _rt_queue_empty (const dt_drawlayer_worker_t *rt) |
| Test whether event queue is empty. | |
| static gboolean | _rt_queue_full (const dt_drawlayer_worker_t *rt) |
| Test whether event queue is full. | |
| static gboolean | _rt_queue_push_locked (dt_drawlayer_worker_t *rt, const dt_drawlayer_paint_raw_input_t *event) |
| Push one event in ring queue (lock must be held). | |
| static gboolean | _worker_is_started (const drawlayer_rt_worker_t *worker) |
| static gboolean | _worker_is_busy (const drawlayer_rt_worker_t *worker) |
| static gboolean | _worker_pause_requested (const drawlayer_rt_worker_t *worker) |
| static gboolean | _backend_pending_dabs_locked (const dt_drawlayer_worker_t *rt) |
| static gboolean | _fullres_worker_started (const dt_drawlayer_worker_t *rt) |
| static gboolean | _fullres_worker_busy (const dt_drawlayer_worker_t *rt) |
| static void | _rt_set_worker_state (dt_drawlayer_worker_t *rt, const dt_drawlayer_worker_state_t state) |
| Set worker state atomically under caller synchronization. | |
| static void | _set_current_thread_realtime_best_effort (void) |
| Try elevating current thread scheduling policy for lower-latency input. | |
| static gboolean | _workers_active_locked (const dt_drawlayer_worker_t *rt) |
| Check whether workers still have pending activity (lock must be held). | |
| static gboolean | _fullres_active_locked (const dt_drawlayer_worker_t *rt) |
| Check whether deferred full-resolution replay still has pending activity (lock must be held). | |
| static gboolean | _workers_any_active_locked (const dt_drawlayer_worker_t *rt) |
| Check whether any worker activity remains (backend or deferred replay). | |
| static gboolean | _workers_ready_for_commit_locked (const dt_drawlayer_worker_t *rt) |
| Check if workers are idle and commit can be safely scheduled. | |
| static gboolean | _rt_workers_active (dt_drawlayer_worker_t *rt) |
| Thread-safe wrapper for active-workers status. | |
| static gboolean | _rt_workers_any_active (dt_drawlayer_worker_t *rt) |
| Thread-safe wrapper for any worker activity, including deferred replay. | |
| static gboolean | _async_commit_idle (gpointer user_data) |
| Idle callback committing pending stroke once workers are fully idle. | |
| static void | _schedule_async_commit_if_ready_locked (dt_drawlayer_worker_t *rt) |
| Schedule async commit when lock-state indicates readiness. | |
| static void | _backend_worker_on_idle (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Backend-worker idle hook. | |
| static void | _backend_worker_process_sample (dt_iop_module_t *self, dt_drawlayer_worker_t *rt, const dt_drawlayer_paint_raw_input_t *input) |
| Process one backend raw input event. | |
| static void | _backend_worker_process_stroke_end (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Handle backend stroke end: flush, reset, and request commit. | |
| static void | _rt_destroy_state (dt_iop_module_t *self, dt_drawlayer_worker_t **rt_out) |
| Stop and free an existing worker state object. | |
| static void | _rt_init_state (dt_iop_module_t *self, dt_drawlayer_worker_t **rt_out, gboolean *painting, gboolean *finish_commit_pending, guint *stroke_sample_count, uint32_t *current_stroke_batch, dt_drawlayer_worker_finished_stroke_cb finished_stroke_cb) |
| Allocate and initialize worker state object and buffers. | |
| static void | _rt_cleanup_state (dt_drawlayer_worker_t **rt_out) |
| Destroy worker state object and all owned resources. | |
| static gboolean | _wait_worker_idle (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Wait until worker queue is drained and not busy. | |
| static void * | _drawlayer_fullres_worker_main (void *user_data) |
| Deferred full-resolution replay worker main loop. | |
| static gboolean | _start_fullres_worker (dt_drawlayer_worker_t *rt) |
| Start deferred full-resolution replay worker if not running. | |
| static void | _wait_fullres_idle (dt_drawlayer_worker_t *rt) |
| Wait until deferred full-resolution replay queue is drained and idle. | |
| static void * | _drawlayer_worker_main (void *user_data) |
| Worker main loop: FIFO dequeue, process, and idle scheduling. | |
| static gboolean | _start_worker (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Start backend worker thread if not running. | |
| static void | _cancel_async_commit (dt_drawlayer_worker_t *rt) |
| Cancel pending async commit idle callback if any. | |
| static void | _pause_worker (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Pause worker processing after current callback returns. | |
| static void | _resume_worker (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Resume worker processing and wake sleeping thread. | |
| static gboolean | _enqueue_event (dt_iop_module_t *self, dt_drawlayer_worker_t *rt, const dt_drawlayer_paint_raw_input_t *event) |
| Generic enqueue helper ensuring worker startup. | |
| static gboolean | _enqueue_input (dt_iop_module_t *self, dt_drawlayer_worker_t *rt, const dt_drawlayer_paint_raw_input_t *input) |
| Enqueue raw input with saturation policy and stroke-abort fallback. | |
| static gboolean | _enqueue_stroke_end (dt_iop_module_t *self, dt_drawlayer_worker_t *rt, const dt_drawlayer_paint_raw_input_t *input) |
| Enqueue explicit stroke-end event (with optional raw release sample). | |
| void | dt_drawlayer_worker_init (dt_iop_module_t *self, dt_drawlayer_worker_t **worker, gboolean *painting, gboolean *finish_commit_pending, guint *stroke_sample_count, uint32_t *current_stroke_batch, dt_drawlayer_worker_finished_stroke_cb finished_stroke_cb) |
| Public worker initialization entry point. | |
| void | dt_drawlayer_worker_cleanup (dt_drawlayer_worker_t **worker) |
| Public worker cleanup entry point. | |
| gboolean | dt_drawlayer_worker_active (const dt_drawlayer_worker_t *worker) |
| Public status query: TRUE when worker has pending activity. | |
| gboolean | dt_drawlayer_worker_any_active (const dt_drawlayer_worker_t *worker) |
| Public status query: TRUE when any worker still has pending activity. | |
| gboolean | dt_drawlayer_worker_ensure_running (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Ensure realtime/backend worker threads are started. | |
| void | dt_drawlayer_worker_stop (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Stop realtime and full-resolution worker threads. | |
| void | dt_drawlayer_worker_get_snapshot (const dt_drawlayer_worker_t *worker, dt_drawlayer_worker_snapshot_t *snapshot) |
| Return a thread-safe worker snapshot for runtime scheduling. | |
| void | dt_drawlayer_worker_request_commit (dt_drawlayer_worker_t *worker) |
| Public commit request helper. | |
| void | dt_drawlayer_worker_flush_pending (dt_drawlayer_worker_t *worker) |
| Flush pending backend stroke inputs synchronously. | |
| void | dt_drawlayer_worker_seal_for_commit (dt_drawlayer_worker_t *worker) |
| Seal current stroke for synchronous commit by folding queued raw inputs into preserved history. | |
| void | dt_drawlayer_worker_flush_finished_strokes (dt_drawlayer_worker_t *worker) |
| Wait until deferred full-resolution replay queue becomes idle. | |
| void | dt_drawlayer_worker_reset_backend_path (dt_drawlayer_worker_t *worker) |
| Reset worker-owned backend damage accumulator. | |
| void | dt_drawlayer_worker_reset_live_publish (dt_drawlayer_worker_t *worker) |
| Reset worker-owned transient live-publish state. | |
| void | dt_drawlayer_worker_reset_stroke (dt_drawlayer_worker_t *worker) |
| Clear preserved stroke runtime/history after commit completed. | |
| GArray * | dt_drawlayer_worker_raw_inputs (dt_drawlayer_worker_t *worker) |
| Read-only access to preserved raw input history. | |
| dt_drawlayer_paint_stroke_t * | dt_drawlayer_worker_stroke (dt_drawlayer_worker_t *worker) |
| Read-only access to preserved stroke runtime. | |
| guint | dt_drawlayer_worker_pending_dab_count (const dt_drawlayer_worker_t *worker) |
| Return the number of interpolated-but-not-yet-rasterized dabs in the current stroke batch. | |
| gboolean | dt_drawlayer_worker_finished_stroke_queued (const dt_drawlayer_worker_t *worker) |
| Report whether current preserved stroke was already queued for deferred replay. | |
| gboolean | dt_drawlayer_worker_enqueue_input (dt_drawlayer_worker_t *worker, const dt_drawlayer_paint_raw_input_t *input) |
| Public FIFO enqueue for one raw input event. | |
| gboolean | dt_drawlayer_worker_enqueue_stroke_end (dt_drawlayer_worker_t *worker, const dt_drawlayer_paint_raw_input_t *input) |
| Public FIFO enqueue for stroke-end event. | |
Variables | |
| static GPrivate | _drawlayer_fullres_replay_scratch_key = G_PRIVATE_INIT(_destroy_fullres_replay_scratch) |
| static const drawlayer_rt_callbacks_t | _rt_callbacks [DRAWLAYER_RT_WORKER_COUNT] |
Drawlayer realtime worker thread and FIFO event queue.
| #define DRAWLAYER_BATCH_TILE_SIZE 128 |
| #define DRAWLAYER_OUTER_FULLRES_BATCH_MULTIPLIER 4u |
| #define DRAWLAYER_OUTER_LIVE_BATCH_MULTIPLIER 2u |
| typedef struct drawlayer_finished_stroke_job_t drawlayer_finished_stroke_job_t |
One finished stroke queued for deferred full-resolution replay.
| typedef struct drawlayer_paint_backend_ctx_t drawlayer_paint_backend_ctx_t |
| typedef struct drawlayer_rt_callbacks_t drawlayer_rt_callbacks_t |
Per-worker callback vtable.
| typedef void(* drawlayer_rt_idle_cb) (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
Callback signature for idle transitions inside worker loop.
| typedef void(* drawlayer_rt_sample_cb) (dt_iop_module_t *self, dt_drawlayer_worker_t *rt, const dt_drawlayer_paint_raw_input_t *input) |
Callback signature for one raw-input event processing.
| typedef void(* drawlayer_rt_stroke_end_cb) (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
Callback signature for stroke-end event processing.
| typedef struct drawlayer_rt_thread_ctx_t drawlayer_rt_thread_ctx_t |
| typedef enum drawlayer_rt_worker_kind_t drawlayer_rt_worker_kind_t |
Internal worker slot kinds (currently backend only).
| typedef struct drawlayer_rt_worker_t drawlayer_rt_worker_t |
One worker thread runtime including event ring buffer.
|
static |
Idle callback committing pending stroke once workers are fully idle.
References _commit_dabs, _workers_ready_for_commit_locked(), dt_iop_module_t::dev, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, dt_drawlayer_worker_t::finish_commit_source_id, dt_drawlayer_worker_t::self, TRUE, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _schedule_async_commit_if_ready_locked().
|
inlinestatic |
References dt_drawlayer_paint_stroke_t::pending_dabs, and dt_drawlayer_worker_t::stroke.
Referenced by _drawlayer_worker_main().
|
inlinestatic |
References DRAWLAYER_RT_WORKER_BACKEND, and dt_drawlayer_worker_t::workers.
Referenced by _drawlayer_worker_main(), _enqueue_input(), _pause_worker(), _resume_worker(), _rt_destroy_state(), _rt_init_state(), _rt_queue_clear_locked(), _rt_queue_pop_locked(), _rt_queue_push_locked(), _rt_set_worker_state(), _start_worker(), _stop_worker(), and dt_drawlayer_worker_seal_for_commit().
|
inlinestatic |
|
static |
Backend-worker idle hook.
References _live_publish_interval_us(), _make_backend_ctx(), _publish_backend_progress(), _rasterize_pending_dab_batch(), _schedule_async_commit_if_ready_locked(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), g, dt_iop_module_t::gui_data, dt_drawlayer_paint_stroke_t::pending_dabs, dt_drawlayer_worker_t::stroke, TRUE, and dt_drawlayer_worker_t::worker_mutex.
|
static |
Process one backend raw input event.
References _process_backend_input(), _stroke_begin(), DT_DRAWLAYER_PAINT_STROKE_FIRST, dt_drawlayer_worker_t::stroke, dt_drawlayer_paint_raw_input_t::stroke_pos, and dt_drawlayer_worker_t::stroke_raw_inputs.
|
static |
Handle backend stroke end: flush, reset, and request commit.
References _enqueue_finished_stroke(), _make_backend_ctx(), _paint_build_dab_cb(), _paint_emit_backend_dab_cb(), _paint_layer_to_widget_cb(), _paint_stroke_seed_cb(), _publish_backend_progress(), _rasterize_pending_dab_batch(), _schedule_async_commit_if_ready_locked(), dt_drawlayer_paint_callbacks_t::build_dab, dt_drawlayer_paint_finalize_path(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_drawlayer_worker_t::finish_commit_pending, g, dt_iop_module_t::gui_data, dt_drawlayer_worker_t::stroke, TRUE, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
|
static |
Cancel pending async commit idle callback if any.
References dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, dt_drawlayer_worker_t::finish_commit_pending, dt_drawlayer_worker_t::finish_commit_source_id, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _stop_worker(), and dt_drawlayer_commit_dabs().
|
static |
References DT_DRAWLAYER_BRUSH_MODE_SMUDGE, FALSE, i, dt_drawlayer_brush_dab_t::mode, and TRUE.
Referenced by _rasterize_pending_dab_batch(), and dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
|
static |
References dt_drawlayer_paint_stroke_t::dab_window, dt_drawlayer_paint_runtime_private_destroy(), dt_free, dt_free_align, dt_drawlayer_paint_stroke_t::history, dt_drawlayer_paint_stroke_t::pending_dabs, drawlayer_fullres_replay_scratch_t::replay_pixels, drawlayer_fullres_replay_scratch_t::stroke, drawlayer_fullres_replay_scratch_t::stroke_mask, and TRUE.
|
static |
References _rt_queue_pop_locked(), FALSE, and dt_drawlayer_worker_t::stroke_raw_inputs.
Referenced by dt_drawlayer_worker_seal_for_commit().
Deferred full-resolution replay worker main loop.
References _finished_stroke_job_destroy(), DT_DRAWLAYER_WORKER_STATE_BUSY, DT_DRAWLAYER_WORKER_STATE_IDLE, dt_free, dt_pthread_cond_wait(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_pthread_setname(), dt_drawlayer_worker_t::finished_stroke_cb, dt_drawlayer_worker_t::finished_stroke_queue, dt_drawlayer_worker_t::fullres_state, dt_drawlayer_worker_t::fullres_stop, drawlayer_finished_stroke_job_t::raw_inputs, drawlayer_rt_thread_ctx_t::rt, dt_drawlayer_worker_t::self, TRUE, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _start_fullres_worker().
Worker main loop: FIFO dequeue, process, and idle scheduling.
References _backend_pending_dabs_locked(), _backend_worker(), _rt_callbacks, _rt_queue_pop_locked(), _rt_set_worker_state(), _set_current_thread_realtime_best_effort(), _worker_pause_requested(), DRAWLAYER_RT_WORKER_BACKEND, DT_DRAWLAYER_PAINT_STROKE_END, DT_DRAWLAYER_WORKER_STATE_BUSY, DT_DRAWLAYER_WORKER_STATE_IDLE, DT_DRAWLAYER_WORKER_STATE_PAUSED, DT_DRAWLAYER_WORKER_STATE_STOPPED, dt_free, dt_pthread_cond_wait(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_pthread_setname(), FALSE, drawlayer_rt_callbacks_t::on_idle, drawlayer_rt_callbacks_t::process_sample, drawlayer_rt_callbacks_t::process_stroke_end, drawlayer_rt_worker_t::ring_count, drawlayer_rt_thread_ctx_t::rt, dt_drawlayer_worker_t::self, drawlayer_rt_worker_t::stop, drawlayer_rt_callbacks_t::thread_name, TRUE, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _start_worker().
|
static |
Generic enqueue helper ensuring worker startup.
References _rt_queue_push_locked(), _start_worker(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _enqueue_stroke_end().
|
static |
Queue preserved finished stroke for deferred full-resolution replay (lock must be held).
References _finished_stroke_job_destroy(), _start_fullres_worker(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, dt_drawlayer_worker_t::finished_stroke_cb, dt_drawlayer_worker_t::finished_stroke_queue, dt_drawlayer_worker_t::finished_stroke_queued, drawlayer_finished_stroke_job_t::raw_inputs, dt_drawlayer_worker_t::stroke_raw_inputs, TRUE, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _backend_worker_process_stroke_end().
|
static |
Enqueue raw input with saturation policy and stroke-abort fallback.
References _backend_worker(), _rt_queue_full(), _rt_queue_push_locked(), _start_worker(), dt_control_log(), DT_DRAWLAYER_PAINT_STROKE_END, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_drawlayer_paint_raw_input_t::event_index, FALSE, dt_drawlayer_worker_t::finish_commit_pending, drawlayer_rt_worker_t::ring, drawlayer_rt_worker_t::ring_capacity, drawlayer_rt_worker_t::ring_count, drawlayer_rt_worker_t::ring_tail, dt_drawlayer_paint_raw_input_t::stroke_pos, dt_drawlayer_worker_t::stroke_sample_count, TRUE, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_worker_enqueue_input().
|
static |
Enqueue explicit stroke-end event (with optional raw release sample).
References _enqueue_event(), dt_drawlayer_worker_t::current_stroke_batch, dt_control_log(), DT_DRAWLAYER_PAINT_STROKE_END, FALSE, dt_drawlayer_paint_raw_input_t::stroke_batch, dt_drawlayer_paint_raw_input_t::stroke_pos, and TRUE.
Referenced by dt_drawlayer_worker_enqueue_stroke_end().
|
static |
References dt_alloc_align(), and dt_free_align.
Referenced by dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
|
static |
Destroy one finished-stroke replay job and owned history.
References dt_free, drawlayer_finished_stroke_job_t::raw_inputs, and TRUE.
Referenced by _drawlayer_fullres_worker_main(), _enqueue_finished_stroke(), and _rt_destroy_state().
|
static |
Check whether deferred full-resolution replay still has pending activity (lock must be held).
References _fullres_worker_busy(), dt_drawlayer_worker_t::finished_stroke_queue, and dt_drawlayer_worker_t::fullres_stop.
Referenced by _workers_any_active_locked().
|
inlinestatic |
References DT_DRAWLAYER_WORKER_STATE_BUSY, and dt_drawlayer_worker_t::fullres_state.
Referenced by _fullres_active_locked(), and _wait_fullres_idle().
|
inlinestatic |
References DT_DRAWLAYER_WORKER_STATE_STOPPED, and dt_drawlayer_worker_t::fullres_state.
Referenced by _start_fullres_worker(), _start_worker(), _stop_worker(), and _wait_fullres_idle().
|
static |
References _drawlayer_fullres_replay_scratch_key, dt_drawlayer_paint_stroke_t::dab_window, dt_drawlayer_paint_runtime_private_create(), dt_drawlayer_paint_runtime_private_destroy(), dt_free, FALSE, dt_drawlayer_paint_stroke_t::history, dt_drawlayer_paint_stroke_t::pending_dabs, drawlayer_fullres_replay_scratch_t::stroke, and TRUE.
Referenced by dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
|
inlinestatic |
References dt_drawlayer_worker_t::live_publish_ts.
Referenced by _process_backend_input().
|
inlinestatic |
References DT_DEV_PIXELPIPE_FULL, dt_gui_throttle_get_pipe_runtime_us(), and MAX.
Referenced by _backend_worker_on_idle(), and _process_backend_input().
|
static |
References darktable, DT_DEBUG_PERF, dt_print(), and darktable_t::unmuted.
Referenced by _rasterize_pending_dab_batch(), and dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
|
inlinestatic |
References drawlayer_paint_backend_ctx_t::self, and dt_drawlayer_worker_t::stroke.
Referenced by _backend_worker_on_idle(), _backend_worker_process_stroke_end(), and _process_backend_input().
|
static |
|
static |
References _process_backend_dab(), and drawlayer_paint_backend_ctx_t::self.
Referenced by _backend_worker_process_stroke_end(), and _process_backend_input().
|
static |
References void().
Referenced by dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
|
static |
|
static |
Pause worker processing after current callback returns.
References _backend_worker(), _worker_is_busy(), _worker_is_started(), DT_DRAWLAYER_WORKER_STATE_PAUSED, DT_DRAWLAYER_WORKER_STATE_PAUSING, dt_pthread_cond_wait(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), drawlayer_rt_worker_t::state, drawlayer_rt_worker_t::stop, void(), dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_sync_widget_cache(), and dt_drawlayer_worker_seal_for_commit().
|
static |
References _clamp01(), dt_drawlayer_paint_stroke_t::dab_window, dt_drawlayer_paint_stroke_t::distance_percent, dt_drawlayer_paint_rasterize_segment_to_buffer(), dt_drawlayer_paint_runtime_get_stroke_damage(), dt_drawlayer_paint_runtime_note_dab_damage(), dt_drawlayer_paint_runtime_state_reset(), FALSE, g, dt_iop_module_t::gui_data, dt_drawlayer_worker_t::live_publish_damage, drawlayer_paint_backend_ctx_t::stroke, TRUE, drawlayer_paint_backend_ctx_t::worker, dt_drawlayer_brush_dab_t::x, dt_drawlayer_cache_patch_t::x, dt_drawlayer_brush_dab_t::y, and dt_drawlayer_cache_patch_t::y.
Referenced by _paint_emit_backend_dab_cb(), and _rasterize_pending_dab_batch().
|
static |
References _live_publish_deadline_reached(), _live_publish_interval_us(), _make_backend_ctx(), _paint_build_dab_cb(), _paint_emit_backend_dab_cb(), _paint_layer_to_widget_cb(), _paint_stroke_seed_cb(), _publish_backend_progress(), _rasterize_pending_dab_batch(), dt_drawlayer_paint_callbacks_t::build_dab, dt_drawlayer_paint_interpolate_path(), dt_drawlayer_paint_queue_raw_input(), dt_drawlayer_paint_raw_input_t::event_ts, g, dt_iop_module_t::gui_data, dt_drawlayer_worker_t::live_publish_ts, dt_drawlayer_paint_stroke_t::pending_dabs, TRUE, and drawlayer_paint_backend_ctx_t::worker.
Referenced by _backend_worker_process_sample().
|
static |
References dt_iop_module_t::dev, dt_dev_add_history_item_ext(), dt_dev_history_compute_hash(), dt_dev_set_history_hash(), dt_drawlayer_paint_runtime_state_reset(), dt_drawlayer_process_state_publish_locked(), dt_drawlayer_touch_stroke_commit_hash(), dt_pthread_rwlock_unlock, dt_pthread_rwlock_wrlock, FALSE, g, dt_iop_module_t::gui_data, dt_develop_t::history_mutex, dt_drawlayer_worker_t::live_publish_damage, dt_drawlayer_worker_t::live_publish_serial, dt_drawlayer_worker_t::live_publish_ts, dt_iop_module_t::params, drawlayer_paint_backend_ctx_t::self, dt_drawlayer_damaged_rect_t::valid, and drawlayer_paint_backend_ctx_t::worker.
Referenced by _backend_worker_on_idle(), _backend_worker_process_stroke_end(), and _process_backend_input().
|
static |
References _clamp01(), _dab_batch_supports_outer_loop(), _log_worker_batch_timing(), _process_backend_dab(), _worker_batch_min_size(), dt_drawlayer_paint_stroke_t::distance_percent, DRAWLAYER_OUTER_LIVE_BATCH_MULTIPLIER, dt_drawlayer_cache_patch_wrlock(), dt_drawlayer_cache_patch_wrunlock(), dt_drawlayer_paint_runtime_note_dab_damage(), dt_get_wtime(), FALSE, g, dt_iop_module_t::gui_data, dt_drawlayer_worker_t::live_publish_damage, MIN, dt_drawlayer_paint_stroke_t::pending_dabs, drawlayer_paint_backend_ctx_t::self, drawlayer_paint_backend_ctx_t::stroke, TRUE, dt_drawlayer_damaged_rect_t::valid, drawlayer_paint_backend_ctx_t::worker, dt_drawlayer_brush_dab_t::x, dt_drawlayer_cache_patch_t::x, dt_drawlayer_brush_dab_t::y, and dt_drawlayer_cache_patch_t::y.
Referenced by _backend_worker_on_idle(), _backend_worker_process_stroke_end(), and _process_backend_input().
|
static |
References dt_drawlayer_worker_t::backend_path, and dt_drawlayer_paint_runtime_state_reset().
Referenced by dt_drawlayer_worker_reset_backend_path().
|
static |
|
static |
Resume worker processing and wake sleeping thread.
References _backend_worker(), _worker_is_started(), DT_DRAWLAYER_WORKER_STATE_IDLE, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), drawlayer_rt_worker_t::state, void(), dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_sync_widget_cache().
|
static |
Destroy worker state object and all owned resources.
References _rt_destroy_state().
Referenced by dt_drawlayer_worker_cleanup().
|
static |
Stop and free an existing worker state object.
References _backend_worker(), _finished_stroke_job_destroy(), _stop_worker(), _stroke_destroy(), dt_drawlayer_worker_t::backend_history, dt_drawlayer_worker_t::backend_path, dt_drawlayer_paint_runtime_state_destroy(), dt_free, dt_pthread_mutex_destroy(), dt_drawlayer_worker_t::finished_stroke_queue, drawlayer_rt_worker_t::ring, dt_drawlayer_worker_t::self, dt_drawlayer_worker_t::stroke_raw_inputs, TRUE, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _rt_cleanup_state(), and _rt_init_state().
|
static |
Allocate and initialize worker state object and buffers.
References _backend_worker(), _reset_live_publish(), _rt_destroy_state(), _stroke_create(), dt_drawlayer_worker_t::backend_history, dt_drawlayer_worker_t::backend_path, dt_drawlayer_worker_t::current_stroke_batch, DRAWLAYER_WORKER_RING_CAPACITY, dt_drawlayer_paint_runtime_state_create(), dt_pthread_mutex_init(), FALSE, dt_drawlayer_worker_t::finish_commit_pending, dt_drawlayer_worker_t::finished_stroke_cb, dt_drawlayer_worker_t::finished_stroke_queue, dt_drawlayer_worker_t::painting, drawlayer_rt_worker_t::ring, drawlayer_rt_worker_t::ring_capacity, dt_drawlayer_worker_t::self, dt_drawlayer_worker_t::stroke_raw_inputs, dt_drawlayer_worker_t::stroke_sample_count, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_worker_init().
|
static |
Clear queued events (lock must be held).
References _backend_worker(), drawlayer_rt_worker_t::ring_count, drawlayer_rt_worker_t::ring_head, and drawlayer_rt_worker_t::ring_tail.
Referenced by _stop_worker().
|
static |
Test whether event queue is empty.
References _backend_worker_const(), and drawlayer_rt_worker_t::ring_count.
Referenced by _rt_queue_pop_locked().
|
static |
Test whether event queue is full.
References _backend_worker_const(), drawlayer_rt_worker_t::ring_capacity, and drawlayer_rt_worker_t::ring_count.
Referenced by _enqueue_input(), and _rt_queue_push_locked().
|
static |
Pop one event from ring queue (lock must be held).
References _backend_worker(), _rt_queue_empty(), FALSE, drawlayer_rt_worker_t::ring, drawlayer_rt_worker_t::ring_capacity, drawlayer_rt_worker_t::ring_count, drawlayer_rt_worker_t::ring_head, and TRUE.
Referenced by _drain_queued_raw_inputs_locked(), and _drawlayer_worker_main().
|
static |
Push one event in ring queue (lock must be held).
References _backend_worker(), _rt_queue_full(), FALSE, drawlayer_rt_worker_t::ring, drawlayer_rt_worker_t::ring_capacity, drawlayer_rt_worker_t::ring_count, drawlayer_rt_worker_t::ring_tail, and TRUE.
Referenced by _enqueue_event(), and _enqueue_input().
|
static |
Set worker state atomically under caller synchronization.
References _backend_worker(), and drawlayer_rt_worker_t::state.
Referenced by _drawlayer_worker_main().
|
static |
Thread-safe wrapper for active-workers status.
References _workers_active_locked(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_worker_active().
|
static |
Thread-safe wrapper for any worker activity, including deferred replay.
References _workers_any_active_locked(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_worker_any_active().
|
static |
Schedule async commit when lock-state indicates readiness.
References _async_commit_idle(), _workers_ready_for_commit_locked(), dt_iop_module_t::dev, dt_drawlayer_worker_t::finish_commit_source_id, and dt_drawlayer_worker_t::self.
Referenced by _backend_worker_on_idle(), _backend_worker_process_stroke_end(), and dt_drawlayer_worker_request_commit().
Try elevating current thread scheduling policy for lower-latency input.
References MIN.
Referenced by _drawlayer_worker_main().
|
static |
Start deferred full-resolution replay worker if not running.
References _drawlayer_fullres_worker_main(), _fullres_worker_started(), DT_DRAWLAYER_WORKER_STATE_IDLE, dt_free, dt_pthread_create(), FALSE, dt_drawlayer_worker_t::fullres_state, dt_drawlayer_worker_t::fullres_stop, dt_drawlayer_worker_t::fullres_thread, drawlayer_rt_thread_ctx_t::rt, and TRUE.
Referenced by _enqueue_finished_stroke(), and _start_worker().
|
static |
Start backend worker thread if not running.
References _backend_worker(), _drawlayer_worker_main(), _fullres_worker_started(), _start_fullres_worker(), _worker_is_started(), DT_DRAWLAYER_WORKER_STATE_IDLE, dt_free, dt_pthread_create(), FALSE, drawlayer_rt_thread_ctx_t::rt, drawlayer_rt_worker_t::state, drawlayer_rt_worker_t::stop, drawlayer_rt_worker_t::thread, and TRUE.
Referenced by _enqueue_event(), _enqueue_input(), and dt_drawlayer_worker_ensure_running().
|
static |
Stop worker thread and clear transient state.
References _backend_worker(), _cancel_async_commit(), _fullres_worker_started(), _rt_queue_clear_locked(), _stroke_clear(), _wait_fullres_idle(), _wait_worker_idle(), _worker_is_started(), DT_DRAWLAYER_WORKER_STATE_STOPPED, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, dt_drawlayer_worker_t::fullres_state, dt_drawlayer_worker_t::fullres_stop, dt_drawlayer_worker_t::fullres_thread, drawlayer_rt_worker_t::state, drawlayer_rt_worker_t::stop, drawlayer_rt_worker_t::thread, TRUE, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _rt_destroy_state(), and dt_drawlayer_worker_stop().
|
static |
Start new stroke runtime and reset history/path state.
References _stroke_create(), dt_drawlayer_worker_t::backend_history, dt_drawlayer_paint_path_state_reset(), dt_drawlayer_paint_runtime_private_reset(), FALSE, dt_drawlayer_worker_t::finished_stroke_queued, dt_drawlayer_paint_stroke_t::history, dt_drawlayer_worker_t::stroke, dt_drawlayer_worker_t::stroke_raw_inputs, and TRUE.
Referenced by _backend_worker_process_sample().
|
static |
Clear current stroke state while preserving allocations.
References dt_drawlayer_worker_t::backend_history, dt_drawlayer_paint_path_state_reset(), dt_drawlayer_paint_runtime_private_reset(), FALSE, dt_drawlayer_worker_t::finished_stroke_queued, dt_drawlayer_worker_t::stroke, and dt_drawlayer_worker_t::stroke_raw_inputs.
Referenced by _stop_worker(), and dt_drawlayer_worker_reset_stroke().
|
static |
Create stroke runtime if missing.
References dt_drawlayer_worker_t::backend_history, dt_drawlayer_paint_stroke_t::dab_window, dt_drawlayer_paint_runtime_private_create(), dt_drawlayer_paint_runtime_private_destroy(), FALSE, dt_drawlayer_paint_stroke_t::history, dt_drawlayer_paint_stroke_t::pending_dabs, dt_drawlayer_worker_t::stroke, and TRUE.
Referenced by _rt_init_state(), and _stroke_begin().
|
static |
Deep-copy preserved stroke history into one deferred replay job.
Destroy stroke runtime and owned dab window.
References dt_drawlayer_paint_stroke_t::dab_window, dt_drawlayer_paint_runtime_private_destroy(), dt_drawlayer_paint_stroke_t::pending_dabs, dt_drawlayer_worker_t::stroke, and TRUE.
Referenced by _rt_destroy_state().
|
static |
Wait until deferred full-resolution replay queue is drained and idle.
References _fullres_worker_busy(), _fullres_worker_started(), dt_pthread_cond_wait(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_drawlayer_worker_t::finished_stroke_queue, dt_drawlayer_worker_t::fullres_stop, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _stop_worker(), and dt_drawlayer_worker_flush_finished_strokes().
|
static |
Wait until worker queue is drained and not busy.
References _backend_worker_const(), _worker_is_busy(), _worker_is_started(), dt_pthread_cond_wait(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), drawlayer_rt_worker_t::ring_count, drawlayer_rt_worker_t::stop, TRUE, void(), dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _stop_worker(), dt_drawlayer_commit_dabs(), and dt_drawlayer_worker_flush_pending().
|
static |
References MAX, and omp_get_max_threads.
Referenced by _rasterize_pending_dab_batch(), and dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
|
inlinestatic |
References DT_DRAWLAYER_WORKER_STATE_BUSY, and drawlayer_rt_worker_t::state.
Referenced by _pause_worker(), _wait_worker_idle(), _workers_active_locked(), and _workers_ready_for_commit_locked().
|
inlinestatic |
References DT_DRAWLAYER_WORKER_STATE_STOPPED, and drawlayer_rt_worker_t::state.
Referenced by _pause_worker(), _resume_worker(), _start_worker(), _stop_worker(), and _wait_worker_idle().
|
inlinestatic |
References DT_DRAWLAYER_WORKER_STATE_PAUSED, DT_DRAWLAYER_WORKER_STATE_PAUSING, and drawlayer_rt_worker_t::state.
Referenced by _drawlayer_worker_main().
|
static |
Check whether workers still have pending activity (lock must be held).
References _backend_worker_const(), _worker_is_busy(), dt_drawlayer_worker_t::finish_commit_pending, and drawlayer_rt_worker_t::ring_count.
Referenced by _rt_workers_active(), and _workers_any_active_locked().
|
static |
Check whether any worker activity remains (backend or deferred replay).
References _fullres_active_locked(), and _workers_active_locked().
Referenced by _rt_workers_any_active().
|
static |
Check if workers are idle and commit can be safely scheduled.
References _backend_worker_const(), _worker_is_busy(), dt_drawlayer_worker_t::finish_commit_pending, dt_drawlayer_worker_t::painting, and drawlayer_rt_worker_t::ring_count.
Referenced by _async_commit_idle(), and _schedule_async_commit_if_ready_locked().
| gboolean dt_drawlayer_build_worker_input_dab | ( | dt_iop_module_t * | self, |
| dt_drawlayer_paint_stroke_t * | state, | ||
| const dt_drawlayer_paint_raw_input_t * | input, | ||
| dt_drawlayer_brush_dab_t * | dab | ||
| ) |
References _clamp01(), _mapping_profile_value(), dt_drawlayer_paint_raw_input_t::accel_profile, dt_drawlayer_paint_raw_input_t::acceleration, dt_drawlayer_paint_raw_input_t::brush_flow, dt_drawlayer_paint_raw_input_t::brush_hardness, dt_drawlayer_paint_raw_input_t::brush_mode, dt_drawlayer_paint_raw_input_t::brush_opacity, dt_drawlayer_paint_raw_input_t::brush_radius, dt_drawlayer_paint_raw_input_t::brush_shape, dt_drawlayer_paint_raw_input_t::brush_sprinkle_coarseness, dt_drawlayer_paint_raw_input_t::brush_sprinkle_size, dt_drawlayer_paint_raw_input_t::brush_sprinkles, dt_drawlayer_paint_raw_input_t::color, dt_drawlayer_paint_raw_input_t::display_color, DRAWLAYER_INPUT_MAP_ACCEL_FLOW, DRAWLAYER_INPUT_MAP_ACCEL_OPACITY, DRAWLAYER_INPUT_MAP_ACCEL_SIZE, DRAWLAYER_INPUT_MAP_ACCEL_SOFTNESS, DRAWLAYER_INPUT_MAP_PRESSURE_FLOW, DRAWLAYER_INPUT_MAP_PRESSURE_OPACITY, DRAWLAYER_INPUT_MAP_PRESSURE_SIZE, DRAWLAYER_INPUT_MAP_PRESSURE_SOFTNESS, DRAWLAYER_INPUT_MAP_TILT_FLOW, DRAWLAYER_INPUT_MAP_TILT_OPACITY, DRAWLAYER_INPUT_MAP_TILT_SIZE, DRAWLAYER_INPUT_MAP_TILT_SOFTNESS, DRAWLAYER_PROFILE_INV_QUADRATIC, DRAWLAYER_PROFILE_LINEAR, DT_DEBUG_INPUT, DT_DRAWLAYER_PAINT_STROKE_MIDDLE, dt_drawlayer_widget_to_layer_coords(), dt_print(), FALSE, dt_drawlayer_paint_stroke_t::have_last_input_dab, dt_drawlayer_paint_raw_input_t::have_layer_coords, dt_drawlayer_paint_stroke_t::history, dt_drawlayer_paint_stroke_t::last_input_dab, dt_drawlayer_paint_raw_input_t::lx, dt_drawlayer_paint_raw_input_t::ly, dt_drawlayer_paint_raw_input_t::map_flags, dt_drawlayer_paint_raw_input_t::pressure, dt_drawlayer_paint_raw_input_t::pressure_profile, dt_drawlayer_paint_raw_input_t::stroke_batch, dt_drawlayer_paint_raw_input_t::stroke_pos, dt_drawlayer_paint_raw_input_t::tilt, dt_drawlayer_paint_raw_input_t::tilt_profile, TRUE, dt_drawlayer_paint_raw_input_t::wx, dt_drawlayer_paint_raw_input_t::wy, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by _paint_build_dab_cb().
| gboolean dt_drawlayer_worker_active | ( | const dt_drawlayer_worker_t * | worker | ) |
Public status query: TRUE when worker has pending activity.
Query whether realtime/backend worker still has pending activity.
References _rt_workers_active().
Referenced by dt_drawlayer_begin_gui_stroke_capture().
| gboolean dt_drawlayer_worker_any_active | ( | const dt_drawlayer_worker_t * | worker | ) |
Public status query: TRUE when any worker still has pending activity.
Query whether any worker still has pending activity, including full-resolution replay.
References _rt_workers_any_active().
Referenced by _drawlayer_modal_wait_tick(), dt_drawlayer_build_process_patch_from_base(), dt_drawlayer_flush_layer_cache(), dt_drawlayer_flush_process_patch_to_base(), and dt_drawlayer_wait_for_rasterization_modal().
| void dt_drawlayer_worker_cleanup | ( | dt_drawlayer_worker_t ** | worker | ) |
Public worker cleanup entry point.
Stop worker and release all resources.
References _rt_cleanup_state().
Referenced by gui_cleanup().
| gboolean dt_drawlayer_worker_enqueue_input | ( | dt_drawlayer_worker_t * | worker, |
| const dt_drawlayer_paint_raw_input_t * | input | ||
| ) |
Public FIFO enqueue for one raw input event.
Enqueue one raw input event (FIFO, no coalescing).
References _enqueue_input(), and dt_drawlayer_worker_t::self.
Referenced by dt_drawlayer_runtime_manager_update().
| gboolean dt_drawlayer_worker_enqueue_stroke_end | ( | dt_drawlayer_worker_t * | worker, |
| const dt_drawlayer_paint_raw_input_t * | input | ||
| ) |
Public FIFO enqueue for stroke-end event.
Enqueue stroke-end marker carrying final raw input sample.
References _enqueue_stroke_end(), and dt_drawlayer_worker_t::self.
Referenced by dt_drawlayer_runtime_manager_update().
| gboolean dt_drawlayer_worker_ensure_running | ( | dt_iop_module_t * | self, |
| dt_drawlayer_worker_t * | rt | ||
| ) |
Ensure realtime/backend worker threads are started.
References _start_worker().
Referenced by dt_drawlayer_runtime_manager_update().
| gboolean dt_drawlayer_worker_finished_stroke_queued | ( | const dt_drawlayer_worker_t * | worker | ) |
Report whether current preserved stroke was already queued for deferred replay.
Query whether the current preserved stroke has already been handed off for full-resolution replay.
References FALSE, and dt_drawlayer_worker_t::finished_stroke_queued.
Referenced by dt_drawlayer_commit_dabs().
| void dt_drawlayer_worker_flush_finished_strokes | ( | dt_drawlayer_worker_t * | worker | ) |
Wait until deferred full-resolution replay queue becomes idle.
Wait until deferred full-resolution replay queue is idle.
References _wait_fullres_idle().
Referenced by dt_drawlayer_commit_dabs(), dt_drawlayer_flush_layer_cache(), dt_drawlayer_flush_process_patch_to_base(), and dt_drawlayer_runtime_manager_update().
| void dt_drawlayer_worker_flush_pending | ( | dt_drawlayer_worker_t * | worker | ) |
Flush pending backend stroke inputs synchronously.
Flush pending events and force commit transition.
References _wait_worker_idle(), and dt_drawlayer_worker_t::self.
| void dt_drawlayer_worker_get_snapshot | ( | const dt_drawlayer_worker_t * | worker, |
| dt_drawlayer_worker_snapshot_t * | snapshot | ||
| ) |
Return a thread-safe worker snapshot for runtime scheduling.
References _backend_worker_const(), dt_drawlayer_worker_snapshot_t::backend_queue_count, dt_drawlayer_worker_snapshot_t::backend_state, dt_drawlayer_worker_snapshot_t::commit_pending, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_drawlayer_worker_t::finish_commit_pending, dt_drawlayer_worker_t::finished_stroke_queue, dt_drawlayer_worker_snapshot_t::fullres_queue_count, dt_drawlayer_worker_t::fullres_state, dt_drawlayer_worker_snapshot_t::fullres_state, drawlayer_rt_worker_t::ring_count, drawlayer_rt_worker_t::state, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _collect_runtime_inputs().
| void dt_drawlayer_worker_init | ( | dt_iop_module_t * | self, |
| dt_drawlayer_worker_t ** | worker, | ||
| gboolean * | painting, | ||
| gboolean * | finish_commit_pending, | ||
| guint * | stroke_sample_count, | ||
| uint32_t * | current_stroke_batch, | ||
| dt_drawlayer_worker_finished_stroke_cb | finished_stroke_cb | ||
| ) |
Public worker initialization entry point.
Initialize worker and bind external state mirrors.
References _rt_init_state().
Referenced by gui_init().
| guint dt_drawlayer_worker_pending_dab_count | ( | const dt_drawlayer_worker_t * | worker | ) |
Return the number of interpolated-but-not-yet-rasterized dabs in the current stroke batch.
References dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_drawlayer_paint_stroke_t::pending_dabs, dt_drawlayer_worker_t::stroke, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_build_process_patch_from_base().
| void dt_drawlayer_worker_publish_backend_stroke_damage | ( | dt_iop_module_t * | self | ) |
Publish accumulated backend stroke damage into drawlayer process/runtime state.
References dt_drawlayer_paint_merge_runtime_stroke_damage(), g, dt_iop_module_t::gui_data, and TRUE.
Referenced by dt_drawlayer_commit_dabs().
| GArray * dt_drawlayer_worker_raw_inputs | ( | dt_drawlayer_worker_t * | worker | ) |
Read-only access to preserved raw input history.
Read-only access to preserved raw input queue for current stroke (valid only while worker is idle).
References dt_drawlayer_worker_t::stroke_raw_inputs.
Referenced by dt_drawlayer_commit_dabs().
| gboolean dt_drawlayer_worker_replay_finished_stroke_to_base_patch | ( | dt_iop_module_t * | self, |
| const GArray * | raw_inputs | ||
| ) |
Replay one finished stroke into the authoritative base patch from preserved raw inputs.
References _clamp01(), _dab_batch_supports_outer_loop(), _ensure_fullres_replay_float_buffer(), _get_fullres_replay_scratch(), _log_worker_batch_timing(), _paint_build_dab_cb(), _paint_emit_noop_cb(), _paint_layer_to_widget_cb(), _paint_stroke_seed_cb(), _worker_batch_min_size(), dt_drawlayer_paint_callbacks_t::build_dab, dt_drawlayer_paint_stroke_t::dab_window, darktable, dt_drawlayer_paint_stroke_t::distance_percent, DRAWLAYER_OUTER_FULLRES_BATCH_MULTIPLIER, dt_dev_pixelpipe_cache_flush_host_pinned_image(), dt_drawlayer_cache_patch_rdlock(), dt_drawlayer_cache_patch_rdunlock(), dt_drawlayer_cache_patch_wrlock(), dt_drawlayer_cache_patch_wrunlock(), dt_drawlayer_paint_finalize_path(), dt_drawlayer_paint_interpolate_path(), dt_drawlayer_paint_path_state_reset(), dt_drawlayer_paint_queue_raw_input(), dt_drawlayer_paint_raster_path(), dt_drawlayer_paint_runtime_note_dab_damage(), dt_drawlayer_paint_runtime_private_reset(), dt_get_wtime(), dt_iop_nap(), FALSE, g, dt_iop_module_t::gui_data, dt_drawlayer_paint_stroke_t::history, i, MIN, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_paint_stroke_t::pending_dabs, darktable_t::pixelpipe_cache, dt_drawlayer_brush_dab_t::radius, drawlayer_fullres_replay_scratch_t::replay_pixels, drawlayer_fullres_replay_scratch_t::replay_pixels_capacity, dt_drawlayer_damaged_rect_t::se, drawlayer_paint_backend_ctx_t::self, drawlayer_fullres_replay_scratch_t::stroke, drawlayer_fullres_replay_scratch_t::stroke_mask, drawlayer_fullres_replay_scratch_t::stroke_mask_capacity, TRUE, dt_drawlayer_damaged_rect_t::valid, dt_drawlayer_brush_dab_t::x, dt_drawlayer_cache_patch_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by dt_drawlayer_commit_dabs(), and gui_init().
| void dt_drawlayer_worker_request_commit | ( | dt_drawlayer_worker_t * | worker | ) |
Public commit request helper.
Request asynchronous commit once queues become idle.
References _schedule_async_commit_if_ready_locked(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_drawlayer_worker_t::finish_commit_pending, TRUE, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_commit_dabs(), and dt_drawlayer_runtime_manager_update().
| void dt_drawlayer_worker_reset_backend_path | ( | dt_drawlayer_worker_t * | worker | ) |
Reset worker-owned backend damage accumulator.
References _reset_backend_path(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), and dt_drawlayer_worker_t::worker_mutex.
Referenced by _ensure_widget_cache(), _reset_stroke_session(), and dt_drawlayer_begin_gui_stroke_capture().
| void dt_drawlayer_worker_reset_live_publish | ( | dt_drawlayer_worker_t * | worker | ) |
Reset worker-owned transient live-publish state.
References _reset_live_publish(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), and dt_drawlayer_worker_t::worker_mutex.
Referenced by _reset_stroke_session(), and dt_drawlayer_begin_gui_stroke_capture().
| void dt_drawlayer_worker_reset_stroke | ( | dt_drawlayer_worker_t * | worker | ) |
Clear preserved stroke runtime/history after commit completed.
Clear preserved stroke runtime/history after a completed commit.
References _reset_live_publish(), _stroke_clear(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_commit_dabs().
| void dt_drawlayer_worker_seal_for_commit | ( | dt_drawlayer_worker_t * | worker | ) |
Seal current stroke for synchronous commit by folding queued raw inputs into preserved history.
References _backend_worker(), _drain_queued_raw_inputs_locked(), _pause_worker(), dt_drawlayer_paint_stroke_t::dab_window, DT_DRAWLAYER_WORKER_STATE_IDLE, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_drawlayer_paint_stroke_t::pending_dabs, dt_drawlayer_worker_t::self, drawlayer_rt_worker_t::state, dt_drawlayer_worker_t::stroke, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_commit_dabs().
| void dt_drawlayer_worker_stop | ( | dt_iop_module_t * | self, |
| dt_drawlayer_worker_t * | rt | ||
| ) |
Stop realtime and full-resolution worker threads.
References _stop_worker().
Referenced by dt_drawlayer_runtime_manager_update().
| dt_drawlayer_paint_stroke_t * dt_drawlayer_worker_stroke | ( | dt_drawlayer_worker_t * | worker | ) |
Read-only access to preserved stroke runtime.
Read-only access to preserved stroke runtime (valid only while worker is idle).
References dt_drawlayer_worker_t::stroke.
Referenced by dt_drawlayer_commit_dabs().
|
static |
Referenced by _get_fullres_replay_scratch().
|
static |
Referenced by _drawlayer_worker_main().