Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
test_pipe_cleanup_nodes_masks.c File Reference
#include "caches/pixelpipe_cache.h"
#include "develop/imageop.h"
#include "develop/pixelpipe.h"
#include "develop/pixelpipe_hb.h"
#include "system/atomic.h"
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <stdint.h>
#include <string.h>
#include <cmocka.h>
#include <glib.h>
#include "win/main_wrapper.h"
+ Include dependency graph for test_pipe_cleanup_nodes_masks.c:

Go to the source code of this file.

Macros

#define LINE_BYTES   (256 * 1024)
 
#define HASH_RASTER   0x0B0B0B0B0B0B0B0BULL
 
#define HASH_DETAIL   0x0C0C0C0C0C0C0C0CULL
 
#define HASH_OUTPUT   0x0D0D0D0D0D0D0D0DULL
 

Functions

static int _setup (void **state __attribute__((unused)))
 
static int _teardown (void **state __attribute__((unused)))
 
static dt_pixel_cache_entry_t * _publish (const uint64_t hash)
 
static void _pipe_holding_masks (dt_dev_pixelpipe_t *pipe)
 
static void _cleanup_nodes_releases_the_masks (void **state __attribute__((unused)))
 
static void _released_masks_go_with_the_flush (void **state __attribute__((unused)))
 
static void _detailmask_output (dt_iop_module_t *module, dt_dev_pixelpipe_iop_t *piece, const char *op)
 
static void _detail_output_with_its_mask_stands (void **state __attribute__((unused)))
 
static void _detail_output_without_its_mask_goes (void **state __attribute__((unused)))
 
static void _other_output_stands (void **state __attribute__((unused)))
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ HASH_DETAIL

#define HASH_DETAIL   0x0C0C0C0C0C0C0C0CULL

Definition at line 58 of file test_pipe_cleanup_nodes_masks.c.

◆ HASH_OUTPUT

#define HASH_OUTPUT   0x0D0D0D0D0D0D0D0DULL

Definition at line 127 of file test_pipe_cleanup_nodes_masks.c.

◆ HASH_RASTER

#define HASH_RASTER   0x0B0B0B0B0B0B0B0BULL

Definition at line 57 of file test_pipe_cleanup_nodes_masks.c.

◆ LINE_BYTES

#define LINE_BYTES   (256 * 1024)

The side-band masks of a graph go with its nodes.

A pipe references the raster masks its graph published or reopened, and the detail mask, so that the LRU cannot evict them between two renders. The darkroom's pipes live for the whole session and leave() destroys their nodes only: the references used to be released by the next render or by dt_dev_pixelpipe_cleanup(), so back in the lighttable the masks of the last image stayed referenced, and no memory pressure could free them.

Released, a mask can be evicted while the output of its provider survives. For the detail mask, whose provider is the hidden detailmask stage, a cached output then stands for the stage only while its mask is there too: dt_dev_pixelpipe_rawdetail_mask_check_hit().

These tests drive a pipe with no node: the masks are lines the test publishes itself, held the way the pipe holds them.

Definition at line 56 of file test_pipe_cleanup_nodes_masks.c.

Function Documentation

◆ _cleanup_nodes_releases_the_masks()

static void _cleanup_nodes_releases_the_masks ( void **state   __attribute__(unused))
static

◆ _detail_output_with_its_mask_stands()

◆ _detail_output_without_its_mask_goes()

static void _detail_output_without_its_mask_goes ( void **state   __attribute__(unused))
static

Its mask evicted, the output goes, so that the stage runs and publishes the mask again.

Definition at line 166 of file test_pipe_cleanup_nodes_masks.c.

References _detailmask_output(), dt_dev_pixelpipe_cache_get_entry(), dt_dev_pixelpipe_rawdetail_mask_check_hit(), DT_PIXELPIPE_CACHE_HASH_INVALID, HASH_OUTPUT, piece, pipe, and dt_dev_pixelpipe_t::rawdetail_mask_hash.

Referenced by main().

◆ _detailmask_output()

◆ _other_output_stands()

static void _other_output_stands ( void **state   __attribute__(unused))
static

◆ _pipe_holding_masks()

◆ _publish()

◆ _released_masks_go_with_the_flush()

static void _released_masks_go_with_the_flush ( void **state   __attribute__(unused))
static

Released, the masks are lines like any other: the next flush frees them.

Definition at line 113 of file test_pipe_cleanup_nodes_masks.c.

References _pipe_holding_masks(), dt_dev_pixelpipe_cache_flush(), dt_dev_pixelpipe_cache_get_entry(), dt_dev_pixelpipe_cleanup_nodes(), HASH_DETAIL, HASH_RASTER, pipe, dt_dev_pixelpipe_t::raster_mask_hashes, and TRUE.

Referenced by main().

◆ _setup()

static int _setup ( void **state   __attribute__(unused))
static

Definition at line 60 of file test_pipe_cleanup_nodes_masks.c.

References dt_dev_pixelpipe_cache_init(), and FALSE.

Referenced by main().

◆ _teardown()

static int _teardown ( void **state   __attribute__(unused))
static

Definition at line 65 of file test_pipe_cleanup_nodes_masks.c.

References dt_dev_pixelpipe_cache_cleanup().

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)
Todo:
: test if file with replaced ext exists
Todo:
: add a callback to set the bpp without going through the config
Todo:
: have a parameter in command line to get the export presets

Definition at line 194 of file test_pipe_cleanup_nodes_masks.c.

References _cleanup_nodes_releases_the_masks(), _detail_output_with_its_mask_stands(), _detail_output_without_its_mask_goes(), _other_output_stands(), _released_masks_go_with_the_flush(), _setup(), and _teardown().