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-2020 darktable developers.
4 Copyright (C) 2022-2025 Aurélien PIERRE.
5
6 darktable is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 darktable is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with darktable. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <inttypes.h>
23
26struct dt_iop_roi_t;
27
28
40{
41 GHashTable *entries;
44 size_t max_memory;
46 dt_pthread_mutex_t lock; // mutex to protect the cache entries
48
54
56
67 const uint64_t hash);
68
69
87 const char *name, const int id, void **data, struct dt_iop_buffer_dsc_t **dsc,
88 struct dt_pixel_cache_entry_t **entry);
89
105 struct dt_iop_buffer_dsc_t **dsc, struct dt_pixel_cache_entry_t **entry);
106
115
125int dt_dev_pixelpipe_cache_remove(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, const gboolean force,
126 struct dt_pixel_cache_entry_t *entry);
127
128
131
136
149 struct dt_pixel_cache_entry_t *entry);
150
161 struct dt_pixel_cache_entry_t **entry);
162
163
176
177
186 struct dt_pixel_cache_entry_t *entry);
187
188
197 struct dt_pixel_cache_entry_t *entry);
198
199
211 struct dt_pixel_cache_entry_t *entry);
212
224 struct dt_pixel_cache_entry_t *entry);
225
226// clang-format off
227// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
228// vim: shiftwidth=2 expandtab tabstop=2 cindent
229// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
230// clang-format on
char * name
Definition common/metadata.c:41
size_t size
Definition mipmap_cache.c:3
int dt_dev_pixelpipe_cache_get_existing(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, void **data, struct dt_iop_buffer_dsc_t **dsc, struct dt_pixel_cache_entry_t **entry)
Get an existing cache line from the cache. This is similar to dt_dev_pixelpipe_cache_get,...
Definition pixelpipe_cache.c:335
struct dt_pixel_cache_entry_t * dt_dev_pixelpipe_cache_get_entry(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash)
Get an internal reference to the cache entry matching hash. If you are going to access this entry mor...
Definition pixelpipe_cache.c:52
void dt_dev_pixelpipe_cache_cleanup(dt_dev_pixelpipe_cache_t *cache)
Definition pixelpipe_cache.c:286
void dt_dev_pixelpipe_cache_auto_destroy_apply(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, const int id, struct dt_pixel_cache_entry_t *entry)
Free the entry matching hash if it has the flag "auto_destroy" and its pipe id matches....
struct dt_pixel_cache_entry_t * dt_dev_pixelpipe_cache_get_entry_from_data(dt_dev_pixelpipe_cache_t *cache, void *data)
Return a reference to the cache entry holding the data buffer, or NULL if not found.
Definition pixelpipe_cache.c:423
dt_dev_pixelpipe_cache_t * dt_dev_pixelpipe_cache_init(size_t max_memory)
Definition pixelpipe_cache.c:274
void dt_dev_pixelpipe_cache_print(dt_dev_pixelpipe_cache_t *cache)
Definition pixelpipe_cache.c:547
void dt_dev_pixelpipe_cache_flush(dt_dev_pixelpipe_cache_t *cache, const int id)
Remove cache lines matching id. Entries locked in read/write or having reference count greater than 0...
Definition pixelpipe_cache.c:376
void dt_dev_pixelpipe_cache_wrlock_entry(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, gboolean lock, struct dt_pixel_cache_entry_t *entry)
Lock or release the write lock on the entry.
Definition pixelpipe_cache.c:471
int dt_dev_pixelpipe_cache_get(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, const size_t size, const char *name, const int id, void **data, struct dt_iop_buffer_dsc_t **dsc, struct dt_pixel_cache_entry_t **entry)
Get a cache line from the cache. This internally increases the reference count, so you have to manual...
Definition pixelpipe_cache.c:295
int dt_dev_pixel_pipe_cache_remove_lru(dt_dev_pixelpipe_cache_t *cache)
Definition pixelpipe_cache.c:186
void dt_dev_pixelpipe_cache_flag_auto_destroy(dt_dev_pixelpipe_cache_t *cache, uint64_t hash, struct dt_pixel_cache_entry_t *entry)
Flag the cache entry matching hash as "auto_destroy". This is useful for short-lived/disposable cache...
Definition pixelpipe_cache.c:519
void dt_dev_pixelpipe_cache_ref_count_entry(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, gboolean lock, struct dt_pixel_cache_entry_t *entry)
Increase/Decrease the reference count on the cache line as to prevent LRU item removal....
Definition pixelpipe_cache.c:462
int dt_dev_pixelpipe_cache_remove(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, const gboolean force, struct dt_pixel_cache_entry_t *entry)
Arbitrarily remove the cache entry matching hash. Entries having a reference count > 0 (inter-thread ...
Definition pixelpipe_cache.c:112
uint64_t dt_dev_pixelpipe_cache_get_hash_data(dt_dev_pixelpipe_cache_t *cache, void *data, struct dt_pixel_cache_entry_t **entry)
Find the hash of the cache entry holding the buffer data.
Definition pixelpipe_cache.c:414
void dt_dev_pixelpipe_cache_rdlock_entry(dt_dev_pixelpipe_cache_t *cache, const uint64_t hash, gboolean lock, struct dt_pixel_cache_entry_t *entry)
Lock or release the read lock on the entry.
Definition pixelpipe_cache.c:495
unsigned __int64 uint64_t
Definition strptime.c:71
Definition pixelpipe_cache.h:40
size_t current_memory
Definition pixelpipe_cache.h:45
GHashTable * entries
Definition pixelpipe_cache.h:41
dt_pthread_mutex_t lock
Definition pixelpipe_cache.h:46
size_t max_memory
Definition pixelpipe_cache.h:44
uint64_t queries
Definition pixelpipe_cache.h:42
uint64_t hits
Definition pixelpipe_cache.h:43
Definition pixelpipe_hb.h:127
Definition develop/format.h:36
Definition imageop.h:32
Definition pixelpipe_cache.c:29
uint64_t hash
Definition pixelpipe_cache.c:30
void * data
Definition pixelpipe_cache.c:31
dt_iop_buffer_dsc_t dsc
Definition pixelpipe_cache.c:33
dt_pthread_rwlock_t lock
Definition pixelpipe_cache.c:38