Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dev_backbuf.c File Reference
#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.

Functions

static void _colormanage_ui_color (const float L, const float a, const float b, dt_aligned_pixel_t RGB)
 
void dt_dev_get_background_color (const dt_develop_t *dev, dt_aligned_pixel_t bg_color)
 
void dt_dev_draw_iso12646_border (cairo_t *cr, double width, double height, int border)
 
void dt_dev_draw_profile_mode_label (cairo_t *cri, int height)
 
static void _locked_bind_entry (dt_dev_locked_surface_t *locked, struct dt_pixel_cache_entry_t *entry)
 Point this surface at a cacheline, holding the GUI's own claim on it.
 
void dt_dev_release_locked_surface (dt_dev_locked_surface_t *locked)
 
static void _dev_backbuf_restart_cache_wait (gpointer user_data)
 
gboolean dt_dev_lock_pipe_surface (dt_develop_t *dev, 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)
 
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)
 
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, dt_develop_t *dev, int width, int height, int border, const dt_aligned_pixel_t bg_color, gboolean keep_previous_on_fail)
 

Function Documentation

◆ _colormanage_ui_color()

static void _colormanage_ui_color ( const float  L,
const float  a,
const float  b,
dt_aligned_pixel_t  RGB 
)
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().

◆ _dev_backbuf_restart_cache_wait()

static void _dev_backbuf_restart_cache_wait ( gpointer  user_data)
static

◆ _locked_bind_entry()

static void _locked_bind_entry ( dt_dev_locked_surface_t *  locked,
struct dt_pixel_cache_entry_t *  entry 
)
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().

◆ dt_dev_draw_iso12646_border()

void dt_dev_draw_iso12646_border ( cairo_t *  cr,
double  width,
double  height,
int  border 
)

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.

References height, and width.

Referenced by _build_preview_fallback_surface(), dt_dev_render_locked_surface(), and expose().

◆ dt_dev_draw_profile_mode_label()

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.

Referenced by expose(), and expose().

◆ dt_dev_get_background_color()

void dt_dev_get_background_color ( const dt_develop_t *  dev,
dt_aligned_pixel_t  bg_color 
)

◆ dt_dev_lock_pipe_surface()

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 
)

◆ dt_dev_paint_main_backbuf()

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.

◆ dt_dev_release_locked_surface()

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().

◆ dt_dev_render_locked_surface()