Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
pixelpipe_cache.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2009-2010 johannes hanika.
4 Copyright (C) 2010-2011 Henrik Andersson.
5 Copyright (C) 2012 Richard Wonka.
6 Copyright (C) 2012, 2014, 2016 Tobias Ellinghaus.
7 Copyright (C) 2014 Ulrich Pegelow.
8 Copyright (C) 2016 Roman Lebedev.
9 Copyright (C) 2020 Pascal Obry.
10 Copyright (C) 2020 Ralf Brown.
11 Copyright (C) 2022 Hanno Schwalm.
12 Copyright (C) 2022 Martin Bařinka.
13 Copyright (C) 2023, 2025-2026 Aurélien PIERRE.
14 Copyright (C) 2026 Guillaume Stutin.
15
16 darktable is free software: you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation, either version 3 of the License, or
19 (at your option) any later version.
20
21 darktable is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
25
26 You should have received a copy of the GNU General Public License
27 along with darktable. If not, see <http://www.gnu.org/licenses/>.
28*/
29
30#ifndef DT_CACHES_PIXELPIPE_CACHE_H
31#define DT_CACHES_PIXELPIPE_CACHE_H
32
33#include "system/memory_arena.h"
34#include "system/atomic.h"
35#include "pixel/format.h"
36#include <inttypes.h>
37#include <glib.h>
38#include <stddef.h>
39
40/* Consumed by C++ translation units (iop/lens.cc, iop/bilateral.cc, ...) through
41 * develop/pixelpipe_cache_alloc.h. Without this guard those TUs mangle the declarations
42 * as C++ and fail to link against the C definitions -- invisible on ELF, which permits
43 * undefined symbols in shared objects, but fatal on Mach-O. */
44#ifdef __cplusplus
45extern "C" {
46#endif
47
49struct dt_iop_module_t;
50struct dt_iop_roi_t;
51
52#define DT_PIXELPIPE_CACHE_HASH_INVALID ((uint64_t)-1)
53
54
65/* Opaque, and there is no accessor: no function below takes a cache handle. */
67
75
93gboolean dt_dev_pixelpipe_cache_init(size_t max_memory, const gboolean verbose,
94 const gboolean verbose_detail);
95
103
107
108// What one pipeline-cache entry holds on one OpenCL device, for the GUI memory view.
110{
111 int cl_count; // OpenCL buffers of the entry on the device
112 size_t cl_bytes; // their vRAM bytes
114
115// One pipeline-cache entry, for the GUI memory view.
117{
118 uint64_t hash; // an allocation's is its address: no event names it
119 size_t size; // bytes counted against the cache budget, whether a host buffer holds them or not
120 /* Not a line but a buffer of dt_pixelpipe_cache_alloc_align_*(): a module's working buffer for one
121 * run, or what something keeps there for longer (a lookup table, a state struct). */
122 gboolean allocation;
123 int64_t age_us; // since the cache last touched it: a line's last use, an allocation's allocation
124 size_t host_bytes; // bytes of the host (RAM) buffer: 0 for a line kept on the device only
125 int host_stale; // the host buffer still holds the pixels of a hash the line no longer answers to
127 int hits;
128 int cl_count; // number of OpenCL device buffers attached to this entry
129 size_t cl_bytes; // their total vRAM bytes (0 without OpenCL)
130 // The same, device by device: dt_opencl_get_num_devices() of them, or NULL without any.
132 char name[64];
134
135// Current/max bytes used by the pipeline cache (host RAM).
136void dt_dev_pixelpipe_cache_get_usage(size_t *current, size_t *max);
137
138// The budget the cache was created with. Kernel memory pressure lowers the budget allocations
139// evict down to, which dt_dev_pixelpipe_cache_get_usage() reports; this one never moves.
141
147
148/* Largest contiguous free run in the arena (bytes): the real upper bound on
149 * what an allocation — and, transitively, a tiled module's working set — can
150 * get, as opposed to the byte headroom max - current. */
152
153// Snapshot of all live entries, the lines then the allocations (newly-allocated GArray of
154// dt_pixel_cache_stats_entry_t; free with g_array_free(), which frees each entry's `devices` too).
156
157/* Public for by-value snapshots in pipeline pieces (for example realtime
158 * output cacheline reuse/rekey). Ownership still belongs to pixelpipe_cache.
159 * External code must treat this as metadata only and never free internals. */
160/* PUBLIC, and staying that way: develop/pixelpipe_hb.h embeds one BY VALUE in
161 * dt_dev_pixelpipe_iop_t, as a snapshot of the last reusable cacheline's metadata. That makes
162 * it a value type the pipeline carries, like dt_mipmap_buffer_t -- not the cache's internal
163 * bookkeeping, which is dt_cache_entry_t and is private to this module. */
165{
166 uint64_t hash; // unique identifier of the entry
167 uint64_t serial; // stable identity across rekeys, changes on fresh allocations
168 void *data; // buffer holding pixels... or anything else
169 size_t size; // size of the data buffer
170 /* MRU timestamp, in `g_get_monotonic_time()` microseconds. Set when the entry is created AND
171 * refreshed on every hit, so the eviction sweeps age an entry by its LAST USE rather than by
172 * its creation -- otherwise a cacheline consumed on every frame looks like the oldest thing in
173 * the cache and gets evicted first. Written from paths that hold no cache lock (finalize, the
174 * OpenCL payload reuse under `cl_mem_lock` only) and read by the sweeps under `cache->lock`,
175 * hence atomic. Touched exclusively through `_pixel_cache_touch()` in pixelpipe_cache.c. */
176 dt_atomic_uint64 age;
177 char *name; // name of the cache entry, for debugging
178 int id; // id of the pipeline owning this entry. Used when flushing, a pipe can only flush its own.
179 uint64_t producer_node_key; // stable identity of the pipeline node that produced this output
180 // (dt_supervisor_node_key(pipe_type, op, multi_priority)), or INVALID.
181 // Travels with DT_SIGNAL_CACHELINE_READY so GUI waiters can match by
182 // producer node even when the exact output hash drifted. See
183 // doc/pipeline-cache.md §8.
184 dt_atomic_int refcount; // reference count for the cache entry, to avoid freeing it while still in use
185 dt_pthread_rwlock_t lock; // read/write lock to avoid threads conflicts
186 gboolean auto_destroy; // disposable: the release of its last reference removes it. See dt_dev_pixelpipe_cache_flag_auto_destroy().
187 gboolean external_alloc; // TRUE for external buffers tracked in the cache
188 /* Number of ASYNCHRONOUS REUSES of this entry: how many times a lookup found content someone
189 * else had already published, in another run or another pipe. The intra-run producer->consumer
190 * handoff is NOT counted -- a module publishing its output with a reference reserved for the
191 * next module, which then reopens and releases it, is plain pipeline passthrough, not a reuse.
192 * Written only under `cache->lock`, alongside the cache-wide `hits`/`queries` rate. Distinct
193 * from `age`, which every use refreshes: see `_pixel_cache_touch()` in pixelpipe_cache.c. */
194 int hits;
195 dt_dev_pixelpipe_cache_t *cache; // reference to parent cache object
196 GList *cl_mem_list; // reusable OpenCL pinned buffers tied to this entry
197 dt_pthread_mutex_t cl_mem_lock;
198 /* TRUE while `data` holds the pixels of a hash this entry no longer answers to: set when a
199 * writable acquisition rekeys the entry in place, cleared once the host buffer is rewritten for
200 * the new hash (dt_dev_pixelpipe_cache_flag_host_written(), or a device->host copy). */
203
210const char *dt_pixelpipe_cache_set_current_module(const char *module);
211
223const char *dt_pixelpipe_cache_set_current_image(const char *image);
224
239
250
251/*
252 * @brief Find a cache entry that holds the exact data buffer pointer `data`.
253 *
254 * This searches both regular and external cache tables under the cache mutex.
255 * It does not change refcounts or locks on the returned entry; the caller must
256 * manage lifetime if needed.
257 */
259
260
284int dt_dev_pixelpipe_cache_get(const uint64_t hash, const size_t size,
285 const char *name, const int id, const gboolean alloc,
286 void **data,
287 struct dt_pixel_cache_entry_t **entry);
288
334 const size_t size, const char *name, const int id,
335 const gboolean alloc, const gboolean allow_rekey_reuse,
336 const struct dt_pixel_cache_entry_t *reuse_hint,
337 const struct dt_pixel_cache_entry_t *reuse_hint_prev,
338 void **data,
339 struct dt_pixel_cache_entry_t **entry);
340
359 int devid, int width, int height, int bpp);
360
368
378
401 int preferred_devid, void **data);
402
425void *dt_dev_pixelpipe_cache_get_pinned_image(void *host_ptr,
426 struct dt_pixel_cache_entry_t *entry_hint, int devid,
427 int width, int height, int bpp, int flags,
428 gboolean *out_reused);
429
444 struct dt_pixel_cache_entry_t *entry_hint, void **mem);
445
462 struct dt_pixel_cache_entry_t *entry_hint, int devid);
463
485void *dt_dev_pixelpipe_cache_get_cl_buffer(int devid, void *host_ptr, const struct dt_iop_roi_t *roi,
486 size_t bpp, struct dt_iop_module_t *module,
487 const char *message, struct dt_pixel_cache_entry_t *entry,
488 gboolean *out_reused, void *keep);
489
501void *dt_dev_pixelpipe_cache_alloc_cl_device_buffer(int devid, const struct dt_iop_roi_t *roi, size_t bpp,
502 const struct dt_iop_module_t *module,
503 const char *message, void *keep);
504
517void dt_dev_pixelpipe_cache_release_cl_buffer(void **cl_mem_buffer, struct dt_pixel_cache_entry_t *entry,
518 void *host_ptr, gboolean cache_device);
519
533int dt_dev_pixelpipe_cache_sync_cl_buffer(int devid, void *host_ptr, void *cl_mem_buffer,
534 const struct dt_iop_roi_t *roi, int cl_mode, size_t bpp,
535 struct dt_iop_module_t *module, const char *message);
536
551 void *cl_mem_input, const struct dt_iop_roi_t *roi_in,
552 struct dt_iop_module_t *module, size_t in_bpp,
553 struct dt_pixel_cache_entry_t *input_entry,
554 const char *message);
555
579 struct dt_iop_module_t *module,
580 float *input, void **cl_mem_input,
581 const struct dt_iop_roi_t *roi_in, size_t in_bpp,
582 struct dt_pixel_cache_entry_t *input_entry,
583 struct dt_pixel_cache_entry_t **locked_input_entry,
584 void *keep);
585
603
624 void **data,
625 struct dt_pixel_cache_entry_t **entry);
626
651 void **data,
652 struct dt_pixel_cache_entry_t **entry);
653
662
672
681
692
693
704
716 const char *name);
717
724void dt_pixelpipe_cache_free_align_cache(void **mem, const char *message);
725
726
727
742gboolean dt_dev_pixelpipe_cache_peek(const uint64_t hash, void **data,
743 struct dt_pixel_cache_entry_t **entry, const int preferred_devid,
744 void **cl_mem_output);
745
753void dt_dev_pixelpipe_cache_flush(const int id);
754
771 const size_t count);
772
788void dt_dev_pixelpipe_cache_flush_clmem(const int devid);
789
797
798
801
806
819 struct dt_pixel_cache_entry_t *entry);
820
828 struct dt_pixel_cache_entry_t *entry);
829
830
839 struct dt_pixel_cache_entry_t *entry);
840
841
853
861
877
898int dt_dev_pixelpipe_cache_rekey(const uint64_t old_hash,
899 const uint64_t new_hash, struct dt_pixel_cache_entry_t *entry);
900
901/* --- Telling the rest of the application things ---------------------------
902 *
903 * The cache has three reasons to speak upward: alert the user that an allocation could not be
904 * served (the cache is full, or the system itself runs out of memory), announce that a cacheline
905 * became ready so a waiter can stop waiting, and feed the supervisor its bookkeeping.
906 * Every one of those used to be a direct call -- dt_control_log(), a raised
907 * DT_SIGNAL_CACHELINE_READY, dt_supervisor_*() -- which put control/ and develop/ headers in a
908 * module that is otherwise pure storage, and made the cache depend on the application rather
909 * than the other way round.
910 *
911 * They are handlers now, installed once by the orchestrator. Unset handlers are simply not
912 * called, so the cache works in a build or a test that installs none. Same shape as
913 * dt_colorspaces_set_profile_changed_handler().
914 */
915
919typedef void (*dt_pixelpipe_cache_warn_handler_t)(const char *message);
920
925typedef void (*dt_pixelpipe_cache_alert_handler_t)(const char *message, const char *item);
926
932
936
940{
941 gboolean (*active)(void);
943 void (*cacheline_delete)(uint64_t hash, size_t size, int owner_pipe_id, const char *name);
944 void (*rekey)(uint64_t old_hash, uint64_t new_hash);
946
955 const dt_pixelpipe_cache_observer_t *observer);
956
957
958#ifdef __cplusplus
959}
960#endif
961
962#endif // DT_CACHES_PIXELPIPE_CACHE_H
963
964// clang-format off
965// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
966// vim: shiftwidth=2 expandtab tabstop=2 cindent
967// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
968// clang-format on
atomic_int dt_atomic_int
Definition atomic.h:68
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
const float max
int bpp
static const dt_dev_pixelpipe_t * pipe
Definition layers.h:49
hash
Definition layers.h:90
uint32_t width
Definition mipmap_cache.c:0
uint32_t height
Definition mipmap_cache.c:1
size_t size
Definition mipmap_cache.c:3
dt_mipmap_buffer_dsc_flags flags
Definition mipmap_cache.c:4
const char * name
Definition pdf.h:90
gboolean dt_dev_pixelpipe_cache_flush_host_pinned_image(void *host_ptr, struct dt_pixel_cache_entry_t *entry_hint, int devid)
Drop cached pinned OpenCL images associated with a given host buffer.
void * dt_pixel_cache_entry_get_buffer(struct dt_pixel_cache_entry_t *entry)
The host buffer of a cache entry, whatever hash its content describes.
void dt_dev_pixelpipe_cache_ref_count_entry(gboolean lock, struct dt_pixel_cache_entry_t *entry)
Take or release one reference on a cache line. A referenced line is never evicted,...
void * dt_dev_pixelpipe_cache_get_cl_buffer(int devid, void *host_ptr, const struct dt_iop_roi_t *roi, size_t bpp, struct dt_iop_module_t *module, const char *message, struct dt_pixel_cache_entry_t *entry, gboolean *out_reused, void *keep)
Allocate or reuse an OpenCL buffer for one cache entry payload.
GArray * dt_dev_pixelpipe_cache_get_entries_stats(void)
int dt_dev_pixelpipe_cache_sync_cl_buffer(int devid, void *host_ptr, void *cl_mem_buffer, const struct dt_iop_roi_t *roi, int cl_mode, size_t bpp, struct dt_iop_module_t *module, const char *message)
Synchronize between host memory and a pinned OpenCL image.
int dt_dev_pixelpipe_cache_invalidate_hashes(const uint64_t *hashes, const size_t count)
Invalidate cache lines matching an explicit list of hashes.
const char * dt_pixelpipe_cache_set_current_image(const char *image)
Set the image the current module runs on, for the message that reports a refused allocation (thread-l...
size_t dt_dev_pixelpipe_cache_get_available(void)
gboolean dt_dev_pixelpipe_cache_peek(const uint64_t hash, void **data, struct dt_pixel_cache_entry_t **entry, const int preferred_devid, void **cl_mem_output)
Non-owning lookup of an existing cache line.
void * dt_dev_pixelpipe_cache_borrow_cl_payload(struct dt_pixel_cache_entry_t *entry, int devid, int width, int height, int bpp)
Borrow a cached OpenCL payload attached to a cache entry.
void dt_dev_pixelpipe_cache_cleanup(void)
Release everything dt_dev_pixelpipe_cache_init() created, the instance included. Only after a success...
void dt_dev_pixelpipe_cache_set_alert_handler(dt_pixelpipe_cache_alert_handler_t alert)
Install the alert handler. The GUI installs it, once it exists, apart from the others: without a GUI ...
void * dt_pixelpipe_cache_alloc_align_cache_impl(size_t size, int id, const char *name)
Allocate aligned memory tracked by the pixelpipe cache. This allows LRU cache entries to be evicted i...
struct dt_pixel_cache_entry_t * dt_dev_pixelpipe_cache_get_entry_by_data(void *data)
void dt_dev_pixelpipe_cache_flush_clmem(const int devid)
Release cached OpenCL buffers for a single device.
size_t dt_pixel_cache_entry_get_size(const struct dt_pixel_cache_entry_t *entry)
Peek the size (in bytes) reserved for the host buffer of a cache entry.
int dt_dev_pixel_pipe_cache_remove_lru(void)
void(* dt_pixelpipe_cache_warn_handler_t)(const char *message)
Tell the user something that is fine to miss: the cache went over its budget, but the allocation went...
void dt_dev_pixelpipe_cache_wrlock_entry(gboolean lock, struct dt_pixel_cache_entry_t *entry)
Lock or release the write lock on the entry.
void dt_dev_pixelpipe_cache_put_pinned_image(void *host_ptr, struct dt_pixel_cache_entry_t *entry_hint, void **mem)
Release or cache a pinned OpenCL image acquired with dt_dev_pixelpipe_cache_get_pinned_image().
size_t dt_dev_pixelpipe_cache_get_max_memory(void)
void(* dt_pixelpipe_cache_alert_handler_t)(const char *message, const char *item)
Tell the user something that must not go unseen: what it says stays true after a toast would have gon...
int dt_dev_pixelpipe_cache_prepare_cl_input(struct dt_dev_pixelpipe_t *pipe, struct dt_iop_module_t *module, float *input, void **cl_mem_input, const struct dt_iop_roi_t *roi_in, size_t in_bpp, struct dt_pixel_cache_entry_t *input_entry, struct dt_pixel_cache_entry_t **locked_input_entry, void *keep)
Prepare the OpenCL input image corresponding to one cache-backed module input.
float * dt_dev_pixelpipe_cache_restore_cl_buffer(struct dt_dev_pixelpipe_t *pipe, float *input, void *cl_mem_input, const struct dt_iop_roi_t *roi_in, struct dt_iop_module_t *module, size_t in_bpp, struct dt_pixel_cache_entry_t *input_entry, const char *message)
Resynchronize one OpenCL input payload back into its cache-backed host buffer.
void dt_dev_pixelpipe_cache_flush_clmem_for_pipe(const int devid)
Like dt_dev_pixelpipe_cache_flush_clmem(), for callers that do not hold the device lock (dt_opencl_re...
void dt_dev_pixelpipe_cache_flush_entry_clmem(struct dt_pixel_cache_entry_t *entry)
Flush all reusable OpenCL payloads cached on one cache entry.
struct dt_pixel_cache_entry_t * dt_dev_pixelpipe_cache_ref_entry_for_host_ptr(void *host_ptr)
Resolve and retain the cache entry owning a host pointer.
void dt_dev_pixelpipe_cache_flush(const int id)
Remove cache lines matching id. Entries locked in read/write or having reference count greater than 0...
void dt_dev_pixelpipe_cache_print(void)
size_t dt_pixelpipe_cache_get_largest_free_run(void)
void dt_dev_pixelpipe_cache_unref_entry(struct dt_pixel_cache_entry_t *entry)
Release one reference held on entry, by POINTER.
void * dt_pixel_cache_entry_get_data(struct dt_pixel_cache_entry_t *entry)
Peek the host pixels a cache entry holds for its current hash, without allocating.
void * dt_dev_pixelpipe_cache_get_pinned_image(void *host_ptr, struct dt_pixel_cache_entry_t *entry_hint, int devid, int width, int height, int bpp, int flags, gboolean *out_reused)
Acquire a pinned OpenCL image for a host buffer tracked by the pixelpipe cache.
gboolean dt_dev_pixelpipe_cache_ref_host_entry_by_hash(const uint64_t hash, void **data, struct dt_pixel_cache_entry_t **entry)
Resolve and retain an existing cacheline that already holds HOST pixels.
gboolean dt_dev_pixelpipe_cache_ref_entry_by_hash(const uint64_t hash, void **data, struct dt_pixel_cache_entry_t **entry)
Resolve and retain an existing cache entry by hash.
void dt_dev_pixelpipe_cache_release_cl_buffer(void **cl_mem_buffer, struct dt_pixel_cache_entry_t *entry, void *host_ptr, gboolean cache_device)
Release or cache an OpenCL image associated with one cache entry.
void dt_dev_pixelpipe_cache_get_usage(size_t *current, size_t *max)
void(* dt_pixelpipe_cache_ready_handler_t)(uint64_t hash, uint64_t producer_node_key)
A cacheline finished and is readable.
void dt_dev_pixelpipe_cache_rdlock_entry(gboolean lock, struct dt_pixel_cache_entry_t *entry)
Lock or release the read lock on the entry.
void * dt_pixel_cache_alloc(struct dt_pixel_cache_entry_t *entry)
Actually allocate the memory buffer attached to the cache entry once you create it with dt_dev_pixelp...
void dt_dev_pixelpipe_cache_return_cl_payload(struct dt_pixel_cache_entry_t *entry, void *mem)
Return a borrowed cached OpenCL payload to its cache entry.
gboolean dt_dev_pixelpipe_cache_init(size_t max_memory, const gboolean verbose, const gboolean verbose_detail)
Reserve the cache's arena and start it.
struct dt_pixel_cache_entry_t * dt_dev_pixelpipe_cache_get_entry(const uint64_t hash)
Get an internal reference to the cache entry matching hash. If you are going to access this entry mor...
int dt_dev_pixelpipe_cache_rekey(const uint64_t old_hash, const uint64_t new_hash, struct dt_pixel_cache_entry_t *entry)
Change the hash/key of an existing cache line in place, without freeing, reallocating or invalidating...
void dt_dev_pixelpipe_cache_flag_host_written(struct dt_pixel_cache_entry_t *entry)
Record that the host buffer of entry now holds the pixels of its current hash.
void dt_dev_pixelpipe_cache_unref_hash(const uint64_t hash)
Find the entry matching hash, and decrease its ref_count if found.
void * dt_dev_pixelpipe_cache_alloc_cl_device_buffer(int devid, const struct dt_iop_roi_t *roi, size_t bpp, const struct dt_iop_module_t *module, const char *message, void *keep)
Allocate a temporary device-only OpenCL image, retrying once after cache flush.
void dt_pixelpipe_cache_free_align_cache(void **mem, const char *message)
Free aligned memory allocated with dt_pixelpipe_cache_alloc_align_cache.
gboolean dt_dev_pixelpipe_cache_restore_host_payload(struct dt_pixel_cache_entry_t *entry, int preferred_devid, void **data)
Materialize a host payload for a live cache entry from its cached device payload.
void dt_dev_pixelpipe_cache_set_handlers(dt_pixelpipe_cache_warn_handler_t warn, dt_pixelpipe_cache_ready_handler_t ready, const dt_pixelpipe_cache_observer_t *observer)
Install the handlers. Call once, from the orchestrator, before any pipe runs.
dt_dev_pixelpipe_cache_writable_status_t dt_dev_pixelpipe_cache_get_writable(const uint64_t hash, const size_t size, const char *name, const int id, const gboolean alloc, const gboolean allow_rekey_reuse, const struct dt_pixel_cache_entry_t *reuse_hint, const struct dt_pixel_cache_entry_t *reuse_hint_prev, void **data, struct dt_pixel_cache_entry_t **entry)
Acquire a writable cache line for module output.
void dt_dev_pixelpipe_cache_flag_auto_destroy(struct dt_pixel_cache_entry_t *entry)
Flag a cache line as disposable (auto_destroy), for short-lived lines nothing will need again: the re...
int dt_dev_pixelpipe_cache_get(const uint64_t hash, const size_t size, const char *name, const int id, const gboolean alloc, void **data, struct dt_pixel_cache_entry_t **entry)
Get a cache line from the cache.
dt_dev_pixelpipe_cache_writable_status_t
@ DT_DEV_PIXELPIPE_CACHE_WRITABLE_REKEYED
@ DT_DEV_PIXELPIPE_CACHE_WRITABLE_ERROR
@ DT_DEV_PIXELPIPE_CACHE_WRITABLE_CREATED
@ DT_DEV_PIXELPIPE_CACHE_WRITABLE_EXACT_HIT
const char * dt_pixelpipe_cache_set_current_module(const char *module)
Set the current module name for cache diagnostics (thread-local).
uint32_t dt_pixelpipe_cache_get_alloc_refusals(void)
Count the allocations the cache refused to the calling thread for lack of memory (thread-local).
gboolean dt_dev_pixelpipe_cache_is_ready(void)
Has the pixelpipe cache been initialised? Callers that run before dt_dev_pixelpipe_cache_init() succe...
unsigned __int64 uint64_t
Definition strptime.c:75
Region of interest passed through the pixelpipe.
Definition format.h:49
uint64_t hash
gboolean auto_destroy
dt_atomic_int refcount
gboolean external_alloc
void * data
dt_atomic_uint64 age
size_t size
dt_atomic_int host_stale
uint64_t serial
dt_dev_pixelpipe_cache_t * cache
dt_pthread_rwlock_t lock
dt_pthread_mutex_t cl_mem_lock
GList * cl_mem_list
char * name
int hits
int id
uint64_t producer_node_key
int refcount
char name[64]
int host_stale
int hits
gboolean allocation
dt_pixel_cache_stats_device_t * devices
size_t size
size_t cl_bytes
size_t host_bytes
uint64_t hash
int64_t age_us
int cl_count
The supervisor's view of the cache. All four may be NULL; active gates the other three so the cache p...
void(* cacheline_delete)(uint64_t hash, size_t size, int owner_pipe_id, const char *name)
void(* cacheline_read)(uint64_t hash, size_t size)
void(* rekey)(uint64_t old_hash, uint64_t new_hash)
dt_pthread_mutex_t lock
Definition supervisor.c:123