![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "caches/pixelpipe_cache.h"#include "system/atomic.h"#include "system/dtpthread.h"#include <stdarg.h>#include <stddef.h>#include <setjmp.h>#include <stdint.h>#include <string.h>#include <cmocka.h>#include "win/main_wrapper.h"Go to the source code of this file.
Macros | |
| #define | LINE_BYTES (256 * 1024) |
| #define | HASH_A 0x0A0A0A0A0A0A0A0Aull |
| #define | HASH_B 0x0B0B0B0B0B0B0B0Bull |
| #define | HASH_C 0x0C0C0C0C0C0C0C0Cull |
Functions | |
| static int | _setup (void **state __attribute__((unused))) |
| static int | _teardown (void **state __attribute__((unused))) |
| static dt_pixel_cache_entry_t | _produce (const uint64_t hash, const dt_pixel_cache_entry_t *hint, const gboolean allow_rekey, const gboolean write_host, const dt_dev_pixelpipe_cache_writable_status_t expected) |
| static void | _rekeyed_line_publishes_no_host_pixels (void **state __attribute__((unused))) |
| static void | _rewritten_line_publishes_its_host_pixels (void **state __attribute__((unused))) |
| static void | _without_rekey_the_previous_output_stays (void **state __attribute__((unused))) |
| int | main (int argc, char *argv[]) |
| #define HASH_A 0x0A0A0A0A0A0A0A0Aull |
Definition at line 47 of file test_pipe_cache_host_stale.c.
| #define HASH_B 0x0B0B0B0B0B0B0B0Bull |
Definition at line 48 of file test_pipe_cache_host_stale.c.
Referenced by _rekeyed_line_publishes_no_host_pixels(), and _without_rekey_the_previous_output_stays().
| #define HASH_C 0x0C0C0C0C0C0C0C0Cull |
Definition at line 49 of file test_pipe_cache_host_stale.c.
Referenced by _rewritten_line_publishes_its_host_pixels().
| #define LINE_BYTES (256 * 1024) |
A cacheline rekeyed in place publishes no host pixels until they are rewritten.
A module's output cacheline is reused for its next output by moving it to the new hash, host buffer included. When that next output stays on the GPU, the host buffer keeps the previous hash's pixels under the new key, where a CPU-only module downstream, the GUI or an exact hit in another pipe would read them as the new hash's.
These tests drive the cache alone, without a pipe or a device: the contract is the cache's.
Definition at line 46 of file test_pipe_cache_host_stale.c.
|
static |
Definition at line 65 of file test_pipe_cache_host_stale.c.
References data, dt_dev_pixelpipe_cache_flag_host_written(), dt_dev_pixelpipe_cache_get_writable(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_wrlock_entry(), dt_pixel_cache_alloc(), FALSE, hash, LINE_BYTES, and status.
Referenced by _rekeyed_line_publishes_no_host_pixels(), _rewritten_line_publishes_its_host_pixels(), and _without_rekey_the_previous_output_stays().
An output kept on the device after a rekey: the host bytes are the previous hash's.
Definition at line 92 of file test_pipe_cache_host_stale.c.
References _produce(), data, dt_pixel_cache_entry_t::data, dt_dev_pixelpipe_cache_get_entry(), dt_dev_pixelpipe_cache_peek(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_ref_entry_by_hash(), dt_dev_pixelpipe_cache_ref_host_entry_by_hash(), DT_DEV_PIXELPIPE_CACHE_WRITABLE_CREATED, DT_DEV_PIXELPIPE_CACHE_WRITABLE_REKEYED, dt_pixel_cache_entry_get_buffer(), dt_pixel_cache_entry_get_data(), FALSE, HASH_A, HASH_B, dt_pixel_cache_entry_t::serial, state, and TRUE.
Referenced by main().
A producer that rewrites the host buffer makes it the line's pixels again.
Definition at line 125 of file test_pipe_cache_host_stale.c.
References _produce(), data, dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_ref_host_entry_by_hash(), DT_DEV_PIXELPIPE_CACHE_WRITABLE_CREATED, DT_DEV_PIXELPIPE_CACHE_WRITABLE_REKEYED, FALSE, HASH_A, HASH_C, LINE_BYTES, dt_pixel_cache_entry_t::serial, state, and TRUE.
Referenced by main().
Definition at line 51 of file test_pipe_cache_host_stale.c.
References dt_dev_pixelpipe_cache_init(), FALSE, and state.
Definition at line 56 of file test_pipe_cache_host_stale.c.
References dt_dev_pixelpipe_cache_cleanup(), and state.
Without rekey reuse – the run after a module toggle – the previous output survives.
Definition at line 143 of file test_pipe_cache_host_stale.c.
References _produce(), data, dt_atomic_get_int(), dt_dev_pixelpipe_cache_get_writable(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_ref_host_entry_by_hash(), DT_DEV_PIXELPIPE_CACHE_WRITABLE_CREATED, DT_DEV_PIXELPIPE_CACHE_WRITABLE_EXACT_HIT, dt_pthread_rwlock_trywrlock(), dt_pthread_rwlock_unlock(), FALSE, HASH_A, HASH_B, LINE_BYTES, dt_pixel_cache_entry_t::lock, dt_pixel_cache_entry_t::refcount, dt_pixel_cache_entry_t::serial, state, and TRUE.
Referenced by main().
| int main | ( | int | argc, |
| char * | argv[] ) |
Definition at line 180 of file test_pipe_cache_host_stale.c.
References _rekeyed_line_publishes_no_host_pixels(), _rewritten_line_publishes_its_host_pixels(), _setup(), _teardown(), and _without_rekey_the_previous_output_stays().