Skip to content

Commit 07a4847

Browse files
Introduce pixelpipe zoom knocking
Currently we use dt_dev_pixelpipe_set_shutdown() to stop a running pixelpipe asap, this is used for changing the nodes involved in the pipe (history changes) or when toggling between darkroom HQ mode on/off as examples, we do this for UI responsiveness. Being in darkroom mode **while** the dt_dev_pixelpipe_process() is still running, a UI move of the the displayed part of the main canvas or zooming-in/out results in a new control job which is currently processed *after the complete* dt_dev_pixelpipe_process(). This commit adds an early-exit & restart pipe mechanism for a faster UI response, avoiding up to one pixelpipe run with a good chance of finding valid pixelpipe cache data. 1. A new shutdown mode DT_DEV_PIXELPIPE_STOP_ZOOM has been added to dt_dev_pixelpipe_stopper_t. It is a) checked, reported and handled in dt_dev_process_image_job() b) tested in dt_dev_pixelpipe_process() via _module_pipe_stop() making sure the pipe possibly exits with TRUE state and a shutdown mode. In all cases we ensure pixelpipe cache integrity via _module_pipe_stop(). 2. How is this shutdown mode induced? If we zoom in/out or reposition the main canvas we set shutdown to DT_DEV_PIXELPIPE_STOP_ZOOM in dt_dev_zoom_move() enforcing the pipe restart.
1 parent 8f52e41 commit 07a4847

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

src/develop/develop.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,7 +3268,11 @@ void dt_dev_zoom_move(dt_dev_viewport_t *port,
32683268
port->pipe->changed |= DT_DEV_PIPE_ZOOMED;
32693269

32703270
if(port->widget)
3271+
{
3272+
if(port->pipe->processing)
3273+
dt_dev_pixelpipe_set_shutdown(port->pipe, DT_DEV_PIXELPIPE_STOP_ZOOM);
32713274
dt_control_queue_redraw_widget(port->widget);
3275+
}
32723276
if(port == &dev->full)
32733277
dt_control_navigation_redraw();
32743278
}

src/develop/pixelpipe_hb.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949

5050
static inline gboolean _pipe_has_shutdown(dt_dev_pixelpipe_t *pipe)
5151
{
52-
return dt_atomic_get_int(&pipe->shutdown) != DT_DEV_PIXELPIPE_STOP_NO;
52+
const dt_dev_pixelpipe_stopper_t stopper = dt_atomic_get_int(&pipe->shutdown);
53+
return stopper != DT_DEV_PIXELPIPE_STOP_NO && stopper != DT_DEV_PIXELPIPE_STOP_ZOOM;
5354
}
5455

5556
// benchmarking and pfm dumps should happen for these pipes if there is no shutdown request
@@ -108,6 +109,7 @@ const char *dt_dev_pixelpipe_shutdown_to_str(const dt_dev_pixelpipe_stopper_t st
108109
case DT_DEV_PIXELPIPE_STOP_NO: return "DT_DEV_PIXELPIPE_STOP_NO";
109110
case DT_DEV_PIXELPIPE_STOP_NODES: return "DT_DEV_PIXELPIPE_STOP_NODES";
110111
case DT_DEV_PIXELPIPE_STOP_HQ: return "DT_DEV_PIXELPIPE_STOP_HQ";
112+
case DT_DEV_PIXELPIPE_STOP_ZOOM: return "DT_DEV_PIXELPIPE_STOP_ZOOM";
111113
case DT_DEV_PIXELPIPE_STOP_LAST: return "DT_DEV_PIXELPIPE_STOP_LAST";
112114
default: return "DT_DEV_PIXELPIPE_STOP_MODULE";
113115
}
@@ -1323,8 +1325,11 @@ static inline gboolean _module_pipe_stop(dt_dev_pixelpipe_t *pipe,
13231325
}
13241326
#endif
13251327

1326-
// stopper reflects the iop_order of the stopping mode so we must invalidate output cachelines.
1327-
dt_dev_pixelpipe_cache_invalidate_iop(pipe, stopper, "module pipe stop: ");
1328+
if(stopper == DT_DEV_PIXELPIPE_STOP_ZOOM)
1329+
dt_dev_pixelpipe_cache_invalidate_iop(pipe, module->iop_order, "zoomed pipe stop: ");
1330+
else
1331+
// stopper reflects the iop_order of the stopping mode so we must invalidate output cachelines.
1332+
dt_dev_pixelpipe_cache_invalidate_iop(pipe, stopper, "module pipe stop: ");
13281333

13291334
return TRUE;
13301335
}

src/develop/pixelpipe_hb.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ typedef enum dt_dev_pixelpipe_status_t
127127
Used to switch between darkroom HQ modes.
128128
Requires a restart of the pipe but pixelpipe cache can stay.
129129
130+
DT_DEV_PIXELPIPE_STOP_ZOOM
131+
As we stopped inside a module the output cacheline must be invalidated.
132+
130133
DT_DEV_PIXELPIPE_STOP_LAST
131134
If the shutdown value is >= DT_DEV_PIXELPIPE_STOP_LAST it is understood as the iop_order
132135
of a module. Any module can use dt_dev_pixelpipe_set_shutdown() to it's iop_order at runtime,
@@ -140,6 +143,7 @@ typedef enum dt_dev_pixelpipe_stopper_t
140143
DT_DEV_PIXELPIPE_STOP_NO = 0,
141144
DT_DEV_PIXELPIPE_STOP_NODES,
142145
DT_DEV_PIXELPIPE_STOP_HQ,
146+
DT_DEV_PIXELPIPE_STOP_ZOOM,
143147
DT_DEV_PIXELPIPE_STOP_LAST,
144148
} dt_dev_pixelpipe_stopper_t;
145149

0 commit comments

Comments
 (0)