Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
worker.h File Reference

Background stroke worker API for drawlayer realtime painting. More...

#include "iop/iop_api.h"
#include "iop/drawlayer/paint.h"
+ Include dependency graph for worker.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_drawlayer_worker_snapshot_t
 

Typedefs

typedef struct dt_drawlayer_worker_t dt_drawlayer_worker_t
 Opaque worker state (thread, queue, stroke runtime).
 
typedef enum dt_drawlayer_worker_state_t dt_drawlayer_worker_state_t
 
typedef struct dt_drawlayer_worker_snapshot_t dt_drawlayer_worker_snapshot_t
 

Enumerations

enum  dt_drawlayer_worker_state_t {
  DT_DRAWLAYER_WORKER_STATE_STOPPED = 0 ,
  DT_DRAWLAYER_WORKER_STATE_IDLE ,
  DT_DRAWLAYER_WORKER_STATE_BUSY ,
  DT_DRAWLAYER_WORKER_STATE_PAUSING ,
  DT_DRAWLAYER_WORKER_STATE_PAUSED
}
 

Functions

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)
 Initialize worker and bind external state mirrors.
 
void dt_drawlayer_worker_cleanup (dt_drawlayer_worker_t **worker)
 Stop worker and release all resources.
 
gboolean dt_drawlayer_worker_active (const dt_drawlayer_worker_t *worker)
 Query whether realtime/backend worker still has pending activity.
 
gboolean dt_drawlayer_worker_any_active (const dt_drawlayer_worker_t *worker)
 Query whether any worker still has pending activity.
 
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)
 Request asynchronous commit once queues become idle.
 
void dt_drawlayer_worker_flush_pending (dt_drawlayer_worker_t *worker)
 Flush pending events and force commit transition.
 
gboolean dt_drawlayer_worker_ensure_running (dt_iop_module_t *self, dt_drawlayer_worker_t *worker)
 Ensure realtime/backend worker threads are started.
 
void dt_drawlayer_worker_stop (dt_iop_module_t *self, dt_drawlayer_worker_t *worker)
 Stop realtime and full-resolution worker threads.
 
void dt_drawlayer_worker_seal_for_commit (dt_drawlayer_worker_t *worker)
 Seal current stroke for synchronous commit.
 
void dt_drawlayer_worker_publish_backend_stroke_damage (dt_iop_module_t *self)
 Publish accumulated backend stroke damage into drawlayer process/runtime state.
 
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 a completed commit.
 
GArray * dt_drawlayer_worker_raw_inputs (dt_drawlayer_worker_t *worker)
 Read-only access to preserved raw input queue for current stroke (valid only while worker is idle).
 
dt_drawlayer_paint_stroke_tdt_drawlayer_worker_stroke (dt_drawlayer_worker_t *worker)
 Read-only access to preserved stroke runtime (valid only while worker is idle).
 
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)
 Enqueue one raw input event (FIFO, no coalescing).
 
gboolean dt_drawlayer_worker_enqueue_stroke_end (dt_drawlayer_worker_t *worker, const dt_drawlayer_paint_raw_input_t *input)
 Enqueue stroke-end marker carrying final raw input sample.
 

Detailed Description

Background stroke worker API for drawlayer realtime painting.

Typedef Documentation

◆ dt_drawlayer_worker_snapshot_t

◆ dt_drawlayer_worker_state_t

◆ dt_drawlayer_worker_t

Opaque worker state (thread, queue, stroke runtime).

Enumeration Type Documentation

◆ dt_drawlayer_worker_state_t

Enumerator
DT_DRAWLAYER_WORKER_STATE_STOPPED 
DT_DRAWLAYER_WORKER_STATE_IDLE 
DT_DRAWLAYER_WORKER_STATE_BUSY 
DT_DRAWLAYER_WORKER_STATE_PAUSING 
DT_DRAWLAYER_WORKER_STATE_PAUSED 

Function Documentation

◆ dt_drawlayer_worker_active()

gboolean dt_drawlayer_worker_active ( const dt_drawlayer_worker_t worker)

Query whether realtime/backend worker still has pending activity.

Query whether realtime/backend worker still has pending activity.

References _rt_workers_active().

Referenced by dt_drawlayer_begin_gui_stroke_capture().

◆ dt_drawlayer_worker_any_active()

gboolean dt_drawlayer_worker_any_active ( const dt_drawlayer_worker_t worker)

Query whether 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().

◆ dt_drawlayer_worker_cleanup()

void dt_drawlayer_worker_cleanup ( dt_drawlayer_worker_t **  worker)

Stop worker and release all resources.

Stop worker and release all resources.

References _rt_cleanup_state().

Referenced by gui_cleanup().

◆ dt_drawlayer_worker_enqueue_input()

gboolean dt_drawlayer_worker_enqueue_input ( dt_drawlayer_worker_t worker,
const dt_drawlayer_paint_raw_input_t input 
)

Enqueue one raw input event (FIFO, no coalescing).

Enqueue one raw input event (FIFO, no coalescing).

References _enqueue_input(), and dt_drawlayer_worker_t::self.

Referenced by dt_drawlayer_runtime_manager_update().

◆ dt_drawlayer_worker_enqueue_stroke_end()

gboolean dt_drawlayer_worker_enqueue_stroke_end ( dt_drawlayer_worker_t worker,
const dt_drawlayer_paint_raw_input_t input 
)

Enqueue stroke-end marker carrying final raw input sample.

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().

◆ dt_drawlayer_worker_ensure_running()

gboolean dt_drawlayer_worker_ensure_running ( dt_iop_module_t self,
dt_drawlayer_worker_t worker 
)

Ensure realtime/backend worker threads are started.

References _start_worker().

Referenced by dt_drawlayer_runtime_manager_update().

◆ dt_drawlayer_worker_flush_pending()

void dt_drawlayer_worker_flush_pending ( dt_drawlayer_worker_t worker)

Flush pending events and force commit transition.

Flush pending events and force commit transition.

References _wait_worker_idle(), IS_NULL_PTR, and dt_drawlayer_worker_t::self.

◆ dt_drawlayer_worker_get_snapshot()

◆ dt_drawlayer_worker_init()

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 
)

Initialize worker and bind external state mirrors.

Initialize worker and bind external state mirrors.

References _rt_init_state().

Referenced by gui_init().

◆ dt_drawlayer_worker_pending_dab_count()

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.

◆ dt_drawlayer_worker_publish_backend_stroke_damage()

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().

◆ dt_drawlayer_worker_raw_inputs()

GArray * dt_drawlayer_worker_raw_inputs ( dt_drawlayer_worker_t worker)

Read-only access to preserved raw input queue for current stroke (valid only while worker is idle).

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.

◆ dt_drawlayer_worker_request_commit()

void dt_drawlayer_worker_request_commit ( dt_drawlayer_worker_t worker)

◆ dt_drawlayer_worker_reset_backend_path()

void dt_drawlayer_worker_reset_backend_path ( dt_drawlayer_worker_t worker)

◆ dt_drawlayer_worker_reset_live_publish()

void dt_drawlayer_worker_reset_live_publish ( dt_drawlayer_worker_t worker)

◆ dt_drawlayer_worker_reset_stroke()

void dt_drawlayer_worker_reset_stroke ( dt_drawlayer_worker_t worker)

Clear preserved stroke runtime/history after a completed commit.

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().

◆ dt_drawlayer_worker_seal_for_commit()

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().

◆ dt_drawlayer_worker_stop()

void dt_drawlayer_worker_stop ( dt_iop_module_t self,
dt_drawlayer_worker_t worker 
)

Stop realtime and full-resolution worker threads.

References _stop_worker().

Referenced by dt_drawlayer_runtime_manager_update().

◆ dt_drawlayer_worker_stroke()

dt_drawlayer_paint_stroke_t * dt_drawlayer_worker_stroke ( dt_drawlayer_worker_t worker)

Read-only access to preserved stroke runtime (valid only while worker is idle).

Read-only access to preserved stroke runtime (valid only while worker is idle).

References dt_drawlayer_worker_t::stroke.