![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "views/dev_backbuf.h"#include "common/colorspaces_inline_conversions.h"#include "common/conf.h"#include "widgets/bauhaus.h"#include "colorprofiles/colorspaces.h"#include "system/macros.h"#include "system/simd.h"#include "gui/application.h"#include "control/redraw.h"#include "develop/develop.h"#include "caches/pixelpipe_cache.h"#include "develop/pixelpipe_hb.h"#include "develop/supervisor.h"#include <pango/pangocairo.h>
Include dependency graph for dev_backbuf.c:Go to the source code of this file.
|
static |
Shared pixelpipe-backbuffer-to-screen compositing for any view owning its own dt_develop_t (darkroom, Studio Capture...). Extracted from darkroom.c, which keeps its own multi-tier main/preview/fallback cascade on top of the primitives here; a caller wanting just the main pipe's live output (no separate preview-pipe substitution tier) uses dt_dev_paint_main_backbuf().
Definition at line 39 of file dev_backbuf.c.
References dt_colorprofiles_xyz_to_display(), dt_Lab_to_XYZ(), L, Lab, RGB, and XYZ.
Referenced by dt_dev_get_background_color().
|
static |
Definition at line 143 of file dev_backbuf.c.
References dt_control_queue_redraw_center(), dt_develop_t::gui_attached, and IS_NULL_PTR.
Referenced by dt_dev_lock_pipe_surface().
|
static |
Point this surface at a cacheline, holding the GUI's own claim on it.
A pixelpipe cache entry with refcount > 0 is never evicted, never has its vRAM flushed and never removed – that one predicate is what the LRU, ‘dt_dev_pixelpipe_cache_flush_clmem()’ and the removal path all share. A locked surface keeps a RAW POINTER into the entry's pixels for as long as it exists, which is exactly the thing that claim exists to protect, so the GUI takes it rather than borrowing the pipeline's.
That is the difference from how this used to work. The surface relied on the single keepalive ref ‘pixelpipe_hb.c’ swaps when it publishes a new backbuffer, so the cacheline under the displayed frame was protected only while the pipeline still called it the backbuffer – the moment it published the next one, what the screen was showing belonged to nobody. Holding the claim here means the frame on screen survives the pipeline moving on, which is what lets that pipeline stop allocating a fresh buffer for every frame just to keep out of the GUI's way.
Every bind goes through here, including the release (entry NULL), so the take and the drop cannot drift apart – the shape of bug this file would otherwise grow one assignment at a time.
Definition at line 118 of file dev_backbuf.c.
References dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_locked_surface_t::entry, FALSE, IS_NULL_PTR, and TRUE.
Referenced by dt_dev_lock_pipe_surface(), and dt_dev_release_locked_surface().
Draw the ISO 12646 white surround rectangle around a width x height image with border px margin.
Definition at line 56 of file dev_backbuf.c.
Referenced by _build_preview_fallback_surface(), dt_dev_render_locked_surface(), and expose().
| void dt_dev_draw_profile_mode_label | ( | cairo_t * | cri, |
| int | height | ||
| ) |
Draw the "soft proof" / "gamut check" text overlay in the bottom-left corner when the colour-profile mode is not DT_PROFILE_NORMAL; a no-op otherwise.
Definition at line 69 of file dev_backbuf.c.
References dt_bauhaus_get_global(), dt_colorprofiles_get_settings(), DT_PIXEL_APPLY_DPI, DT_PROFILE_GAMUTCHECK, DT_PROFILE_NORMAL, height, and dt_colorprofiles_settings_t::mode.
| void dt_dev_get_background_color | ( | const dt_develop_t * | dev, |
| dt_aligned_pixel_t | bg_color | ||
| ) |
Definition at line 47 of file dev_backbuf.c.
References _colormanage_ui_color(), dt_conf_get_int(), dt_develop_t::enabled, and dt_develop_t::iso_12646.
Referenced by dt_dev_snapshot_draw(), expose(), and expose().
| gboolean dt_dev_lock_pipe_surface | ( | struct dt_develop_t * | dev, |
| struct dt_dev_pixelpipe_t * | pipe, | ||
| dt_dev_locked_surface_t * | locked, | ||
| dt_dev_pixelpipe_cache_wait_t * | wait, | ||
| const char * | wait_owner_tag, | ||
| gboolean | keep_previous_on_fail | ||
| ) |
(Re)bind locked to pipe's currently published backbuffer if it is newer/still valid. wait and wait_owner_tag are the caller's own dt_dev_pixelpipe_cache_wait_t instance and a short static debug label (e.g. "darkroom-main", "studio-capture-main"). keep_previous_on_fail: on a miss, keep whatever locked already held instead of dropping it.
Definition at line 150 of file dev_backbuf.c.
References _dev_backbuf_restart_cache_wait(), _locked_bind_entry(), dt_pixel_cache_entry_t::age, dt_dev_pixelpipe_t::backbuf, dt_pixel_cache_entry_t::data, dt_dev_locked_surface_t::data, dt_dev_backbuf_snapshot(), dt_dev_pixelpipe_cache_peek_gui(), dt_dev_pixelpipe_cache_wait_set_owner(), dt_dev_release_locked_surface(), dt_pixel_cache_entry_get_data(), dt_pixel_cache_entry_get_size(), DT_PIXELPIPE_CACHE_HASH_INVALID, dt_supervisor_active(), dt_supervisor_widget(), DT_SV_READ, dt_dev_locked_surface_t::entry, FALSE, dt_backbuf_state_t::hash, hash, dt_dev_locked_surface_t::hash, height, dt_backbuf_state_t::height, dt_dev_locked_surface_t::height, dt_dev_pixelpipe_t::imgid, IS_NULL_PTR, pipe, dt_dev_locked_surface_t::surface, TRUE, dt_dev_pixelpipe_t::type, width, dt_backbuf_state_t::width, and dt_dev_locked_surface_t::width.
Referenced by _draw_preview_fallback(), dt_dev_paint_main_backbuf(), dt_dev_snapshot_draw(), expose(), and expose().
| gboolean dt_dev_paint_main_backbuf | ( | dt_dev_locked_surface_t * | locked, |
| dt_dev_pixelpipe_cache_wait_t * | wait, | ||
| const char * | wait_owner_tag, | ||
| cairo_t * | cr, | ||
| struct dt_develop_t * | dev, | ||
| int | width, | ||
| int | height, | ||
| int | border, | ||
| const dt_aligned_pixel_t | bg_color, | ||
| gboolean | keep_previous_on_fail | ||
| ) |
Convenience for a caller that only wants the main (FULL) pipe's tier, with no separate preview-pipe substitution: lock + render dev->pipe in one call. This is what Studio Capture uses; darkroom's own multi-tier fallback cascade calls dt_dev_lock_pipe_surface()/dt_dev_render_locked_surface() directly instead.
Definition at line 298 of file dev_backbuf.c.
References dt_pixel_cache_entry_t::age, dt_dev_lock_pipe_surface(), dt_dev_render_locked_surface(), FALSE, height, IS_NULL_PTR, dt_develop_t::pipe, dt_dev_locked_surface_t::surface, and width.
| void dt_dev_release_locked_surface | ( | dt_dev_locked_surface_t * | locked | ) |
Drop everything locked references. Does not touch the pipe cache entry itself (pixelpipe_hb.c owns it). Callers MUST call this, on every instance they own, before their dev's pipeline nodes/backbufs are torn down.
Definition at line 126 of file dev_backbuf.c.
References _locked_bind_entry(), dt_dev_locked_surface_t::data, DT_PIXELPIPE_CACHE_HASH_INVALID, dt_dev_locked_surface_t::hash, dt_dev_locked_surface_t::height, IS_NULL_PTR, dt_dev_locked_surface_t::surface, and dt_dev_locked_surface_t::width.
Referenced by _engine_free(), _release_expose_source_caches(), _studio_dev_teardown(), and dt_dev_lock_pipe_surface().
| gboolean dt_dev_render_locked_surface | ( | cairo_t * | cr, |
| const dt_develop_t * | dev, | ||
| dt_dev_locked_surface_t * | locked, | ||
| const int | width, | ||
| const int | height, | ||
| const int | border, | ||
| const dt_aligned_pixel_t | bg_color | ||
| ) |
Definition at line 252 of file dev_backbuf.c.
References dt_pixel_cache_entry_t::age, dt_dev_draw_iso12646_border(), dt_dev_pixelpipe_cache_rdlock_entry(), dt_gui_get_global(), DT_PIXELPIPE_CACHE_HASH_INVALID, dt_develop_t::enabled, dt_dev_locked_surface_t::entry, FALSE, dt_dev_locked_surface_t::hash, height, dt_dev_locked_surface_t::height, IS_NULL_PTR, dt_develop_t::iso_12646, dt_gui_gtk_t::ppd, dt_dev_locked_surface_t::surface, TRUE, width, and dt_dev_locked_surface_t::width.
Referenced by _darkroom_compose_locked(), dt_dev_paint_main_backbuf(), dt_dev_snapshot_draw(), and expose().