67 const gboolean resident,
const gboolean valid,
const gboolean dirty)
98 const gboolean write_lock,
99 const gboolean acquire)
137 const gboolean active,
138 const gboolean waiting,
167 .stroke =
g ? &
g->stroke : NULL,
168 .worker = worker_snapshot,
170 .base_patch_valid =
FALSE,
171 .base_patch_dirty =
FALSE,
172 .painting_active =
g &&
g->manager.painting_active,
176 .have_layer_selection = runtime_params && runtime_params->
layer_name[0] !=
'\0',
177 .selected_layer_name = runtime_params ? runtime_params->
layer_name : NULL,
178 .selected_layer_order = runtime_params ? runtime_params->
layer_order : -1,
181 .view_changed =
g && self && self->
dev
182 && (fabsf(
g->session.last_view_x - self->
dev->
roi.
x) > 1e-6f
183 || fabsf(
g->session.last_view_y - self->
dev->
roi.
y) > 1e-6f
184 || fabsf(
g->session.last_view_scale - self->
dev->
roi.
scaling) > 1e-6f),
240 const gboolean backend_active = backend_started
260 switch(request->
event)
345 const gboolean painting_before =
state->painting_active;
359 if(painting_before !=
state->painting_active)
373 &&
state->painting_active;
377 switch(request->
event)
383 realtime_active =
FALSE;
415 state->realtime_active = realtime_active;
458 .inputs = request ? request->
inputs : NULL,
467 .inputs = request ? request->
inputs : NULL,
504 const gboolean layer_selection_changed
514 const gboolean have_pending_stroke_work
517 const gboolean have_pending_gui_stroke_work
519 const gboolean have_pending_cache_writes =
process &&
process->cache_dirty;
521 switch(request->
event)
674 &inputs, &worker_snapshot);
692 .raw_input_ok =
TRUE,
708 switch(request->
event)
742 g->process.cache_valid =
FALSE;
743 g->process.cache_dirty =
FALSE;
745 g->process.cache_imgid = -1;
746 g->process.cache_layer_name[0] =
'\0';
747 g->process.cache_layer_order = -1;
783 .inputs = request->
inputs,
794 .inputs = request->
inputs,
803 g->process.cache_valid =
FALSE;
804 g->process.cache_dirty =
FALSE;
876 .inputs = request->
inputs,
883 .inputs = request->
inputs,
916 const gboolean display_pipe,
919 gboolean *runtime_display_pipe)
921 if(!
IS_NULL_PTR(runtime_manager)) *runtime_manager = display_pipe ? gui_manager : headless_manager;
922 if(!
IS_NULL_PTR(runtime_process)) *runtime_process = display_pipe ? gui_process : headless_process;
923 if(!
IS_NULL_PTR(runtime_display_pipe)) *runtime_display_pipe = display_pipe;
930 state->cache_imgid = -1;
931 state->cache_layer_order = -1;
940 state->cache_imgid = -1;
941 state->cache_layer_order = -1;
947 if(
state->stroke_mask.pixels)
948 memset(
state->stroke_mask.pixels, 0, (
size_t)
state->stroke_mask.width *
state->stroke_mask.height *
sizeof(
float));
958 state->last_composite_dev_out = NULL;
988 if(
state->cursor_surface)
990 cairo_surface_destroy(
state->cursor_surface);
991 state->cursor_surface = NULL;
993 state->cursor_surface_size = 0;
994 state->cursor_surface_ppd = 0.0;
995 state->cursor_radius = 0.0f;
996 state->cursor_opacity = 0.0f;
997 state->cursor_hardness = 0.0f;
998 state->cursor_shape = -1;
999 state->cursor_color[0] =
state->cursor_color[1] =
state->cursor_color[2] = -1.0f;
__DT_CLONE_TARGETS__ int process(struct dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, const void *const ivoid, void *const ovoid)
void gui_update(struct dt_iop_module_t *self)
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void dt_control_log(const char *msg,...)
void dt_control_queue_redraw_center()
request redraw of center window. This redraws the center view within a gdk critical section to preven...
#define dt_control_set_cursor_visible(visible)
float dt_drawlayer_current_live_padding(dt_iop_module_t *self)
void dt_print(dt_debug_thread_t thread, const char *msg,...)
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
gboolean dt_drawlayer_flush_layer_cache(dt_iop_module_t *self)
void dt_drawlayer_show_runtime_feedback(const dt_iop_drawlayer_gui_data_t *g, const dt_drawlayer_runtime_feedback_t feedback)
gboolean dt_drawlayer_sync_widget_cache(dt_iop_module_t *self)
void dt_drawlayer_begin_gui_stroke_capture(dt_iop_module_t *self, const dt_drawlayer_paint_raw_input_t *first_input)
void dt_drawlayer_release_all_base_patch_extra_refs(dt_iop_drawlayer_gui_data_t *g)
gboolean dt_drawlayer_commit_dabs(dt_iop_module_t *self, gboolean record_history)
void dt_drawlayer_set_pipeline_realtime_mode(dt_iop_module_t *self, gboolean state)
void dt_drawlayer_end_gui_stroke_capture(dt_iop_module_t *self)
static int dt_pthread_mutex_unlock(dt_pthread_mutex_t *mutex) RELEASE(mutex) NO_THREAD_SAFETY_ANALYSIS
static int dt_pthread_mutex_init(dt_pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr)
static int dt_pthread_mutex_destroy(dt_pthread_mutex_t *mutex)
static int dt_pthread_mutex_lock(dt_pthread_mutex_t *mutex) ACQUIRE(mutex) NO_THREAD_SAFETY_ANALYSIS
void dt_drawlayer_paint_runtime_state_reset(dt_drawlayer_damaged_rect_t *state)
Reset stroke-damage accumulator to empty/invalid.
Pixelpipe cache for storing intermediate results in the pixelpipe.
static void _release_runtime_source(dt_drawlayer_runtime_manager_t *state, dt_drawlayer_process_state_t *process, dt_drawlayer_runtime_source_t *source)
void dt_drawlayer_runtime_manager_bind_piece(dt_drawlayer_runtime_manager_t *headless_manager, dt_drawlayer_process_state_t *headless_process, dt_drawlayer_runtime_manager_t *gui_manager, dt_drawlayer_process_state_t *gui_process, const gboolean display_pipe, dt_drawlayer_runtime_manager_t **runtime_manager, dt_drawlayer_process_state_t **runtime_process, gboolean *runtime_display_pipe)
void dt_drawlayer_runtime_manager_cleanup(dt_drawlayer_runtime_manager_t *state)
static const dt_drawlayer_runtime_private_t * _runtime_private_const(const dt_drawlayer_runtime_manager_t *state)
void dt_drawlayer_runtime_manager_init(dt_drawlayer_runtime_manager_t *state)
dt_drawlayer_runtime_result_t dt_drawlayer_runtime_manager_update(dt_drawlayer_runtime_manager_t *state, const dt_drawlayer_runtime_update_request_t *request, const dt_drawlayer_runtime_host_t *host)
void dt_drawlayer_process_state_reset_stroke(dt_drawlayer_process_state_t *state)
void dt_drawlayer_process_state_init(dt_drawlayer_process_state_t *state)
static gboolean _perform_runtime_commit_sequence(dt_drawlayer_runtime_manager_t *state, const dt_drawlayer_runtime_update_request_t *request, const dt_drawlayer_runtime_host_t *host, const dt_drawlayer_runtime_commit_mode_t commit_mode, dt_drawlayer_runtime_result_t *result)
void dt_drawlayer_ui_cursor_clear(dt_drawlayer_ui_state_t *state)
void dt_drawlayer_process_state_cleanup(dt_drawlayer_process_state_t *state)
void dt_drawlayer_runtime_manager_note_buffer_lock(dt_drawlayer_runtime_manager_t *state, const dt_drawlayer_runtime_buffer_t buffer, const dt_drawlayer_runtime_actor_t actor, const gboolean write_lock, const gboolean acquire)
static gboolean _perform_runtime_widget_cache_sync(const dt_drawlayer_runtime_host_t *host, dt_drawlayer_runtime_result_t *result)
static void _sync_runtime_state_from_inputs(dt_drawlayer_runtime_manager_t *state, const dt_drawlayer_runtime_inputs_t *inputs)
static dt_drawlayer_runtime_private_t * _runtime_private(dt_drawlayer_runtime_manager_t *state)
void dt_drawlayer_runtime_manager_note_sidecar_io(dt_drawlayer_runtime_manager_t *state, const gboolean active)
void dt_drawlayer_process_state_invalidate(dt_drawlayer_process_state_t *state)
static void _update_realtime_state(dt_drawlayer_runtime_manager_t *state, const dt_drawlayer_runtime_update_request_t *request, const dt_drawlayer_runtime_inputs_t *inputs)
static void _update_manager_information(dt_drawlayer_runtime_manager_t *state, const dt_drawlayer_runtime_update_request_t *request, const dt_drawlayer_runtime_host_t *host, dt_drawlayer_runtime_schedule_t *schedule)
static void _fill_runtime_inputs(const dt_drawlayer_runtime_context_t *runtime, const dt_drawlayer_worker_snapshot_t *worker_snapshot, dt_drawlayer_runtime_inputs_t *inputs)
static void _sync_buffer_state(dt_drawlayer_runtime_manager_t *state, const dt_drawlayer_runtime_buffer_t buffer, const gboolean resident, const gboolean valid, const gboolean dirty)
static void _collect_runtime_inputs(const dt_drawlayer_runtime_update_request_t *request, const dt_drawlayer_runtime_context_t *context, dt_drawlayer_runtime_inputs_t *inputs, dt_drawlayer_worker_snapshot_t *worker_snapshot)
static void _apply_runtime_event(dt_drawlayer_runtime_manager_t *state, const dt_drawlayer_runtime_update_request_t *request, const dt_drawlayer_runtime_inputs_t *inputs)
void dt_drawlayer_runtime_manager_note_thread(dt_drawlayer_runtime_manager_t *state, const dt_drawlayer_runtime_actor_t actor, const gboolean active, const gboolean waiting, const guint queued)
static void _build_runtime_schedule(dt_drawlayer_runtime_manager_t *state, const dt_drawlayer_runtime_update_request_t *request, const dt_drawlayer_runtime_inputs_t *inputs, dt_drawlayer_runtime_schedule_t *schedule)
Private runtime state/helpers shared by drawlayer module entrypoints.
dt_drawlayer_runtime_raw_input_kind_t
@ DT_DRAWLAYER_RUNTIME_RAW_INPUT_NONE
@ DT_DRAWLAYER_RUNTIME_RAW_INPUT_STROKE_BEGIN
@ DT_DRAWLAYER_RUNTIME_RAW_INPUT_STROKE_END
@ DT_DRAWLAYER_RUNTIME_RAW_INPUT_SAMPLE
@ DT_DRAWLAYER_SOURCE_BASE_PATCH
@ DT_DRAWLAYER_SOURCE_NONE
dt_drawlayer_runtime_actor_t
@ DT_DRAWLAYER_RUNTIME_ACTOR_GUI
@ DT_DRAWLAYER_RUNTIME_ACTOR_RASTER_BACKEND
@ DT_DRAWLAYER_RUNTIME_ACTOR_PIPELINE_CPU
@ DT_DRAWLAYER_RUNTIME_ACTOR_COUNT
@ DT_DRAWLAYER_RUNTIME_ACTOR_TIFF_IO
@ DT_DRAWLAYER_RUNTIME_ACTOR_NONE
@ DT_DRAWLAYER_RUNTIME_ACTOR_PIPELINE_CL
dt_drawlayer_runtime_commit_mode_t
@ DT_DRAWLAYER_RUNTIME_COMMIT_HISTORY
@ DT_DRAWLAYER_RUNTIME_COMMIT_QUIET
@ DT_DRAWLAYER_RUNTIME_COMMIT_NONE
dt_drawlayer_runtime_buffer_t
@ DT_DRAWLAYER_RUNTIME_BUFFER_COUNT
@ DT_DRAWLAYER_RUNTIME_BUFFER_BASE_PATCH
@ DT_DRAWLAYER_RUNTIME_BUFFER_STROKE_MASK
dt_drawlayer_runtime_event_t
@ DT_DRAWLAYER_RUNTIME_EVENT_SIDECAR_LOAD_END
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_FOCUS_GAIN
@ DT_DRAWLAYER_RUNTIME_EVENT_SIDECAR_LOAD_BEGIN
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_RESYNC
@ DT_DRAWLAYER_RUNTIME_EVENT_PROCESS_CPU_AFTER
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_SCROLL
@ DT_DRAWLAYER_RUNTIME_EVENT_PROCESS_CL_BEFORE
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_PIPE_FINISHED
@ DT_DRAWLAYER_RUNTIME_EVENT_PROCESS_CL_AFTER
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_CHANGE_IMAGE
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_RAW_INPUT
@ DT_DRAWLAYER_RUNTIME_EVENT_PROCESS_CPU_BEFORE
@ DT_DRAWLAYER_RUNTIME_EVENT_SIDECAR_SAVE_END
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_MOUSE_LEAVE
@ DT_DRAWLAYER_RUNTIME_EVENT_COMMIT_BEGIN
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_STROKE_ABORT
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_MOUSE_ENTER
@ DT_DRAWLAYER_RUNTIME_EVENT_COMMIT_END
@ DT_DRAWLAYER_RUNTIME_EVENT_NONE
@ DT_DRAWLAYER_RUNTIME_EVENT_SIDECAR_SAVE_BEGIN
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_FOCUS_LOSS
@ DT_DRAWLAYER_RUNTIME_EVENT_GUI_SYNC_TEMP_BUFFERS
const float uint32_t state[4]
void dt_drawlayer_cache_patch_clear(dt_drawlayer_cache_patch_t *patch, const char *external_alloc_name)
Release patch storage and reset patch metadata.
void dt_drawlayer_cache_patch_rdunlock(const dt_drawlayer_cache_patch_t *patch)
Release read lock on shared patch cache entry.
dt_drawlayer_runtime_feedback_t
@ DT_DRAWLAYER_RUNTIME_FEEDBACK_NONE
@ DT_DRAWLAYER_RUNTIME_FEEDBACK_FOCUS_LOSS_WAIT
gboolean dt_drawlayer_ensure_layer_cache(dt_iop_module_t *self)
struct dt_iop_module_t * gui_module
struct dt_develop_t::@17 roi
Generic float RGBA patch stored either in malloc memory or pixel cache.
dt_drawlayer_runtime_actor_t writer
dt_drawlayer_runtime_actor_t last_reader
const dt_drawlayer_paint_raw_input_t * raw_input
dt_drawlayer_runtime_request_t runtime
dt_drawlayer_runtime_buffer_state_t buffers[DT_DRAWLAYER_RUNTIME_BUFFER_COUNT]
dt_drawlayer_runtime_event_t last_event
gboolean layer_cache_valid
gboolean sidecar_io_active
dt_drawlayer_runtime_thread_state_t threads[DT_DRAWLAYER_RUNTIME_ACTOR_COUNT]
dt_drawlayer_runtime_raw_input_kind_t last_raw_input_kind
dt_drawlayer_runtime_source_t * source
dt_drawlayer_process_state_t * process
const dt_iop_drawlayer_params_t * runtime_params
dt_iop_drawlayer_gui_data_t * gui
dt_drawlayer_process_state_t * process_state
const dt_iop_roi_t * roi_out
gboolean set_pointer_state
gboolean ensure_layer_cache
gboolean ensure_worker_running
gboolean sync_realtime_mode
dt_drawlayer_runtime_commit_mode_t commit_mode
gboolean pointer_hide_cursor
gboolean invalidate_layer_cache
gboolean queue_redraw_center
gboolean rasterization_busy
gboolean sync_widget_cache
dt_drawlayer_runtime_feedback_t feedback
dt_drawlayer_runtime_buffer_t tracked_buffer
gboolean tracked_read_lock
dt_drawlayer_runtime_source_kind_t kind
dt_drawlayer_runtime_actor_t tracked_actor
const dt_drawlayer_runtime_inputs_t * inputs
dt_drawlayer_runtime_event_t event
dt_drawlayer_runtime_release_t release
dt_drawlayer_runtime_raw_input_kind_t raw_input_kind
gboolean background_job_running
guint stroke_sample_count
dt_drawlayer_worker_t * worker
gboolean finish_commit_pending
dt_drawlayer_worker_state_t backend_state
guint backend_queue_count
dt_drawlayer_stroke_state_t stroke
dt_drawlayer_runtime_manager_t manager
struct dt_develop_t * dev
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_stop(dt_iop_module_t *self, dt_drawlayer_worker_t *rt)
Stop realtime and full-resolution worker threads.
gboolean dt_drawlayer_worker_ensure_running(dt_iop_module_t *self, dt_drawlayer_worker_t *rt)
Ensure realtime/backend worker threads are started.
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.
void dt_drawlayer_worker_request_commit(dt_drawlayer_worker_t *worker)
Public commit request helper.
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.
@ DT_DRAWLAYER_WORKER_STATE_STOPPED
@ DT_DRAWLAYER_WORKER_STATE_BUSY
@ DT_DRAWLAYER_WORKER_STATE_PAUSED
@ DT_DRAWLAYER_WORKER_STATE_PAUSING