![]() |
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 dependency graph for test_pipe_cache_host_stale.c: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 (void) |
| #define HASH_A 0x0A0A0A0A0A0A0A0Aull |
Definition at line 43 of file test_pipe_cache_host_stale.c.
| #define HASH_B 0x0B0B0B0B0B0B0B0Bull |
Definition at line 44 of file test_pipe_cache_host_stale.c.
| #define HASH_C 0x0C0C0C0C0C0C0C0Cull |
Definition at line 45 of file test_pipe_cache_host_stale.c.
| #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 42 of file test_pipe_cache_host_stale.c.
|
static |
Definition at line 61 of file test_pipe_cache_host_stale.c.
References 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, L, 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 88 of file test_pipe_cache_host_stale.c.
References _produce(), 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, L, dt_pixel_cache_entry_t::serial, and TRUE.
Referenced by main().
A producer that rewrites the host buffer makes it the line's pixels again.
Definition at line 121 of file test_pipe_cache_host_stale.c.
References _produce(), 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, L, LINE_BYTES, dt_pixel_cache_entry_t::serial, and TRUE.
Referenced by main().
Definition at line 47 of file test_pipe_cache_host_stale.c.
References dt_dev_pixelpipe_cache_init(), and FALSE.
Referenced by main().
Definition at line 52 of file test_pipe_cache_host_stale.c.
References dt_dev_pixelpipe_cache_cleanup().
Referenced by main().
Without rekey reuse – the run after a module toggle – the previous output survives.
Definition at line 139 of file test_pipe_cache_host_stale.c.
References _produce(), 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, L, LINE_BYTES, dt_pixel_cache_entry_t::lock, dt_pixel_cache_entry_t::refcount, dt_pixel_cache_entry_t::serial, and TRUE.
Referenced by main().
| int main | ( | void | ) |
Definition at line 176 of file test_pipe_cache_host_stale.c.
References _rekeyed_line_publishes_no_host_pixels(), _rewritten_line_publishes_its_host_pixels(), _setup(), _teardown(), _without_rekey_the_previous_output_stays(), and L.