Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/develop/develop.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void dt_dev_cleanup(dt_develop_t *dev)

void dt_dev_process_image(dt_develop_t *dev)
{
if(!dev->gui_attached || dev->full.pipe->processing) return;
if(!dev->gui_attached || dt_pipe_started(dev->full.pipe)) return;
const gboolean err = dt_control_add_job_res(dt_dev_process_image_job_create(dev), DT_CTL_WORKER_ZOOM_1);
if(err) dt_print(DT_DEBUG_ALWAYS, "[dev_process_image] job queue exceeded!");
}
Expand Down Expand Up @@ -613,7 +613,7 @@ void dt_dev_process_image_job(dt_develop_t *dev,

dt_pthread_mutex_lock(&pipe->mutex);

if(dev->gui_leaving || (dt_atomic_get_int(&pipe->shutdown) != DT_DEV_PIXELPIPE_STOP_NO))
if(dev->gui_leaving || dt_pipe_started(pipe))
{
dt_pthread_mutex_unlock(&pipe->mutex);
return;
Expand Down Expand Up @@ -778,7 +778,7 @@ void dt_dev_process_image_job(dt_develop_t *dev,

const gboolean early = dt_dev_pixelpipe_process(pipe, dev, x, y, wd, ht, scale, devid);
const dt_dev_pixelpipe_stopper_t shutdown = dt_atomic_exch_int(&pipe->shutdown, DT_DEV_PIXELPIPE_STOP_NO);
const gboolean stopped = early || shutdown != DT_DEV_PIXELPIPE_STOP_NO;
const gboolean stopped = early || shutdown > DT_DEV_PIXELPIPE_PROCESSING;

const dt_iop_roi_t proi = (dt_iop_roi_t) {.x = x, .y = y, .width = wd, .height = ht, .scale = scale };
dt_print_pipe(DT_DEBUG_PIPE, stopped ? "pixelpipe_process stopped" : "pixelpipe_process good",
Expand Down Expand Up @@ -813,7 +813,7 @@ void dt_dev_process_image_job(dt_develop_t *dev,
/* pixelpipe stopped due to changed pipe nodes, HQ mode changes or module aborts
while processing the pipe. All require restarts as pipe status is not valid yet.
*/
if(shutdown != DT_DEV_PIXELPIPE_STOP_NO)
if(shutdown > DT_DEV_PIXELPIPE_PROCESSING)
{
dt_print_pipe(DT_DEBUG_PIPE | DT_DEBUG_VERBOSE, "image_job restart", pipe, NULL, DT_DEVICE_NONE, &proi, NULL);
goto restart;
Expand Down Expand Up @@ -2799,7 +2799,6 @@ void dt_dev_reprocess_center(dt_develop_t *dev)
if(dev && dev->gui_attached)
{
dev->full.pipe->changed |= DT_DEV_PIPE_SYNCH;
dev->full.pipe->cache_obsolete = TRUE;

// invalidate buffers and force redraw of darkroom
dt_dev_invalidate_all(dev);
Expand All @@ -2815,7 +2814,6 @@ void dt_dev_reprocess_preview(dt_develop_t *dev)
return;

dev->preview_pipe->changed |= DT_DEV_PIPE_SYNCH;
dev->preview_pipe->cache_obsolete = TRUE;

dt_dev_invalidate_preview(dev);
dt_control_queue_redraw_center();
Expand Down Expand Up @@ -3268,7 +3266,11 @@ void dt_dev_zoom_move(dt_dev_viewport_t *port,
port->pipe->changed |= DT_DEV_PIPE_ZOOMED;

if(port->widget)
{
if(dt_pipe_processing(port->pipe))
dt_dev_pixelpipe_set_shutdown(port->pipe, DT_DEV_PIXELPIPE_STOP_ZOOM);
dt_control_queue_redraw_widget(port->widget);
}
if(port == &dev->full)
dt_control_navigation_redraw();
}
Expand Down Expand Up @@ -3793,7 +3795,7 @@ static gboolean _dev_wait_hash(dt_develop_t *dev,

for(int n = 0; n < nloop; n++)
{
if(dt_atomic_get_int(&pipe->shutdown) != DT_DEV_PIXELPIPE_STOP_NO)
if(dt_atomic_get_int(&pipe->shutdown) > DT_DEV_PIXELPIPE_PROCESSING)
return TRUE; // stop waiting if pipe shuts down

dt_hash_t probehash;
Expand Down
31 changes: 23 additions & 8 deletions src/develop/pixelpipe_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,17 +388,32 @@ void dt_dev_pixelpipe_cache_invalidate_later(dt_dev_pixelpipe_t *pipe,
invalidated++;
}
}
pipe->bcache_hash = DT_INVALID_HASH;

if(invalidated)
dt_print_pipe(DT_DEBUG_PIPE, "pipecache invalidate", pipe, NULL, DT_DEVICE_NONE, NULL, NULL,
"%s%i cachelines after ioporder=%i", info ? info : "", invalidated, order);
}

const gboolean bcache = pipe->bcache_data != NULL && pipe->bcache_hash != DT_INVALID_HASH;
void dt_dev_pixelpipe_cache_invalidate_iop(dt_dev_pixelpipe_t *pipe,
const int32_t order,
const char *info)
{
const dt_dev_pixelpipe_cache_t *cache = &pipe->cache;
int invalidated = 0;
for(int k = DT_PIPECACHE_MIN; k < cache->entries; k++)
{
if((cache->ioporder[k] == order) && (cache->hash[k] != DT_INVALID_HASH))
{
_mark_invalid_cacheline(cache, k);
invalidated++;
}
}
pipe->bcache_hash = DT_INVALID_HASH;

if(invalidated || bcache)
dt_print_pipe(DT_DEBUG_PIPE,
order ? "pipecache invalidate" : "pipecache flush",
pipe, NULL, DT_DEVICE_NONE, NULL, NULL,
"%s%i cachelines after ioporder=%i%s",
info ? info : "",
invalidated, order, bcache ? ", blend cache" : "");
if(invalidated)
dt_print_pipe(DT_DEBUG_PIPE, "pipecache invalidate", pipe, NULL, DT_DEVICE_NONE, NULL, NULL,
"%s%i cachelines for ioporder=%i", info ? info : "", invalidated, order);
}

void dt_dev_pixelpipe_cache_flush(dt_dev_pixelpipe_t *pipe)
Expand Down
3 changes: 3 additions & 0 deletions src/develop/pixelpipe_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ void dt_dev_pixelpipe_cache_flush(struct dt_dev_pixelpipe_t *pipe);
/** invalidates all cachelines for modules with at least the same iop_order */
void dt_dev_pixelpipe_cache_invalidate_later(struct dt_dev_pixelpipe_t *pipe, const int32_t order, const char *info);

/** invalidates all cachelines marked with the given iop_order */
void dt_dev_pixelpipe_cache_invalidate_iop(struct dt_dev_pixelpipe_t *pipe, const int32_t order, const char *info);

/** makes this buffer very important after it has been pulled from the cache. */
void dt_dev_pixelpipe_important_cacheline(const struct dt_dev_pixelpipe_t *pipe, const void *data, const size_t size);

Expand Down
Loading
Loading