![]() |
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 | dt_drawlayer_worker_t |
| Drawlayer worker global state shared with drawlayer module. More... | |
| struct | drawlayer_paint_backend_ctx_t |
| struct | drawlayer_rt_thread_ctx_t |
Macros | |
| #define | DRAWLAYER_BATCH_TILE_SIZE 128 |
| #define | DRAWLAYER_HEARTBEAT_PATCH_NAME "drawlayer heartbeat patch" |
| #define | DRAWLAYER_HEARTBEAT_MASK_NAME "drawlayer heartbeat stroke mask" |
| #define | DRAWLAYER_OUTER_LIVE_BATCH_MULTIPLIER 2u |
Typedefs | |
| typedef enum drawlayer_rt_worker_kind_t | drawlayer_rt_worker_kind_t |
| Internal worker slot kinds (currently backend only). | |
| 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 void(* | drawlayer_rt_idle_cb) (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Callback signature for idle transitions inside worker loop. | |
| typedef struct drawlayer_rt_callbacks_t | drawlayer_rt_callbacks_t |
| Per-worker callback vtable. | |
| typedef struct drawlayer_rt_worker_t | drawlayer_rt_worker_t |
| One worker thread runtime including event ring buffer. | |
| typedef struct drawlayer_paint_backend_ctx_t | drawlayer_paint_backend_ctx_t |
| typedef struct drawlayer_rt_thread_ctx_t | drawlayer_rt_thread_ctx_t |
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_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 gboolean | _process_backend_dab (const dt_drawlayer_brush_dab_t *dab, drawlayer_paint_backend_ctx_t *ctx, const dt_drawlayer_cache_patch_t *sample_patch, dt_drawlayer_cache_patch_t *patch, dt_drawlayer_cache_patch_t *stroke_mask, dt_drawlayer_damaged_rect_t *batch_damage) |
| 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 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 guint | _worker_batch_min_size (void) |
| static void | _log_worker_batch_timing (const char *tag, guint processed_dabs, guint thread_count, double elapsed_ms, gboolean outer_loop) |
| static gboolean | _dab_bounds_in_patch (const dt_drawlayer_cache_patch_t *patch, float scale, const dt_drawlayer_brush_dab_t *dab, dt_drawlayer_damaged_rect_t *bounds) |
| 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 | _stop_worker (dt_iop_module_t *self, dt_drawlayer_worker_t *rt) |
| Stop worker thread and clear transient state. | |
| static void | _stroke_destroy (dt_drawlayer_worker_t *rt) |
| Destroy stroke runtime and owned dab window. | |
| 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 gboolean | _collect_batch_bounds (const GArray *dabs, const guint max_dabs, const dt_drawlayer_cache_patch_t *patch, dt_drawlayer_damaged_rect_t *batch_bounds) |
| Build the scratch patch bounds that cover the next heartbeat dab batch. | |
| static gboolean | _ensure_heartbeat_batch_buffers (dt_drawlayer_worker_t *rt, const dt_drawlayer_damaged_rect_t *batch_bounds) |
| Ensure worker-private heartbeat scratch buffers match the requested batch bounds. | |
| static void | _copy_rgba_batch_from_locked_patch (const dt_drawlayer_cache_patch_t *src, dt_drawlayer_cache_patch_t *dst) |
| Copy one locked RGBA source region into the heartbeat scratch patch. | |
| static void | _copy_mask_batch_from_locked_patch (const dt_drawlayer_cache_patch_t *src, dt_drawlayer_cache_patch_t *dst) |
| Copy one locked alpha-mask source region into the heartbeat scratch mask. | |
| static gboolean | _translate_batch_damage (const dt_drawlayer_cache_patch_t *patch, const dt_drawlayer_damaged_rect_t *local_damage, dt_drawlayer_damaged_rect_t *absolute_damage) |
| Translate scratch-local damage coordinates back into base-patch coordinates. | |
| static void | _copy_rgba_damage_to_locked_patch (const dt_drawlayer_cache_patch_t *src, const dt_drawlayer_damaged_rect_t *local_damage, dt_drawlayer_cache_patch_t *dst) |
| Copy the written scratch sub-rectangle back into the locked base patch. | |
| static void | _copy_mask_damage_to_locked_patch (const dt_drawlayer_cache_patch_t *src, const dt_drawlayer_damaged_rect_t *local_damage, dt_drawlayer_cache_patch_t *dst) |
| Copy the written scratch mask sub-rectangle back into the locked base stroke mask. | |
| static void | _clear_rgba_damage_in_patch (dt_drawlayer_cache_patch_t *patch, const dt_drawlayer_damaged_rect_t *local_damage) |
| Clear only the flushed RGBA sub-rectangle in the heartbeat scratch patch. | |
| static void | _clear_mask_damage_in_patch (dt_drawlayer_cache_patch_t *patch, const dt_drawlayer_damaged_rect_t *local_damage) |
| Clear only the flushed alpha-mask sub-rectangle in the heartbeat scratch mask. | |
| 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 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 | _workers_any_active_locked (const dt_drawlayer_worker_t *rt) |
| Check whether any worker activity remains. | |
| 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. | |
| 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) |
| 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_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 deferred commit request state 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) |
| 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. | |
| 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_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 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_HEARTBEAT_MASK_NAME "drawlayer heartbeat stroke mask" |
| #define DRAWLAYER_HEARTBEAT_PATCH_NAME "drawlayer heartbeat patch" |
| #define DRAWLAYER_OUTER_LIVE_BATCH_MULTIPLIER 2u |
| 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.
|
inlinestatic |
References dt_drawlayer_paint_stroke_t::pending_dabs, and dt_drawlayer_worker_t::stroke.
Referenced by _drawlayer_worker_main(), _workers_active_locked(), and _workers_ready_for_commit_locked().
|
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(), and _stop_worker().
|
inlinestatic |
|
static |
Backend-worker idle hook.
References _backend_worker_const(), _commit_dabs, _live_publish_interval_us(), _make_backend_ctx(), _publish_backend_progress(), _rasterize_pending_dab_batch(), _worker_pause_requested(), _workers_ready_for_commit_locked(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, g, dt_iop_module_t::gui_data, IS_NULL_PTR, dt_drawlayer_paint_stroke_t::pending_dabs, drawlayer_rt_worker_t::stop, 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, IS_NULL_PTR, 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 dt_drawlayer_paint_finalize_path(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_drawlayer_worker_t::finish_commit_pending, IS_NULL_PTR, dt_drawlayer_worker_t::stroke, TRUE, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
|
static |
Cancel deferred commit request state if any.
References dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, dt_drawlayer_worker_t::finish_commit_pending, IS_NULL_PTR, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _stop_worker(), and dt_drawlayer_commit_dabs().
|
static |
Clear only the flushed alpha-mask sub-rectangle in the heartbeat scratch mask.
References IS_NULL_PTR, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_cache_patch_t::pixels, row, dt_drawlayer_damaged_rect_t::se, dt_drawlayer_damaged_rect_t::valid, and dt_drawlayer_cache_patch_t::width.
Referenced by _rasterize_pending_dab_batch().
|
static |
Clear only the flushed RGBA sub-rectangle in the heartbeat scratch patch.
References IS_NULL_PTR, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_cache_patch_t::pixels, row, dt_drawlayer_damaged_rect_t::se, dt_drawlayer_damaged_rect_t::valid, and dt_drawlayer_cache_patch_t::width.
Referenced by _rasterize_pending_dab_batch().
|
static |
Build the scratch patch bounds that cover the next heartbeat dab batch.
References _dab_bounds_in_patch(), dt_drawlayer_paint_runtime_note_dab_damage(), FALSE, i, IS_NULL_PTR, and dt_drawlayer_damaged_rect_t::valid.
Referenced by _rasterize_pending_dab_batch().
|
static |
Copy one locked alpha-mask source region into the heartbeat scratch mask.
References dt_drawlayer_cache_patch_t::height, IS_NULL_PTR, dt_drawlayer_cache_patch_t::pixels, width, dt_drawlayer_cache_patch_t::width, dt_drawlayer_cache_patch_t::x, and dt_drawlayer_cache_patch_t::y.
Referenced by _rasterize_pending_dab_batch().
|
static |
Copy the written scratch mask sub-rectangle back into the locked base stroke mask.
References dt_drawlayer_cache_patch_t::height, IS_NULL_PTR, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_cache_patch_t::pixels, dt_drawlayer_damaged_rect_t::se, dt_drawlayer_damaged_rect_t::valid, dt_drawlayer_cache_patch_t::width, dt_drawlayer_cache_patch_t::x, and dt_drawlayer_cache_patch_t::y.
Referenced by _rasterize_pending_dab_batch().
|
static |
Copy one locked RGBA source region into the heartbeat scratch patch.
References dt_drawlayer_cache_patch_t::height, IS_NULL_PTR, dt_drawlayer_cache_patch_t::pixels, width, dt_drawlayer_cache_patch_t::width, dt_drawlayer_cache_patch_t::x, and dt_drawlayer_cache_patch_t::y.
Referenced by _rasterize_pending_dab_batch().
|
static |
Copy the written scratch sub-rectangle back into the locked base patch.
References dt_drawlayer_cache_patch_t::height, IS_NULL_PTR, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_cache_patch_t::pixels, dt_drawlayer_damaged_rect_t::se, dt_drawlayer_damaged_rect_t::valid, dt_drawlayer_cache_patch_t::width, dt_drawlayer_cache_patch_t::x, and dt_drawlayer_cache_patch_t::y.
Referenced by _rasterize_pending_dab_batch().
|
static |
References FALSE, dt_drawlayer_cache_patch_t::height, IS_NULL_PTR, MAX, MIN, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_brush_dab_t::opacity, dt_drawlayer_cache_patch_t::pixels, dt_drawlayer_brush_dab_t::radius, dt_drawlayer_damaged_rect_t::se, TRUE, dt_drawlayer_damaged_rect_t::valid, dt_drawlayer_cache_patch_t::width, 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 _collect_batch_bounds().
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, IS_NULL_PTR, 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, IS_NULL_PTR, dt_drawlayer_worker_t::worker_cond, and dt_drawlayer_worker_t::worker_mutex.
Referenced by _enqueue_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, IS_NULL_PTR, 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, IS_NULL_PTR, 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 |
Ensure worker-private heartbeat scratch buffers match the requested batch bounds.
References DRAWLAYER_HEARTBEAT_MASK_NAME, DRAWLAYER_HEARTBEAT_PATCH_NAME, dt_drawlayer_cache_ensure_process_patch_buffer(), FALSE, dt_drawlayer_worker_t::heartbeat_patch, dt_drawlayer_worker_t::heartbeat_stroke_mask, height, IS_NULL_PTR, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_damaged_rect_t::se, TRUE, dt_drawlayer_damaged_rect_t::valid, width, dt_drawlayer_cache_patch_t::x, and dt_drawlayer_cache_patch_t::y.
Referenced by _rasterize_pending_dab_batch().
|
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().
|
inlinestatic |
References drawlayer_paint_backend_ctx_t::self, and dt_drawlayer_worker_t::stroke.
Referenced by _backend_worker_on_idle(), and _process_backend_input().
|
static |
References dt_drawlayer_build_worker_input_dab(), FALSE, drawlayer_paint_backend_ctx_t::self, and state.
Referenced by _process_backend_input().
|
static |
References dt_drawlayer_layer_to_widget_coords(), FALSE, and drawlayer_paint_backend_ctx_t::self.
Referenced by _process_backend_input().
References dt_drawlayer_paint_runtime_set_stroke_seed(), IS_NULL_PTR, and drawlayer_paint_backend_ctx_t::stroke.
Referenced by _process_backend_input().
|
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(), IS_NULL_PTR, 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().
|
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_note_dab_damage(), FALSE, IS_NULL_PTR, dt_drawlayer_cache_patch_t::pixels, drawlayer_paint_backend_ctx_t::stroke, and dt_drawlayer_damaged_rect_t::valid.
Referenced by _rasterize_pending_dab_batch().
|
static |
References _live_publish_deadline_reached(), _live_publish_interval_us(), _make_backend_ctx(), _paint_build_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, IS_NULL_PTR, 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_control_queue_redraw_center(), dt_dev_add_history_item_ext(), dt_dev_history_compute_hash(), dt_dev_set_history_hash(), dt_drawlayer_paint_runtime_state_reset(), 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, IS_NULL_PTR, 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(), and _process_backend_input().
|
static |
References _clamp01(), _clear_mask_damage_in_patch(), _clear_rgba_damage_in_patch(), _collect_batch_bounds(), _copy_mask_batch_from_locked_patch(), _copy_mask_damage_to_locked_patch(), _copy_rgba_batch_from_locked_patch(), _copy_rgba_damage_to_locked_patch(), _ensure_heartbeat_batch_buffers(), _log_worker_batch_timing(), _process_backend_dab(), _translate_batch_damage(), _worker_batch_min_size(), dt_drawlayer_worker_t::backend_path, darktable, dt_drawlayer_paint_stroke_t::distance_percent, DRAWLAYER_OUTER_LIVE_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_runtime_note_dab_damage(), dt_get_wtime(), FALSE, g, dt_iop_module_t::gui_data, dt_drawlayer_worker_t::heartbeat_patch, dt_drawlayer_worker_t::heartbeat_stroke_mask, IS_NULL_PTR, dt_drawlayer_worker_t::live_publish_damage, MIN, dt_drawlayer_paint_stroke_t::pending_dabs, darktable_t::pixelpipe_cache, 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, and dt_drawlayer_brush_dab_t::y.
Referenced by _backend_worker_on_idle(), and _process_backend_input().
|
static |
References dt_drawlayer_worker_t::backend_path, dt_drawlayer_paint_runtime_state_reset(), and IS_NULL_PTR.
Referenced by dt_drawlayer_worker_reset_backend_path().
|
static |
References dt_drawlayer_paint_runtime_state_reset(), IS_NULL_PTR, dt_drawlayer_worker_t::live_publish_damage, dt_drawlayer_worker_t::live_publish_serial, and dt_drawlayer_worker_t::live_publish_ts.
Referenced by _rt_init_state(), dt_drawlayer_worker_reset_live_publish(), and dt_drawlayer_worker_reset_stroke().
|
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(), IS_NULL_PTR, 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(), _stop_worker(), _stroke_destroy(), dt_drawlayer_worker_t::backend_history, dt_drawlayer_worker_t::backend_path, DRAWLAYER_HEARTBEAT_MASK_NAME, DRAWLAYER_HEARTBEAT_PATCH_NAME, dt_drawlayer_cache_patch_clear(), dt_drawlayer_paint_runtime_state_destroy(), dt_free, dt_pthread_mutex_destroy(), dt_drawlayer_worker_t::heartbeat_patch, dt_drawlayer_worker_t::heartbeat_stroke_mask, IS_NULL_PTR, 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, IS_NULL_PTR, 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(), IS_NULL_PTR, 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, IS_NULL_PTR, 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 _drawlayer_worker_main().
|
static |
Push one event in ring queue (lock must be held).
References _backend_worker(), _rt_queue_full(), FALSE, IS_NULL_PTR, 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(), IS_NULL_PTR, state, 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, IS_NULL_PTR, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_worker_active().
|
static |
Thread-safe wrapper for any worker activity.
References _workers_any_active_locked(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, IS_NULL_PTR, and dt_drawlayer_worker_t::worker_mutex.
Referenced by dt_drawlayer_worker_any_active().
Try elevating current thread scheduling policy for lower-latency input.
Referenced by _drawlayer_worker_main().
|
static |
Start backend worker thread if not running.
References _backend_worker(), _drawlayer_worker_main(), _worker_is_started(), DT_DRAWLAYER_WORKER_STATE_IDLE, DT_DRAWLAYER_WORKER_STATE_STOPPED, dt_free, dt_pthread_create(), FALSE, IS_NULL_PTR, drawlayer_rt_thread_ctx_t::rt, drawlayer_rt_worker_t::state, drawlayer_rt_worker_t::stop, drawlayer_rt_worker_t::thread, drawlayer_rt_worker_t::thread_started, 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(), _rt_queue_clear_locked(), _stroke_clear(), _wait_worker_idle(), _worker_is_started(), DT_DRAWLAYER_WORKER_STATE_STOPPED, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), FALSE, IS_NULL_PTR, drawlayer_rt_worker_t::state, drawlayer_rt_worker_t::stop, drawlayer_rt_worker_t::thread, drawlayer_rt_worker_t::thread_started, 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_paint_stroke_t::history, IS_NULL_PTR, 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(), IS_NULL_PTR, 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, IS_NULL_PTR, dt_drawlayer_paint_stroke_t::pending_dabs, dt_drawlayer_worker_t::stroke, and TRUE.
Referenced by _rt_init_state(), and _stroke_begin().
|
static |
Destroy stroke runtime and owned dab window.
References dt_drawlayer_paint_stroke_t::dab_window, dt_drawlayer_paint_runtime_private_destroy(), IS_NULL_PTR, dt_drawlayer_paint_stroke_t::pending_dabs, dt_drawlayer_worker_t::stroke, and TRUE.
Referenced by _rt_destroy_state().
|
static |
Translate scratch-local damage coordinates back into base-patch coordinates.
References FALSE, IS_NULL_PTR, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_damaged_rect_t::se, TRUE, dt_drawlayer_damaged_rect_t::valid, dt_drawlayer_cache_patch_t::x, and dt_drawlayer_cache_patch_t::y.
Referenced by _rasterize_pending_dab_batch().
|
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(), IS_NULL_PTR, 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(), dt_drawlayer_flush_layer_cache(), and dt_drawlayer_worker_flush_pending().
|
static |
References MAX, and omp_get_max_threads.
Referenced by _rasterize_pending_dab_batch().
|
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 drawlayer_rt_worker_t::thread_started.
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 _backend_worker_on_idle(), and _drawlayer_worker_main().
|
static |
Check whether workers still have pending activity (lock must be held).
References _backend_pending_dabs_locked(), _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.
References _workers_active_locked().
Referenced by _rt_workers_any_active().
|
static |
Check if workers are idle and commit can be safely scheduled.
References _backend_pending_dabs_locked(), _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 _backend_worker_on_idle().
| 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_raw_input_t::have_layer_coords, IS_NULL_PTR, 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, state, 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, and dt_drawlayer_brush_dab_t::x.
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.
References _rt_workers_any_active().
Referenced by _drawlayer_modal_wait_tick(), dt_drawlayer_flush_layer_cache(), 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().
| 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(), IS_NULL_PTR, 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, IS_NULL_PTR, 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 | ||
| ) |
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(), IS_NULL_PTR, dt_drawlayer_paint_stroke_t::pending_dabs, dt_drawlayer_worker_t::stroke, and dt_drawlayer_worker_t::worker_mutex.
| 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(), dt_drawlayer_paint_runtime_note_dab_damage(), g, dt_iop_module_t::gui_data, IS_NULL_PTR, 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.
| void dt_drawlayer_worker_request_commit | ( | dt_drawlayer_worker_t * | worker | ) |
Public commit request helper.
Request asynchronous commit once queues become idle.
References dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_drawlayer_worker_t::finish_commit_pending, IS_NULL_PTR, 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(), IS_NULL_PTR, 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(), IS_NULL_PTR, 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(), IS_NULL_PTR, 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.
References void().
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.
|
static |
Referenced by _drawlayer_worker_main().