![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "develop/dev_roi_request.h"#include "develop/dev_geometry.h"#include "develop/dev_viewport.h"#include "develop/develop.h"#include "develop/pixelpipe_hb.h"#include <string.h>
Include dependency graph for dev_roi_request.c:Go to the source code of this file.
|
inlinestatic |
Do these two records carry the same numbers, ignoring the generation stamp?
Member by member, NOT memcmp: the record's uint64_t generation forces 8-byte alignment, so there are four bytes of tail padding after ‘valid’ whose contents C does not define across an assignment. A memcmp would occasionally report a change where none happened, and since the generation is meant to be a cache key, that is not a cosmetic difference – it is a spurious invalidation of the pipeline cache chain, of exactly the kind this gate exists to prevent.
The floats are compared with ==, deliberately: these are copied verbatim from the viewport and the geometry record, never recomputed here, so the question really is "are these the same bits I published last time", not "are these numerically close".
Definition at line 45 of file dev_roi_request.c.
References dt_dev_roi_request_t::box_height, dt_dev_roi_request_t::box_width, dt_dev_roi_request_t::center_x, dt_dev_roi_request_t::center_y, dt_dev_roi_request_t::natural_scale, dt_dev_roi_request_t::preview_height, dt_dev_roi_request_t::preview_width, dt_dev_roi_request_t::processed_height, dt_dev_roi_request_t::processed_width, dt_dev_roi_request_t::scaling, and dt_dev_roi_request_t::valid.
Referenced by dt_dev_roi_request_publish().
| dt_dev_roi_request_t dt_dev_roi_request_get | ( | const dt_develop_t * | dev | ) |
Definition at line 79 of file dev_roi_request.c.
References dt_atomic_get_uint64(), IS_NULL_PTR, L, dt_develop_t::roi_request, and store().
Referenced by _darkroom_zoom_hash(), dt_dev_darkroom_pipeline(), dt_dev_get_thumbnail_size(), dt_dev_roi_request_natural_scale(), dt_dev_roi_request_preview_height(), dt_dev_roi_request_preview_width(), and dt_dev_roi_request_valid().
| void dt_dev_roi_request_init | ( | struct dt_develop_t * | dev | ) |
Seed the store. Call once, from dt_dev_init().
Definition at line 71 of file dev_roi_request.c.
References dt_atomic_set_uint64(), dt_dev_roi_request_neutral(), dt_dev_roi_request_store_t::generation, IS_NULL_PTR, dt_develop_t::roi_request, and dt_dev_roi_request_store_t::value.
Referenced by dt_dev_init().
| void dt_dev_roi_request_latch | ( | struct dt_dev_pixelpipe_t * | pipe, |
| const dt_dev_roi_request_t * | request | ||
| ) |
Publish onto a pipe the request its next run is planned from. Darkroom worker only.
Same seqlock as the dev-level store, and for the same reason: the worker writes this once per loop iteration while the GUI thread can read it at any moment – dt_dev_pipelines_share_preview_output() does exactly that from the darkroom expose path, and every dt_dev_pixelpipe_has_preview_output() call from an IOP GUI callback does too. A plain struct assignment across those threads is a torn read of the same shape this record exists to prevent.
Definition at line 166 of file dev_roi_request.c.
References dt_atomic_get_uint64(), dt_atomic_set_uint64(), dt_dev_roi_request_store_t::generation, IS_NULL_PTR, L, dt_dev_pixelpipe_t::roi_request, and dt_dev_roi_request_store_t::value.
Referenced by dt_dev_darkroom_pipeline().
| float dt_dev_roi_request_natural_scale | ( | const dt_develop_t * | dev | ) |
Definition at line 205 of file dev_roi_request.c.
References dt_dev_roi_request_get(), and dt_dev_roi_request_t::natural_scale.
Referenced by _compute_main_roi(), _compute_preview_roi(), _lib_navigation_draw_callback(), _zoom_preset_change(), button_pressed(), dt_dev_check_zoom_scale_bounds(), dt_dev_get_widget_zoom_scale(), and dt_dev_get_zoom_level().
| dt_dev_roi_request_t dt_dev_roi_request_neutral | ( | void | ) |
The value a pipe carries before the worker has latched anything.
NOT a zeroed record. scaling = 1 and natural_scale = -1 are what dt_dev_reset_roi() left on every dev, headless ones included, before this record existed – and iop/finalscale.c multiplies exactly those two to decide whether it enables itself. Seeding zeros there would change piece->enabled on any pipe that never gets latched, which is every export, thumbnail and snapshot pipe.
Definition at line 60 of file dev_roi_request.c.
References dt_dev_roi_request_t::center_x, dt_dev_roi_request_t::center_y, L, dt_dev_roi_request_t::natural_scale, and dt_dev_roi_request_t::scaling.
Referenced by dt_dev_pixelpipe_init_cached(), dt_dev_roi_request_init(), and dt_dev_roi_request_of_pipe().
| dt_dev_roi_request_t dt_dev_roi_request_of_pipe | ( | const dt_dev_pixelpipe_t * | pipe | ) |
Definition at line 176 of file dev_roi_request.c.
References dt_atomic_get_uint64(), dt_dev_roi_request_neutral(), dt_dev_roi_request_store_t::generation, IS_NULL_PTR, dt_dev_pixelpipe_t::roi_request, and dt_dev_roi_request_store_t::value.
Referenced by _update_darkroom_roi(), commit_params(), and dt_dev_pixelpipe_has_preview_output().
| int32_t dt_dev_roi_request_preview_height | ( | const dt_develop_t * | dev | ) |
Definition at line 200 of file dev_roi_request.c.
References dt_dev_roi_request_get(), and dt_dev_roi_request_t::preview_height.
Referenced by _darkroom_pickers_draw(), _darkroom_pipeline_inputs_ready(), _lib_navigation_draw_callback(), button_pressed(), button_released(), checker_changed_callback(), checker_color_changed_callback(), commit_box(), dt_dev_clip_roi(), dt_dev_coordinates_image_norm_to_preview_abs(), dt_dev_coordinates_preview_abs_to_image_norm(), dt_dev_get_image_box_in_widget(), dt_drawlayer_compute_view_patch(), expose(), expose(), gui_post_expose(), mouse_moved(), scrolled(), and start_profiling_callback().
| int32_t dt_dev_roi_request_preview_width | ( | const dt_develop_t * | dev | ) |
Definition at line 195 of file dev_roi_request.c.
References dt_dev_roi_request_get(), and dt_dev_roi_request_t::preview_width.
Referenced by _darkroom_pickers_draw(), _darkroom_pipeline_inputs_ready(), _lib_navigation_draw_callback(), button_pressed(), button_released(), checker_changed_callback(), checker_color_changed_callback(), commit_box(), dt_dev_clip_roi(), dt_dev_coordinates_image_norm_to_preview_abs(), dt_dev_coordinates_preview_abs_to_image_norm(), dt_dev_get_image_box_in_widget(), dt_drawlayer_compute_view_patch(), expose(), expose(), gui_post_expose(), mouse_moved(), scrolled(), and start_profiling_callback().
| uint64_t dt_dev_roi_request_publish | ( | struct dt_develop_t * | dev | ) |
Recompute the derived members from the viewport and the geometry record, and publish if anything changed. Returns the current generation.
The ONE place the derived values are computed, and GUI-thread only: it reads the viewport, which only the GUI thread writes. The generation advances only on a real payload change, which is what lets a consumer treat it as a cache key.
Definition at line 101 of file dev_roi_request.c.
References _payload_equal(), dt_dev_roi_request_t::box_height, dt_dev_viewport_state_t::box_height, dt_dev_roi_request_t::box_width, dt_dev_viewport_state_t::box_width, dt_dev_roi_request_t::center_x, dt_dev_viewport_state_t::center_x, dt_dev_roi_request_t::center_y, dt_dev_viewport_state_t::center_y, dt_dev_viewport_state_t::configured, dt_atomic_get_uint64(), dt_atomic_set_uint64(), dt_dev_geometry_snapshot(), dt_dev_roi_natural_scale(), dt_dev_viewport_get(), dt_dev_roi_request_t::generation, dt_dev_roi_request_store_t::generation, IS_NULL_PTR, L, dt_dev_roi_request_t::natural_scale, dt_dev_roi_request_t::preview_height, dt_dev_roi_request_t::preview_width, dt_dev_image_geometry_t::processed_height, dt_dev_roi_request_t::processed_height, dt_dev_image_geometry_t::processed_inited, dt_dev_image_geometry_t::processed_width, dt_dev_roi_request_t::processed_width, dt_dev_image_geometry_t::raw_inited, dt_develop_t::roi_request, dt_dev_roi_request_t::scaling, dt_dev_viewport_state_t::scaling, dt_dev_roi_request_t::valid, and dt_dev_roi_request_store_t::value.
Referenced by dt_dev_get_thumbnail_size(), dt_dev_viewport_reset(), dt_dev_viewport_set_border(), dt_dev_viewport_set_box(), dt_dev_viewport_set_center(), dt_dev_viewport_set_scaling(), and dt_dev_viewport_set_widget_size().
| gboolean dt_dev_roi_request_valid | ( | const dt_develop_t * | dev | ) |
Definition at line 210 of file dev_roi_request.c.
References dt_dev_roi_request_get(), and dt_dev_roi_request_t::valid.
Referenced by _compute_main_roi(), _compute_preview_roi(), and dt_dev_pipelines_share_preview_output().