![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
What the pipeline last published: which cacheline, and what shape its pixels are in. More...
#include <pixelpipe_hb.h>
Collaboration diagram for dt_backbuf_t:Data Fields | |
| size_t | bpp |
| size_t | width |
| size_t | height |
| dt_atomic_uint64 | hash |
| dt_atomic_uint64 | history_hash |
| dt_atomic_uint64 | generation |
What the pipeline last published: which cacheline, and what shape its pixels are in.
this encapsulates the pixelpipe. a develop module will need several of these: for previews and full blits to cairo and for the export function.
These five fields are ONE fact and must be read as one. ‘hash’ names a cacheline and ‘width’/‘height’ say what shape the pixels in it are – a cacheline records how many BYTES it holds and nothing about their layout, so a consumer that pairs a hash from one publication with dimensions from the next has no way to notice. It computes a cairo stride from the wrong width and paints the diagonal striping of a stride error, or writes a mis-shaped thumbnail into the mipmap cache. The published entry is routinely LARGER than width x height x bpp (aligned allocation, pool reuse), so a size check does not catch it either.
That was reachable: ‘hash’ was atomic and the dimensions were plain fields, so a GUI thread could read the hash, resolve its entry, and then read dimensions the worker had republished in between. It needs a publication whose SHAPE changes to become visible, which is why entering a clipping module's edit mode – where the crop is neutralised and the frame jumps to the full transformed image – is where it was reported.
So the record carries a seqlock, exactly as dt_dev_geometry_store_t does (develop/dev_geometry.h), and dt_dev_backbuf_snapshot is how a consumer reads it. Do not read the fields directly to pair them with pixels; a bare read is fine only for something that pairs with nothing.
WRITERS ARE SERIALISED BY CONVENTION, not by a lock: each backbuffer belongs to one pipe and is published by the thread that runs it, with the view's leave() joining that thread before it touches anything. A second concurrent publisher needs a real lock, not a second odd counter.
Definition at line 218 of file pixelpipe_hb.h.
| size_t dt_backbuf_t::bpp |
Definition at line 220 of file pixelpipe_hb.h.
Referenced by dt_dev_backbuf_snapshot(), and dt_dev_set_backbuf().
| dt_atomic_uint64 dt_backbuf_t::generation |
Odd while a publication is in flight, even once it has settled. See dt_dev_backbuf_snapshot.
Definition at line 227 of file pixelpipe_hb.h.
Referenced by dt_dev_backbuf_publish_begin(), dt_dev_backbuf_publish_end(), and dt_dev_backbuf_snapshot().
| dt_atomic_uint64 dt_backbuf_t::hash |
Definition at line 223 of file pixelpipe_hb.h.
Referenced by dt_dev_backbuf_get_hash(), dt_dev_backbuf_set_hash(), dt_dev_backbuf_snapshot(), and dt_dev_set_backbuf().
| size_t dt_backbuf_t::height |
Definition at line 222 of file pixelpipe_hb.h.
Referenced by _orient_scope_buf(), _pixelpipe_pick_from_image(), _process_vectorscope(), dt_dev_backbuf_snapshot(), dt_dev_set_backbuf(), and dt_imageio_export_with_flags().
| dt_atomic_uint64 dt_backbuf_t::history_hash |
Definition at line 224 of file pixelpipe_hb.h.
Referenced by dt_dev_backbuf_get_history_hash(), dt_dev_backbuf_set_history_hash(), dt_dev_backbuf_snapshot(), and dt_dev_set_backbuf().
| size_t dt_backbuf_t::width |
Definition at line 221 of file pixelpipe_hb.h.
Referenced by _orient_scope_buf(), _pixelpipe_pick_from_image(), _process_vectorscope(), dt_dev_backbuf_snapshot(), dt_dev_set_backbuf(), and dt_imageio_export_with_flags().