Skip to content

Commit

Permalink
Pipeline: remove the cache_obsolete property
Browse files Browse the repository at this point in the history
Where you use to set that to true, simply call dt_dev_reprocess and cache will be flushed on the spot.
  • Loading branch information
aurelienpierre committed Dec 5, 2023
1 parent 0259ce4 commit 6a80633
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 39 deletions.
42 changes: 12 additions & 30 deletions src/develop/develop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1997,46 +1997,28 @@ void dt_dev_read_history(dt_develop_t *dev)
dt_dev_read_history_ext(dev, dev->image_storage.id, FALSE);
}

void dt_dev_reprocess_all(dt_develop_t *dev)
{
if(darktable.gui->reset) return;
if(dev && dev->gui_attached)
{
dt_pthread_mutex_lock(&dev->history_mutex);
dev->pipe->cache_obsolete = 1;
dev->preview_pipe->cache_obsolete = 1;
dt_pthread_mutex_unlock(&dev->history_mutex);

// invalidate buffers and force redraw of darkroom
dt_dev_invalidate_all(dev);
}
}

void dt_dev_reprocess_center(dt_develop_t *dev)
{
if(darktable.gui->reset) return;
if(dev && dev->gui_attached)
{
dt_pthread_mutex_lock(&dev->history_mutex);
dev->pipe->cache_obsolete = 1;
dt_pthread_mutex_unlock(&dev->history_mutex);

// invalidate buffers and force redraw of darkroom
dt_dev_invalidate(dev);
}
// Flush the caches and recompute from scratch
if(darktable.gui->reset || !dev || !dev->gui_attached) return;
dt_dev_pixelpipe_cache_flush(&(dev->pipe->cache));
dt_dev_invalidate(dev);
}

void dt_dev_reprocess_preview(dt_develop_t *dev)
{
// Flush the caches and recompute from scratch
if(darktable.gui->reset || !dev || !dev->gui_attached) return;

dt_pthread_mutex_lock(&dev->history_mutex);
dev->preview_pipe->cache_obsolete = 1;
dt_pthread_mutex_unlock(&dev->history_mutex);

dt_dev_pixelpipe_cache_flush(&(dev->preview_pipe->cache));
dt_dev_invalidate_preview(dev);
}

void dt_dev_reprocess_all(dt_develop_t *dev)
{
dt_dev_reprocess_center(dev);
dt_dev_reprocess_preview(dev);
}

void dt_dev_check_zoom_bounds(dt_develop_t *dev, float *zoom_x, float *zoom_y, dt_dev_zoom_t zoom,
int closeup, float *boxww, float *boxhh)
{
Expand Down
10 changes: 3 additions & 7 deletions src/develop/pixelpipe_hb.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/*
This file is part of darktable,
This file was part of darktable,
This file is part of Ansel,
Copyright (C) 2009-2021 darktable developers.
Copyright (C) 2023 Aurélien Pierre.
darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -142,7 +144,6 @@ int dt_dev_pixelpipe_init_cached(dt_dev_pixelpipe_t *pipe, size_t size, int32_t
pipe->nodes = NULL;
pipe->backbuf_size = size;
if(!dt_dev_pixelpipe_cache_init(&(pipe->cache), entries, pipe->backbuf_size)) return 0;
pipe->cache_obsolete = 0;
pipe->backbuf = NULL;
pipe->backbuf_scale = 0.0f;
pipe->backbuf_zoom_x = 0.0f;
Expand Down Expand Up @@ -2087,11 +2088,6 @@ int dt_dev_pixelpipe_process(dt_dev_pixelpipe_t *pipe, dt_develop_t *dev, int x,

// re-entry point: in case of late opencl errors we start all over again with opencl-support disabled
restart:

// check if we should obsolete caches
if(pipe->cache_obsolete) dt_dev_pixelpipe_cache_flush(&(pipe->cache));
pipe->cache_obsolete = 0;

// mask display off as a starting point
pipe->mask_display = DT_DEV_PIXELPIPE_DISPLAY_NONE;
// and blendif active
Expand Down
2 changes: 0 additions & 2 deletions src/develop/pixelpipe_hb.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ typedef struct dt_dev_pixelpipe_t
{
// store history/zoom caches
dt_dev_pixelpipe_cache_t cache;
// set to non-zero in order to obsolete old cache entries on next pixelpipe run
int cache_obsolete;
// input buffer
float *input;
// width and height of input buffer
Expand Down

0 comments on commit 6a80633

Please sign in to comment.