Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dev_pixelpipe.h
Go to the documentation of this file.
1/*
2 This file is part of the Ansel project.
3 Copyright (C) 2026 Aurélien PIERRE.
4
5 Ansel is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Ansel is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Ansel. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef DT_DEVELOP_DEV_PIXELPIPE_H
19#define DT_DEVELOP_DEV_PIXELPIPE_H
20
22#include <inttypes.h>
23#include <stdint.h>
24#include <glib.h>
25
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32
34// Force a full rebuild of the pipe, needed when module order is changed.
35// Resync the full history, which may be expensive.
36// Pixelpipe cache will need to be flushed too when this is called,
37// for raster masks to work properly.
38#define dt_dev_pixelpipe_rebuild_all(dev) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_pixelpipe_rebuild_all_real, (dev))
39
41// Invalidate the main image preview in darkroom, resync only the last history item(s)
42// with pipeline nodes.
43// This is the most common usecase when interacting with modules and masks.
44#define dt_dev_pixelpipe_update_history_main(dev) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_pixelpipe_update_history_main_real, (dev))
45
47// Invalidate the thumbnail preview in darkroom, resync only the last history item.
48#define dt_dev_pixelpipe_update_history_preview(dev) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_pixelpipe_update_history_preview_real, (dev))
49
51// Invalidate the main image and the thumbnail in darkroom, resync only the last history item.
52#define dt_dev_pixelpipe_update_history_all(dev) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_pixelpipe_update_history_all_real, (dev))
53
55// Invalidate the main image preview in darkroom.
56// This doesn't resync history at all, only update the coordinates of the region of interest (ROI).
57#define dt_dev_pixelpipe_update_zoom_main(dev) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_pixelpipe_update_zoom_main_real, (dev))
58
60// Invalidate the preview in darkroom.
61// This doesn't resync history at all, only update the coordinates of the region of interest (ROI).
62#define dt_dev_pixelpipe_update_zoom_preview(dev) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_pixelpipe_update_zoom_preview_real, (dev))
63
65// Invalidate the main image and the thumbnail in darkroom.
66// Resync the whole history with the pipeline nodes, which may be expensive.
67#define dt_dev_pixelpipe_resync_history_all(dev) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_pixelpipe_resync_history_all_real, (dev))
68
70// Invalidate the main image in darkroom.
71// Resync the whole history with the pipeline nodes, which may be expensive.
72#define dt_dev_pixelpipe_resync_history_main(dev) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_pixelpipe_resync_history_main_real, (dev))
73
75// Invalidate the thumbnail in darkroom.
76// Resync the whole history with the pipeline nodes, which may be expensive.
77#define dt_dev_pixelpipe_resync_history_preview(dev) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_DEV, dt_dev_pixelpipe_resync_history_preview_real, (dev))
78
79// Flush caches of dev pipes and force a full recompute
81
82// Queue a pipeline ROI change and reprocess the main image pipeline.
84
85// returns the dimensions of a virtual image of size (width_in, height_in) image after processing
86// all modules of the pipe. This chains calls to module's modify_roi_out() methods in pipeline order.
87// Doesn't actually compute pixels.
88// NOTE: pipe must have nodes; NULL pipes are not supported anymore.
89void dt_dev_pixelpipe_get_roi_out(struct dt_dev_pixelpipe_t *pipe, const int width_in,
90 const int height_in, int *width, int *height);
91
92// Compute and save into each piece->roi_out/in the proper module-wise ROI to achieve
93// the desired sizes from roi_out, from end to start. This chains calls to module's modify_roi_in() methods
94// in pipeline reverse order.
95// Doesn't actually compute pixels.
96// NOTE: pipe must have nodes; NULL pipes are not supported anymore.
98
99// Check if current_module is performing operations that dev->gui_module (active GUI module)
100// wants disabled. Use that to disable some features of current_module.
101// This is used mostly with distortion operations when the active GUI module
102// needs a full-ROI/undistorted input for its own editing mode,
103// like moving the framing on the full image.
104// WARNING: this doesn't check WHAT particular operations are performed and
105// and what operations should be cancelled (nor if they should all be cancelled).
106// So far, all the code uses that to prevent distortions on module output, masks and roi_out changes (cropping).
107// Meaning ANY of these operations will disable ALL of these operations.
109 struct dt_iop_module_t *current_module);
110
111// wrapper for cleanup_nodes, create_nodes, synch_all and synch_top, decides upon changed event which one to
112// take on. also locks dev->history_mutex.
114
115
116
117// Get the global hash of a pipe node (piece), or a fallback if none.
119 const struct dt_dev_pixelpipe_iop_t *piece,
120 const struct dt_iop_roi_t, const int pos);
121
137 const struct dt_iop_module_t *module);
138
153 const struct dt_dev_pixelpipe_iop_t *piece);
154
155/* The wait queue itself is cache state and lives in caches/pixelpipe_cache_wait.{h,c}. These
156 * two names stay because ~12 files across views/, libs/, iop/ and gui/ use them, and renaming
157 * them would be churn with no reader benefit: what matters is that the queue moved, not what
158 * its record is spelled. */
161
175
187void dt_dev_pixelpipe_cache_wait_dump_pending(const char *reason);
188
208 const char *owner_tag,
209 gpointer owner_object);
210
239 const struct dt_dev_pixelpipe_iop_t *piece,
240 void **data,
244 gpointer restart_data);
245
267 const struct dt_dev_pixelpipe_iop_t *piece,
268 void **data,
272 gpointer restart_data);
273
274// Direction-independent forward pass that (re)establishes the per-node buffer-format contract
275// (dsc_in/dsc_out) for the whole chain from the input image descriptor, and is the single place
276// that disables a node whose input is incompatible with what the previous stage publishes.
277// MUST run after history/params have been committed (synch_all / synch_top / realtime) and
278// BEFORE dt_pixelpipe_get_global_hash(), because that hash is cumulative over enabled nodes.
279// dt_dev_pixelpipe_change() calls it automatically; callers that drive a pipe directly
280// (export, snapshots) must call it themselves after dt_dev_pixelpipe_synch_all().
282
283// Compute the sequential hash over the pipeline for each module.
284// Need to run after dt_dev_pixelpipe_get_roi_in() has updated processed ROI in/out
286
287// Return TRUE if the current backbuffer for the current pipe is in sync with current dev history stack.
289
290// Return TRUE if the current pipeline (topology and node parameters) is in sync with current dev history stack.
292
293
294#ifdef __cplusplus
295}
296#endif
297#endif // DT_DEVELOP_DEV_PIXELPIPE_H
void dt_dev_pixelpipe_reset_all(struct dt_develop_t *dev)
void dt_dev_pixelpipe_update_history_main_real(struct dt_develop_t *dev)
void dt_dev_pixelpipe_get_roi_out(struct dt_dev_pixelpipe_t *pipe, const int width_in, const int height_in, int *width, int *height)
uint64_t dt_dev_pixelpipe_node_hash(struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, const struct dt_iop_roi_t, const int pos)
void dt_dev_pixelpipe_update_zoom_main_real(struct dt_develop_t *dev)
void dt_dev_pixelpipe_cache_wait_cleanup(dt_dev_pixelpipe_cache_wait_t *wait, const char *reason)
Cancel one pending GUI cache wait request and clear its runtime state.
void dt_dev_pixelpipe_rebuild_all_real(struct dt_develop_t *dev)
void dt_pixelpipe_get_global_hash(struct dt_dev_pixelpipe_t *pipe)
gboolean dt_dev_pixelpipe_cache_peek_gui_retained(dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, void **data, struct dt_pixel_cache_entry_t **cache_entry, dt_dev_pixelpipe_cache_wait_t *wait, dt_dev_pixelpipe_cache_ready_callback_t restart, gpointer restart_data)
dt_dev_pixelpipe_cache_peek_gui(), but the cacheline comes back RETAINED.
void dt_dev_pixelpipe_update_history_preview_real(struct dt_develop_t *dev)
void dt_dev_pixelpipe_resync_history_main_real(struct dt_develop_t *dev)
gboolean dt_dev_pixelpipe_cache_peek_gui(dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, void **data, struct dt_pixel_cache_entry_t **cache_entry, dt_dev_pixelpipe_cache_wait_t *wait, dt_dev_pixelpipe_cache_ready_callback_t restart, gpointer restart_data)
Reopen one GUI-visible host cacheline, or queue the minimal pipe recompute needed to publish it.
dt_pixelpipe_cache_ready_callback_t dt_dev_pixelpipe_cache_ready_callback_t
void dt_dev_pixelpipe_resync_history_preview_real(struct dt_develop_t *dev)
gboolean dt_dev_pixelpipe_is_pipeline_valid(struct dt_dev_pixelpipe_t *pipe)
void dt_dev_pixelpipe_change_zoom_main(struct dt_develop_t *dev)
void dt_dev_pixelpipe_cache_wait_dump_pending(const char *reason)
Dump pending GUI cache wait requests for lifecycle debugging.
dt_pixelpipe_cache_wait_t dt_dev_pixelpipe_cache_wait_t
const struct dt_dev_pixelpipe_iop_t * dt_dev_pixelpipe_get_module_piece(const struct dt_dev_pixelpipe_t *pipe, const struct dt_iop_module_t *module)
Return the enabled piece owned by module in pipe.
void dt_dev_pixelpipe_update_zoom_preview_real(struct dt_develop_t *dev)
void dt_dev_pixelpipe_change(struct dt_dev_pixelpipe_t *pipe)
void dt_dev_pixelpipe_get_roi_in(struct dt_dev_pixelpipe_t *pipe, const struct dt_iop_roi_t roi_out)
void dt_dev_pixelpipe_propagate_formats(struct dt_dev_pixelpipe_t *pipe)
const struct dt_dev_pixelpipe_iop_t * dt_dev_pixelpipe_get_prev_enabled_piece(const struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece)
Return the closest enabled piece located immediately before piece in pipe.
void dt_dev_pixelpipe_cache_wait_set_owner(dt_dev_pixelpipe_cache_wait_t *wait, const char *owner_tag, gpointer owner_object)
Attach debug ownership metadata to one cache wait request.
gboolean dt_dev_pixelpipe_is_backbufer_valid(struct dt_dev_pixelpipe_t *pipe)
void dt_dev_pixelpipe_update_history_all_real(struct dt_develop_t *dev)
gboolean dt_dev_pixelpipe_activemodule_disables_currentmodule(struct dt_develop_t *dev, struct dt_iop_module_t *current_module)
void dt_dev_pixelpipe_resync_history_all_real(struct dt_develop_t *dev)
uint32_t width
Definition mipmap_cache.c:0
uint32_t height
Definition mipmap_cache.c:1
The queue of consumers waiting for a pixel cacheline that does not exist yet.
void(* dt_pixelpipe_cache_ready_callback_t)(gpointer user_data)
Called when the awaited cacheline finally exists. Runs on the caller's thread.
unsigned __int64 uint64_t
Definition strptime.c:75
dt_pixel_cache_entry_t cache_entry
struct dt_iop_module_t *void * data
Region of interest passed through the pixelpipe.
Definition format.h:49
One consumer's outstanding request, owned by that consumer, not by the queue.