Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
imageop.c File Reference
#include "develop/imageop_gui.h"
#include "darktable.h"
#include "widgets/widget_settings.h"
#include "common/conf.h"
#include "common/sentry.h"
#include "common/telemetry.h"
#include "develop/imageop.h"
#include "widgets/bauhaus.h"
#include "common/collection.h"
#include "database/collection_query.h"
#include "database/database.h"
#include "database/history_repository.h"
#include "database/preset_repository.h"
#include "metadata/exif.h"
#include "history/history.h"
#include "common/imagebuf.h"
#include "imageio/imageio_rawspeed.h"
#include "pixel/interpolation.h"
#include "common/module.h"
#include "common/opencl.h"
#include "common/usermanual_url.h"
#include "control/control.h"
#include "control/signal.h"
#include "develop/blend.h"
#include "develop/blend_gui.h"
#include "develop/develop.h"
#include "develop/dev_history.h"
#include "pixel/format.h"
#include "develop/masks.h"
#include "develop/tiling.h"
#include "widgets/gdkkeys.h"
#include "gui/presets.h"
#include "widgets/button.h"
#include "widgets/expander.h"
#include "gui/color_picker_proxy.h"
#include "gui/application.h"
#include "develop/gui_throttle.h"
#include "common/hash.h"
#include "common/module_versioning.h"
#include <assert.h>
#include <gmodule.h>
#include <math.h>
#include <complex.h>
#include <stdlib.h>
#include "widgets/container.h"
#include "widgets/label.h"
#include "widgets/popup.h"
#include "widgets/widget_style.h"
#include <string.h>
#include <strings.h>
#include <time.h>
#include "widgets/togglebutton.h"
#include "iop/iop_api.h"
+ Include dependency graph for imageop.c:

Go to the source code of this file.

Data Structures

struct  dt_iop_gui_simple_callback_t
 

Macros

#define INCLUDE_API_FROM_MODULE_STATIC_DEFAULTS
 
#define INCLUDE_API_FROM_MODULE_LOAD_BY_SO
 

Typedefs

typedef struct dt_iop_gui_simple_callback_t dt_iop_gui_simple_callback_t
 

Functions

float dt_dev_get_module_scale (const dt_dev_pixelpipe_t *const pipe, const dt_iop_roi_t *const roi_in)
 
uint32_t dt_dev_get_roi_filters (const dt_dev_pixelpipe_iop_t *const piece, const dt_iop_roi_t *const roi_in)
 
void dt_iop_load_default_params (dt_iop_module_t *module)
 
static void _iop_modify_roi_in (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *roi_out, dt_iop_roi_t *roi_in)
 
static void _iop_modify_roi_out (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece, dt_iop_roi_t *roi_out, const dt_iop_roi_t *roi_in)
 
static int default_default_group (void)
 
static int default_flags (void)
 
static int default_operation_tags (void)
 
static int default_operation_tags_filter (void)
 
static const char ** default_description (struct dt_iop_module_t *self)
 
static const char * default_aliases (void)
 
static const char * default_deprecated_msg (void)
 
static gboolean default_has_defaults (struct dt_iop_module_t *self)
 
static gboolean default_runtime_data_hash (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece)
 
static void default_commit_params (struct dt_iop_module_t *self, dt_iop_params_t *params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
static void default_init_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
static void default_cleanup_pipe (struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 
static void default_gui_cleanup (dt_iop_module_t *self)
 
static void default_cleanup (dt_iop_module_t *module)
 
static int default_distort_transform (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *points, size_t points_count)
 
static int default_distort_backtransform (dt_iop_module_t *self, const dt_dev_pixelpipe_t *pipe, const dt_dev_pixelpipe_iop_t *piece, float *points, size_t points_count)
 
static int default_process (struct dt_iop_module_t *self, const struct dt_dev_pixelpipe_t *pipe, const struct dt_dev_pixelpipe_iop_t *piece, const void *const i, void *const o)
 
static dt_introspection_field_tdefault_get_introspection_linear (void)
 
static dt_introspection_tdefault_get_introspection (void)
 
static voiddefault_get_p (const void *param, const char *name)
 
static dt_introspection_field_tdefault_get_f (const char *name)
 
void dt_iop_default_init (dt_iop_module_t *module)
 
static void _iop_ensure_visible (dt_gui_module_t *m)
 
int default_iop_focus (dt_gui_module_t *m, gboolean toggle)
 
static int _iop_load_module_static (dt_iop_module_so_t *module, const dt_iop_module_static_entry_t *const entry)
 Bind one statically-linked IOP module into its dt_iop_module_so_t.
 
int dt_iop_load_module_by_so (dt_iop_module_t *module, dt_iop_module_so_t *so, dt_develop_t *dev)
 
void dt_iop_init_pipe (struct dt_iop_module_t *module, struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece)
 Build one pixelpipe node's module-owned storage.
 
void dt_iop_cleanup_pipe (struct dt_iop_module_t *module, struct dt_dev_pixelpipe_t *pipe, struct dt_dev_pixelpipe_iop_t *piece)
 Release module-owned resources for one pixelpipe node.
 
gboolean dt_iop_gui_commit_iop_order_change (dt_develop_t *dev, dt_iop_module_t *module, gboolean enable, gboolean write_history, const char *reason)
 Commit the GUI-side consequences of an IOP-order change.
 
gboolean dt_iop_gui_move_module_before (dt_iop_module_t *module, dt_iop_module_t *module_next, const char *reason)
 Move a module before another one and commit the GUI-side effects.
 
gboolean dt_iop_gui_move_module_after (dt_iop_module_t *module, dt_iop_module_t *module_prev, const char *reason)
 Move a module after another one and commit the GUI-side effects.
 
gboolean dt_iop_so_is_hidden (dt_iop_module_so_t *module)
 
gboolean dt_iop_is_hidden (dt_iop_module_t *module)
 
gboolean dt_iop_module_instance_exists (dt_iop_module_t *iop)
 
static gboolean _module_carries_history (dt_iop_module_t *module)
 
gboolean dt_iop_module_is_in_pipeline (dt_iop_module_t *iop)
 
gboolean dt_iop_module_supports_drawn_mask (dt_iop_module_t *iop)
 
void dt_iop_reload_defaults (dt_iop_module_t *module)
 
static void _resolve_presets_blend_colorspace (dt_iop_module_so_t *module_so)
 
static void _init_presets (dt_iop_module_so_t *module_so)
 
static void _init_module_so (void *m)
 
void dt_iop_load_modules_so (void)
 
int dt_iop_load_module (dt_iop_module_t *module, dt_iop_module_so_t *module_so, dt_develop_t *dev)
 
void dt_iop_cleanup_module (dt_iop_module_t *module)
 
void dt_iop_unload_modules_so ()
 
void dt_iop_set_mask_mode (dt_iop_module_t *module, int mask_mode)
 
gboolean dt_iop_module_has_raster_mask (const dt_iop_module_t *module)
 
gboolean dt_iop_module_needs_mask_history_ext (const dt_iop_module_t *module, gboolean *raster, gboolean *drawn, gboolean *parametric)
 
gboolean dt_iop_module_needs_mask_history (const dt_iop_module_t *module)
 
void dt_iop_commit_blend_params (dt_iop_module_t *module, const dt_develop_blend_params_t *blendop_params)
 
gboolean _iop_validate_params (dt_introspection_field_t *field, gpointer params, gboolean report)
 
gboolean dt_iop_check_modules_equal (dt_iop_module_t *mod_1, dt_iop_module_t *mod_2)
 
void _hash_raster_masks (gpointer key, gpointer value, uint64_t *hash)
 
void dt_iop_compute_blendop_hash (dt_iop_module_t *module, uint64_t hash, GList *masks)
 
void dt_iop_compute_module_hash (dt_iop_module_t *module, GList *masks)
 
static gboolean _iop_piece_is_committable (dt_iop_module_t *module, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 Is this pipeline node safe to dispatch module code on?
 
void dt_iop_commit_params (dt_iop_module_t *module, dt_iop_params_t *params, dt_develop_blend_params_t *blendop_params, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
 Copy params into the pipeline piece, so the next render uses them.
 
void dt_iop_gui_reset (dt_iop_module_t *module)
 
void dt_iop_nap (int32_t usec)
 
gboolean dt_iop_get_cache_bypass (dt_iop_module_t *module)
 
void dt_iop_set_cache_bypass (dt_iop_module_t *module, gboolean state)
 
void dt_iop_set_cache_bypass_variant (dt_iop_module_t *module, int variant)
 
dt_iop_module_tdt_iop_get_colorout_module (void)
 
dt_iop_module_tdt_iop_get_module_from_list (GList *iop_list, const char *op)
 
dt_iop_module_tdt_iop_get_module (const char *op)
 
int dt_iop_get_module_flags (const char *op)
 
void dt_iop_set_darktable_iop_table ()
 
const gchar * dt_iop_get_localized_name (const gchar *op)
 
const gchar * dt_iop_get_localized_aliases (const gchar *op)
 
void dt_iop_update_multi_priority (dt_iop_module_t *module, int new_priority)
 
gboolean dt_iop_is_raster_mask_used (dt_iop_module_t *module, int id)
 
dt_iop_module_tdt_iop_get_module_by_op_priority (GList *modules, const char *operation, const int multi_priority)
 
dt_iop_module_tdt_iop_get_module_by_instance_name (GList *modules, const char *operation, const char *multi_name)
 
gboolean dt_iop_is_first_instance (GList *modules, dt_iop_module_t *module)
 
const char ** dt_iop_set_description (dt_iop_module_t *module, const char *main_text, const char *purpose, const char *input, const char *process, const char *output)
 

Macro Definition Documentation

◆ INCLUDE_API_FROM_MODULE_LOAD_BY_SO

#define INCLUDE_API_FROM_MODULE_LOAD_BY_SO

◆ INCLUDE_API_FROM_MODULE_STATIC_DEFAULTS

#define INCLUDE_API_FROM_MODULE_STATIC_DEFAULTS

Typedef Documentation

◆ dt_iop_gui_simple_callback_t

Function Documentation

◆ _hash_raster_masks()

void _hash_raster_masks ( gpointer  key,
gpointer  value,
uint64_t hash 
)

Definition at line 1392 of file imageop.c.

References dt_hash().

Referenced by dt_iop_compute_blendop_hash().

◆ _init_module_so()

◆ _init_presets()

◆ _iop_ensure_visible()

static void _iop_ensure_visible ( dt_gui_module_t m)
static

◆ _iop_load_module_static()

static int _iop_load_module_static ( dt_iop_module_so_t module,
const dt_iop_module_static_entry_t *const  entry 
)
static

Bind one statically-linked IOP module into its dt_iop_module_so_t.

IOP modules are compiled into lib_ansel, not dlopen'd: the set of them is fixed at build time, and both develop/iop_order.c's order tables and develop/geometry's roster are written against that same fixed set, so a module discovered on disk could never be anything but a disagreement with them – which is exactly what dt_ioppr_check_so_iop_order() used to abort startup over. See doc/static-iop.md.

This replaces the g_module_symbol() sweep. Two halves, and they cannot be merged: entry->fill_so() runs in the MODULE's translation unit, where the plain API names resolve to that module's own asm-labelled symbols, and stores NULL for every entry point it does not define; the DEFAULT fallbacks are applied here instead, because default_<fn> is static to this file.

Parameters
moduleZeroed module descriptor to fill.
entryRegistry entry naming the module and its generated binder.
Returns
0 on success, 1 if the module must not be used.

Definition at line 454 of file imageop.c.

References default_get_f(), default_get_introspection(), default_get_introspection_linear(), default_get_p(), DT_INTROSPECTION_VERSION, dt_opencl_is_inited(), dt_iop_module_static_entry_t::fill_so, IS_NULL_PTR, dt_iop_module_so_t::op, and dt_iop_module_static_entry_t::op.

Referenced by dt_iop_load_modules_so().

◆ _iop_modify_roi_in()

static void _iop_modify_roi_in ( struct dt_iop_module_t self,
const struct dt_dev_pixelpipe_t pipe,
struct dt_dev_pixelpipe_iop_t piece,
const dt_iop_roi_t roi_out,
dt_iop_roi_t roi_in 
)
static

Definition at line 155 of file imageop.c.

◆ _iop_modify_roi_out()

static void _iop_modify_roi_out ( struct dt_iop_module_t self,
const struct dt_dev_pixelpipe_t pipe,
struct dt_dev_pixelpipe_iop_t piece,
dt_iop_roi_t roi_out,
const dt_iop_roi_t roi_in 
)
static

Definition at line 162 of file imageop.c.

◆ _iop_piece_is_committable()

static gboolean _iop_piece_is_committable ( dt_iop_module_t module,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)
static

Is this pipeline node safe to dispatch module code on?

The mirror of the validation dt_iop_cleanup_pipe() already performs, and for the same reason it gives: a pipe can be walked while holding a node whose backing storage is no longer trustworthy, and "calling the descriptor callback with that same instance would only move the use-after-free into the module cleanup code". Commit is the other door into module code, and it was unguarded – it memcpy'd into piece->blendop_data before reading anything, so a stale node corrupted memory before any callback could object.

Every check here is an invariant the pipeline establishes itself, never a guess:

  • dt_dev_pixelpipe_create_nodes() calloc's the node, sets piece->module, and calls dt_iop_init_pipe(), which allocates piece->blendop_data. A node reaching commit without those did not come from there.
  • piece->module is the module the node was built for. Committing module A's params through node B reinterprets B's private data_size bytes as A's parameter struct.
  • All 89 modules that define init_pipe() set piece->data_size when they allocate piece->data, so ‘data_size > 0 && data == NULL’ is never a legitimate state – it is either a failed allocation or storage that has already been torn down. 61 modules dereference piece->data in commit_params() without checking it, which is fine as long as this holds, and a guaranteed SIGSEGV the moment it does not.
Returns
TRUE when the node may be dispatched on. Reports and refuses otherwise.

Definition at line 1514 of file imageop.c.

References dt_dev_pixelpipe_iop_t::blendop_data, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_iop_t::data_size, DT_DEBUG_ALWAYS, dt_print(), FALSE, IS_NULL_PTR, dt_iop_module_t::op, and TRUE.

Referenced by dt_iop_commit_params().

◆ _iop_validate_params()

gboolean _iop_validate_params ( dt_introspection_field_t field,
gpointer  params,
gboolean  report 
)
Todo:
: special case float2

Definition at line 1271 of file imageop.c.

References _iop_validate_params(), dt_introspection_field_t::Array, dt_introspection_field_t::Char, dt_introspection_type_array_t::count, DT_INTROSPECTION_TYPE_ARRAY, DT_INTROSPECTION_TYPE_BOOL, DT_INTROSPECTION_TYPE_CHAR, DT_INTROSPECTION_TYPE_ENUM, DT_INTROSPECTION_TYPE_FLOAT, DT_INTROSPECTION_TYPE_FLOATCOMPLEX, DT_INTROSPECTION_TYPE_INT, DT_INTROSPECTION_TYPE_INT8, DT_INTROSPECTION_TYPE_OPAQUE, DT_INTROSPECTION_TYPE_STRUCT, DT_INTROSPECTION_TYPE_UINT, DT_INTROSPECTION_TYPE_UNION, DT_INTROSPECTION_TYPE_USHORT, dt_introspection_type_struct_t::entries, dt_introspection_type_union_t::entries, dt_introspection_field_t::Enum, FALSE, dt_introspection_type_array_t::field, dt_introspection_type_struct_t::fields, dt_introspection_type_union_t::fields, dt_introspection_field_t::Float, dt_introspection_field_t::FloatComplex, dt_introspection_field_t::header, i, dt_introspection_field_t::Int, dt_introspection_field_t::Int8, dt_introspection_type_float_t::Max, dt_introspection_type_float_complex_t::Max, dt_introspection_type_char_t::Max, dt_introspection_type_int8_t::Max, dt_introspection_type_ushort_t::Max, dt_introspection_type_int_t::Max, dt_introspection_type_uint_t::Max, dt_introspection_type_float_t::Min, dt_introspection_type_float_complex_t::Min, dt_introspection_type_char_t::Min, dt_introspection_type_int8_t::Min, dt_introspection_type_ushort_t::Min, dt_introspection_type_int_t::Min, dt_introspection_type_uint_t::Min, dt_introspection_type_header_t::name, dt_introspection_type_header_t::offset, p, dt_introspection_type_header_t::size, dt_introspection_field_t::Struct, TRUE, dt_introspection_type_header_t::type, dt_introspection_type_array_t::type, dt_introspection_type_header_t::type_name, dt_introspection_field_t::UInt, dt_introspection_field_t::Union, dt_introspection_field_t::UShort, and dt_introspection_type_enum_t::values.

Referenced by _iop_validate_params(), and dt_iop_commit_params().

◆ _module_carries_history()

static gboolean _module_carries_history ( dt_iop_module_t module)
static

◆ _resolve_presets_blend_colorspace()

◆ default_aliases()

static const char * default_aliases ( void  )
static

Definition at line 198 of file imageop.c.

◆ default_cleanup()

static void default_cleanup ( dt_iop_module_t module)
static

Definition at line 251 of file imageop.c.

References dt_iop_module_t::default_params, dt_free, and dt_iop_module_t::params.

◆ default_cleanup_pipe()

static void default_cleanup_pipe ( struct dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)
static

Definition at line 239 of file imageop.c.

References dt_dev_pixelpipe_iop_t::data, and dt_free_align.

◆ default_commit_params()

static void default_commit_params ( struct dt_iop_module_t self,
dt_iop_params_t params,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)
static

Definition at line 222 of file imageop.c.

References dt_dev_pixelpipe_iop_t::data, and dt_iop_module_t::params_size.

◆ default_default_group()

static int default_default_group ( void  )
static

Definition at line 170 of file imageop.c.

References IOP_GROUP_TECHNICAL.

◆ default_deprecated_msg()

static const char * default_deprecated_msg ( void  )
static

Definition at line 203 of file imageop.c.

◆ default_description()

static const char ** default_description ( struct dt_iop_module_t self)
static

Definition at line 193 of file imageop.c.

◆ default_distort_backtransform()

static int default_distort_backtransform ( dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
float *  points,
size_t  points_count 
)
static

Definition at line 269 of file imageop.c.

References void().

◆ default_distort_transform()

static int default_distort_transform ( dt_iop_module_t self,
const dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece,
float *  points,
size_t  points_count 
)
static

Definition at line 258 of file imageop.c.

References void().

◆ default_flags()

static int default_flags ( void  )
static

Definition at line 176 of file imageop.c.

◆ default_get_f()

static dt_introspection_field_t * default_get_f ( const char *  name)
static

Definition at line 303 of file imageop.c.

Referenced by _iop_load_module_static().

◆ default_get_introspection()

static dt_introspection_t * default_get_introspection ( void  )
static

Definition at line 295 of file imageop.c.

Referenced by _iop_load_module_static().

◆ default_get_introspection_linear()

static dt_introspection_field_t * default_get_introspection_linear ( void  )
static

Definition at line 291 of file imageop.c.

Referenced by _iop_load_module_static().

◆ default_get_p()

static void * default_get_p ( const void param,
const char *  name 
)
static

Definition at line 299 of file imageop.c.

Referenced by _iop_load_module_static().

◆ default_gui_cleanup()

static void default_gui_cleanup ( dt_iop_module_t self)
static

Definition at line 246 of file imageop.c.

References IOP_GUI_FREE.

◆ default_has_defaults()

static gboolean default_has_defaults ( struct dt_iop_module_t self)
static

◆ default_init_pipe()

static void default_init_pipe ( struct dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
dt_dev_pixelpipe_iop_t piece 
)
static

◆ default_iop_focus()

int default_iop_focus ( dt_gui_module_t m,
gboolean  toggle 
)

◆ default_operation_tags()

static int default_operation_tags ( void  )
static

Definition at line 182 of file imageop.c.

◆ default_operation_tags_filter()

static int default_operation_tags_filter ( void  )
static

Definition at line 188 of file imageop.c.

◆ default_process()

static int default_process ( struct dt_iop_module_t self,
const struct dt_dev_pixelpipe_t pipe,
const struct dt_dev_pixelpipe_iop_t piece,
const void *const  i,
void *const  o 
)
static

◆ default_runtime_data_hash()

static gboolean default_runtime_data_hash ( struct dt_iop_module_t self,
dt_dev_pixelpipe_t pipe,
const dt_dev_pixelpipe_iop_t piece 
)
static

Definition at line 213 of file imageop.c.

References FALSE, and void().

◆ dt_dev_get_module_scale()

◆ dt_dev_get_roi_filters()

◆ dt_iop_check_modules_equal()

gboolean dt_iop_check_modules_equal ( dt_iop_module_t mod_1,
dt_iop_module_t mod_2 
)

◆ dt_iop_cleanup_module()

◆ dt_iop_cleanup_pipe()

void dt_iop_cleanup_pipe ( struct dt_iop_module_t module,
struct dt_dev_pixelpipe_t pipe,
struct dt_dev_pixelpipe_iop_t piece 
)

Release module-owned resources for one pixelpipe node.

The instance callback is an immutable copy of the callback stored in the loaded shared-object descriptor. Pixelpipes can retain removed module instances until their next topology rebuild, so validate both the descriptor lifetime and that callback identity before calling through the instance. A mismatch means the instance storage is no longer trustworthy; calling the descriptor callback with that same instance would only move the use-after-free into the module cleanup code.

Definition at line 641 of file imageop.c.

References dt_dev_pixelpipe_iop_t::blendop_data, darktable, DT_DEBUG_ALWAYS, dt_free_align, dt_print(), FALSE, darktable_t::iop, IS_NULL_PTR, dt_iop_module_so_t::op, dt_iop_module_t::op, and TRUE.

Referenced by dt_dev_pixelpipe_cleanup_nodes().

◆ dt_iop_commit_blend_params()

◆ dt_iop_commit_params()

void dt_iop_commit_params ( dt_iop_module_t module,
dt_iop_params_t params,
struct dt_develop_blend_params_t blendop_params,
struct dt_dev_pixelpipe_t pipe,
struct dt_dev_pixelpipe_iop_t piece 
)

Copy params into the pipeline piece, so the next render uses them.

commits params and updates piece hash.

Warning
Pass the HISTORY SNAPSHOT's params (hist->params), never module->params, from anything running on the pipeline thread. dt_iop_module_t::params is GUI-thread state and reading it from the pipeline is a data race – history is the only thread-safe interface between the two. This is the single most commonly broken rule in this header.
Parameters
modulethe module whose commit_params() callback is invoked.
paramsthe parameter block to commit; copied, not retained.
piecethe pipeline piece to configure. Must already be initialised for this pipe.

Definition at line 1565 of file imageop.c.

References _iop_piece_is_committable(), _iop_validate_params(), dt_dev_pixelpipe_iop_t::blendop_data, dt_dev_pixelpipe_iop_t::blendop_hash, dt_dev_pixelpipe_iop_t::cache_output_on_ram, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_iop_t::data_size, dt_iop_module_t::dev, dt_conf_get_bool(), dt_conf_key_exists(), dt_conf_key_not_empty(), dt_conf_set_bool(), DT_DEBUG_ALWAYS, DT_DEBUG_PARAMS, dt_free, dt_get_debug_flags(), dt_hash(), dt_iop_compute_module_hash(), dt_pixelpipe_get_pipe_name(), dt_print(), dt_dev_pixelpipe_iop_t::enabled, dt_develop_t::forms, dt_dev_pixelpipe_iop_t::global_hash, dt_dev_pixelpipe_iop_t::global_mask_hash, dt_dev_pixelpipe_iop_t::hash, IOP_FLAGS_ALLOW_TILING, IS_NULL_PTR, dt_iop_module_t::multi_name, dt_iop_module_t::op, dt_dev_pixelpipe_iop_t::process_cl_ready, dt_dev_pixelpipe_iop_t::process_tiling_ready, dt_iop_module_t::so, TRUE, and dt_dev_pixelpipe_t::type.

Referenced by _commit_piece_contract(), _sync_focused_in_place(), and dt_dev_pixelpipe_sync_no_history().

◆ dt_iop_compute_blendop_hash()

◆ dt_iop_compute_module_hash()

void dt_iop_compute_module_hash ( dt_iop_module_t module,
GList *  masks 
)

Uniform way of getting the full state hash of user-defined parameters, including masks and blending. Writes the value in module->hash, also writes the module->blendop_hash for masking and blending.

WARNING: doesn't take into account parameters dynamically set at runtime.

WARNING: if computing module hash in HISTORY order, there is no guaranty that previous modules in PIPELINE are also previous modules in HISTORY, so their blendops & masks may not be inited yet, meaning the blendop_hash we compute here will be garbage. In particular, (legacy) history compression algo can mess with history order, such that history entries of raster mask providers can end up after history entries of raster mask consumers. Our current history compression does a pipeline snapshot in pipeline order, for user-changed modules. (Raster masks providers and consumers will all be user-changed modules).

IF COMPUTING HASHES FOR PIPE CACHE INVALIDATION, that means we need to redo blendop/module hash recomputation at commit_params time, when pushing history to pipeline (but mandatorily in pipeline order).

IF COMPUTING HASHES FOR HISTORY CONSISTENCY (auto-saving when needed), since all we care is user params, it doesn't matter.

Definition at line 1461 of file imageop.c.

References dt_iop_module_t::blendop_hash, dt_hash(), dt_iop_compute_blendop_hash(), dt_iop_module_t::enabled, dt_iop_module_t::iop_order, dt_iop_module_t::multi_priority, dt_iop_module_t::op, dt_iop_module_t::params, and dt_iop_module_t::params_size.

Referenced by _dt_dev_modules_reload_defaults(), _history_to_module(), _process_history_db_entry(), commit_params(), dt_dev_history_item_update_from_params(), dt_iop_commit_params(), and dt_iop_load_default_params().

◆ dt_iop_default_init()

◆ dt_iop_get_cache_bypass()

gboolean dt_iop_get_cache_bypass ( dt_iop_module_t module)

Set bypass to TRUE if the pipeline cache should be bypassed temporarily for this module and the next, for example doing interactive GUI operations.

Pipeline cache consistency is ensured by hashing the internal module params and comparing that hash with the previously-known one from the cache line. If something outside the module is making the cache temporarily invalid, this is the way to go. The previous module's output may be fetched from cache if available, which is faster than simply disabling cache at all.

This is designed for mask previews, which have a special handling, in pipeline, where modules between the mask preview requesting module and the gamma.c module are bypassed, so the alpha channel is passed-through to be rendered by gamma.c without processing intermediate modules. This doesn't work if cache is enabled.

The pixelpipe code will propagate the bypass state to downstream pipe->pieces, so all modules coming later than this one in the pipeline will also have their cache disabled. That's how mask preview can work, because the pipeline is called in a recursive way, starting from the end.

Only one module from dev->iop list (modules tied to GUI) is allowed to bypass the cache at a time, other modules will lose their bypass flag if set.

Definition at line 1664 of file imageop.c.

Referenced by _suppressed_by_focus(), and dt_dev_pixelpipe_activemodule_disables_currentmodule().

◆ dt_iop_get_colorout_module()

dt_iop_module_t * dt_iop_get_colorout_module ( void  )

get module by name and colorout, works only with a dev mode

Definition at line 1692 of file imageop.c.

References dt_dev_get_global(), and dt_iop_get_module_from_list().

◆ dt_iop_get_localized_aliases()

const gchar * dt_iop_get_localized_aliases ( const gchar *  op)

Definition at line 1779 of file imageop.c.

References darktable, darktable_t::iop, and IS_NULL_PTR.

◆ dt_iop_get_localized_name()

const gchar * dt_iop_get_localized_name ( const gchar *  op)

returns the localized plugin name for a given op name. must not be freed.

Definition at line 1757 of file imageop.c.

References darktable, darktable_t::iop, and IS_NULL_PTR.

Referenced by _history_operation_name(), _prepend_item(), and dt_add_hist().

◆ dt_iop_get_module()

dt_iop_module_t * dt_iop_get_module ( const char *  op)

Definition at line 1714 of file imageop.c.

References dt_dev_get_global(), and dt_iop_get_module_from_list().

◆ dt_iop_get_module_by_instance_name()

dt_iop_module_t * dt_iop_get_module_by_instance_name ( GList *  modules,
const char *  operation,
const char *  multi_name 
)

returns module with op + multi_name or NULL if not found on the list, if IS_NULL_PTR(multi_name) do not check for it

Definition at line 1857 of file imageop.c.

References IS_NULL_PTR, m, dt_iop_module_t::multi_name, and dt_iop_module_t::op.

Referenced by _hm_dest_module_from_id(), _hm_module_from_id(), and dt_ioppr_update_for_entries().

◆ dt_iop_get_module_by_op_priority()

dt_iop_module_t * dt_iop_get_module_by_op_priority ( GList *  modules,
const char *  operation,
const int  multi_priority 
)

◆ dt_iop_get_module_flags()

int dt_iop_get_module_flags ( const char *  op)

get module flags, works in dev and lt mode

Definition at line 1719 of file imageop.c.

References darktable, and darktable_t::iop.

Referenced by dt_gui_hist_dialog_new().

◆ dt_iop_get_module_from_list()

dt_iop_module_t * dt_iop_get_module_from_list ( GList *  iop_list,
const char *  op 
)

◆ dt_iop_gui_commit_iop_order_change()

gboolean dt_iop_gui_commit_iop_order_change ( struct dt_develop_t dev,
dt_iop_module_t module,
gboolean  enable,
gboolean  write_history,
const char *  reason 
)

Commit the GUI-side consequences of an IOP-order change.

Order changes may come from drag-and-drop, context-menu move commands or preset application. The low-level order code only mutates dt_develop_t::iop and the serialized order list; this function updates module headers, rebuilds the pipes, stores the history item when requested and broadcasts the GUI change signal.

Parameters
devDevelop instance owning the reordered modules.
moduleModule to record in history, or NULL for whole-pipeline changes.
enableHistory enable state passed to dt_dev_add_history_item.
write_historyTRUE to record a history item, FALSE to skip it.
reasonDebug string used in IOP-order checks.
Returns
TRUE when the GUI refresh completed, FALSE if dev was NULL.

Definition at line 693 of file imageop.c.

References dt_dev_add_history_item, dt_dev_pixelpipe_rebuild_all, dt_dev_signal_modules_moved(), dt_ioppr_check_iop_order(), enable(), FALSE, IS_NULL_PTR, and TRUE.

Referenced by _ioporder_apply_preset(), dt_iop_gui_move_module_after(), dt_iop_gui_move_module_before(), gui_reset(), and set_params().

◆ dt_iop_gui_move_module_after()

gboolean dt_iop_gui_move_module_after ( dt_iop_module_t module,
dt_iop_module_t module_prev,
const char *  reason 
)

Move a module after another one and commit the GUI-side effects.

This is the GUI boundary for module reordering: dt_ioppr_move_iop_after only mutates the pipeline list and order list, while this function is responsible for updating visible headers, rebuilding the pipes, recording the history step and notifying GUI listeners.

Parameters
moduleModule being moved.
module_prevModule that should end up immediately before module.
reasonDebug string used in IOP-order checks.
Returns
TRUE if the move was applied, FALSE otherwise.

Definition at line 714 of file imageop.c.

References dt_iop_module_t::dev, dt_iop_gui_commit_iop_order_change(), dt_ioppr_move_iop_after(), FALSE, and TRUE.

Referenced by _ioporder_drag_data_received(), and _modulegroups_drag_data_received().

◆ dt_iop_gui_move_module_before()

gboolean dt_iop_gui_move_module_before ( dt_iop_module_t module,
dt_iop_module_t module_next,
const char *  reason 
)

Move a module before another one and commit the GUI-side effects.

This is the GUI boundary for module reordering: dt_ioppr_move_iop_before only mutates the pipeline list and order list, while this function is responsible for updating visible headers, rebuilding the pipes, recording the history step and notifying GUI listeners.

Parameters
moduleModule being moved.
module_nextModule that should end up immediately after module.
reasonDebug string used in IOP-order checks.
Returns
TRUE if the move was applied, FALSE otherwise.

Definition at line 707 of file imageop.c.

References dt_iop_module_t::dev, dt_iop_gui_commit_iop_order_change(), dt_ioppr_move_iop_before(), FALSE, and TRUE.

Referenced by _ioporder_drag_data_received(), and _modulegroups_drag_data_received().

◆ dt_iop_gui_reset()

void dt_iop_gui_reset ( dt_iop_module_t module)

reset the ui to its defaults

Definition at line 1646 of file imageop.c.

References dt_gui_freeze_begin, dt_gui_freeze_end, and dt_iop_is_hidden().

Referenced by _gui_reset_callback().

◆ dt_iop_init_pipe()

void dt_iop_init_pipe ( struct dt_iop_module_t module,
struct dt_dev_pixelpipe_t pipe,
struct dt_dev_pixelpipe_iop_t piece 
)

Build one pixelpipe node's module-owned storage.

Establishes what _iop_piece_is_committable() later relies on. init_pipe is OPTIONAL in the module API, so a module that allocates nothing is legitimate and leaves data NULL with data_size 0; what is never legitimate is claiming a size without the storage, which is how a failed allocation would otherwise reach 61 modules that dereference piece->data unchecked.

Definition at line 604 of file imageop.c.

References dt_dev_pixelpipe_iop_t::blendop_data, dt_dev_pixelpipe_iop_t::data, dt_dev_pixelpipe_iop_t::data_size, dt_calloc_align(), DT_DEBUG_ALWAYS, dt_print(), dt_dev_pixelpipe_iop_t::enabled, IS_NULL_PTR, and dt_iop_module_t::op.

Referenced by dt_dev_pixelpipe_create_nodes().

◆ dt_iop_is_first_instance()

gboolean dt_iop_is_first_instance ( GList *  modules,
dt_iop_module_t module 
)

returns true if module is the first instance of this operation in the pipe

Definition at line 1875 of file imageop.c.

References m, dt_iop_module_t::op, and TRUE.

Referenced by declare_cat_on_pipe().

◆ dt_iop_is_hidden()

◆ dt_iop_is_raster_mask_used()

gboolean dt_iop_is_raster_mask_used ( dt_iop_module_t module,
int  id 
)

iterates over the users hash table and checks if a specific mask is being used

Definition at line 1825 of file imageop.c.

References FALSE, key, dt_iop_module_t::raster_mask, dt_iop_module_t::source, TRUE, dt_iop_module_t::users, and value.

Referenced by dt_dev_pixelpipe_process(), dt_develop_blend_process(), dt_develop_blend_process_cl(), and process().

◆ dt_iop_load_default_params()

◆ dt_iop_load_module()

◆ dt_iop_load_module_by_so()

◆ dt_iop_load_modules_so()

void dt_iop_load_modules_so ( void  )

◆ dt_iop_module_has_raster_mask()

gboolean dt_iop_module_has_raster_mask ( const dt_iop_module_t module)

returns TRUE if module consumes a raster mask

Definition at line 1194 of file imageop.c.

References FALSE, IS_NULL_PTR, dt_iop_module_t::raster_mask, dt_iop_module_t::sink, and dt_iop_module_t::source.

◆ dt_iop_module_instance_exists()

gboolean dt_iop_module_instance_exists ( dt_iop_module_t iop)

Whether this instance conceptually exists yet.

An extra instance is created by a history item, so one whose item sits past the current history end is only a disabled pipeline node referenced by an entry the user has not reached: it exists in dev->iop but not, as far as anything the user can act on is concerned. A base instance (multi_priority 0) always exists.

Definition at line 741 of file imageop.c.

References dt_iop_module_t::dev, dt_dev_get_history_end_ext(), dt_dev_history_get_last_item_by_module(), dt_pthread_rwlock_rdlock(), dt_pthread_rwlock_unlock(), FALSE, dt_develop_t::history, dt_develop_t::history_mutex, IS_NULL_PTR, dt_iop_module_t::multi_priority, and TRUE.

Referenced by _update_iop_visibility(), and dt_iop_module_is_in_pipeline().

◆ dt_iop_module_is_in_pipeline()

gboolean dt_iop_module_is_in_pipeline ( dt_iop_module_t iop)

Whether the module is part of the pipeline the user sees – the rule the "Pipeline" tab of the module groups panel lists modules by, so that a list of pipeline modules built anywhere else agrees with what that tab shows. Includes disabled modules that carry history.

Definition at line 778 of file imageop.c.

References _module_carries_history(), dt_iop_is_hidden(), dt_iop_module_instance_exists(), dt_iop_module_t::enabled, FALSE, and IS_NULL_PTR.

Referenced by _is_module_in_tab(), and _modchooser_run().

◆ dt_iop_module_needs_mask_history()

gboolean dt_iop_module_needs_mask_history ( const dt_iop_module_t module)

◆ dt_iop_module_needs_mask_history_ext()

gboolean dt_iop_module_needs_mask_history_ext ( const dt_iop_module_t module,
gboolean *  raster,
gboolean *  drawn,
gboolean *  parametric 
)

returns TRUE if module needs masks committed to history plus each flag is set accordingly

Definition at line 1205 of file imageop.c.

References dt_iop_module_t::blend_params, dt_develop_blend_get_mask_usage(), FALSE, and IS_NULL_PTR.

Referenced by dt_dev_history_item_from_source_history_item(), and dt_iop_module_needs_mask_history().

◆ dt_iop_module_supports_drawn_mask()

gboolean dt_iop_module_supports_drawn_mask ( dt_iop_module_t iop)

Whether the module can carry a drawn mask, i.e. whether offering it one means anything. Supports blending, and is not one of the modules that opt out of masks specifically.

Definition at line 785 of file imageop.c.

References dt_iop_module_t::blend_params, FALSE, flags, IOP_FLAGS_NO_MASKS, IOP_FLAGS_SUPPORTS_BLENDING, and IS_NULL_PTR.

Referenced by _modchooser_run(), _modules_owning_group(), _show_masks_on_owning_module(), _tree_select_module_group(), _tree_store_add_forms(), and dt_iop_gui_blend_set_drawn_mask_group().

◆ dt_iop_nap()

void dt_iop_nap ( int32_t  usec)

allow plugins to relinquish CPU and go to sleep for some time

Definition at line 1653 of file imageop.c.

Referenced by dt_dev_darkroom_pipeline(), dt_opencl_reserve_device_for_pipe(), leave(), and nlmeans_denoise_cl().

◆ dt_iop_reload_defaults()

◆ dt_iop_set_cache_bypass()

◆ dt_iop_set_cache_bypass_variant()

void dt_iop_set_cache_bypass_variant ( dt_iop_module_t module,
int  variant 
)

Set the opaque per-module hash disambiguator described on dt_iop_module_t.bypass_cache_variant. Call alongside dt_iop_set_cache_bypass() whenever a module can be bypassing the cache for more than one mutually-independent GUI reason at once, so toggling one of them still changes the pipeline hash even while bypass_cache itself stays TRUE.

Definition at line 1686 of file imageop.c.

Referenced by rt_sync_bypass_cache().

◆ dt_iop_set_darktable_iop_table()

void dt_iop_set_darktable_iop_table ( )

◆ dt_iop_set_description()

const char ** dt_iop_set_description ( dt_iop_module_t module,
const char *  main_text,
const char *  purpose,
const char *  input,
const char *  process,
const char *  output 
)

Definition at line 1893 of file imageop.c.

References process().

Referenced by description().

◆ dt_iop_set_mask_mode()

◆ dt_iop_so_is_hidden()

gboolean dt_iop_so_is_hidden ( dt_iop_module_so_t module)

checks if iop do have an ui

Definition at line 721 of file imageop.c.

References FALSE, IOP_FLAGS_HIDDEN, IS_NULL_PTR, dt_iop_module_so_t::op, and TRUE.

Referenced by dt_iop_is_hidden().

◆ dt_iop_unload_modules_so()

void dt_iop_unload_modules_so ( void  )

tears down the module descriptors built by dt_iop_load_modules_so().

Definition at line 1163 of file imageop.c.

References darktable, dt_free, and darktable_t::iop.

Referenced by dt_cleanup().

◆ dt_iop_update_multi_priority()