@@ -338,7 +338,7 @@ void dt_dev_process_image_job(dt_develop_t *dev,
338
338
port ? 1.0 : buf .iscale );
339
339
340
340
// We require calculation of pixelpipe dimensions via dt_dev_pixelpipe_change() in these cases
341
- const gboolean initial = pipe -> loading || dev -> image_force_reload || pipe -> input_changed ;
341
+ gboolean initial = pipe -> loading || dev -> image_force_reload || pipe -> input_changed ;
342
342
343
343
if (pipe -> loading )
344
344
{
@@ -391,11 +391,21 @@ void dt_dev_process_image_job(dt_develop_t *dev,
391
391
if (port == & dev -> full )
392
392
pipe -> input_timestamp = dev -> timestamp ;
393
393
394
- const gboolean pipe_changed = pipe -> changed != DT_DEV_PIPE_UNCHANGED ;
395
- // dt_dev_pixelpipe_change() locks history mutex while syncing nodes and finally calculates dimensions
396
- if (pipe_changed || initial || (port && port -> pipe -> loading ))
394
+ const gboolean changing = (pipe -> changed != DT_DEV_PIPE_UNCHANGED ) || initial ;
395
+
396
+ // to be checked: can we possibly restrict later dt_dev_zoom_move() calls
397
+ const gboolean require_zoom_test = ((pipe -> changed & ~DT_DEV_PIPE_ZOOMED ) != DT_DEV_PIPE_UNCHANGED ) || initial ;
398
+
399
+ /* dt_dev_pixelpipe_change()
400
+ locks history mutex while syncing nodes
401
+ finally calculates dimensions
402
+ leaves clean pipe->changed
403
+ */
404
+ if (changing || (port && port -> pipe -> loading ))
397
405
dt_dev_pixelpipe_change (pipe , dev );
398
406
407
+ initial = FALSE; // don't enforce dt_dev_pixelpipe_change() for restarts
408
+
399
409
float scale = 1.0f ;
400
410
int window_width = G_MAXINT ;
401
411
int window_height = G_MAXINT ;
@@ -407,8 +417,11 @@ void dt_dev_process_image_job(dt_develop_t *dev,
407
417
// if just changed to an image with a different aspect ratio or
408
418
// altered image orientation, the prior zoom xy could now be beyond
409
419
// the image boundary
410
- if (port -> pipe -> loading || pipe_changed )
420
+ if (port -> pipe -> loading || require_zoom_test )
421
+ {
422
+ dt_print_pipe (DT_DEBUG_PIPE | DT_DEBUG_VERBOSE , "[dt_dev_zoom_move]" , pipe , NULL , DT_DEVICE_NONE , NULL , NULL );
411
423
dt_dev_zoom_move (port , DT_ZOOM_MOVE , 0.0f , 0 , 0.0f , 0.0f , TRUE);
424
+ }
412
425
413
426
// determine scale according to new dimensions
414
427
dt_dev_zoom_t zoom ;
@@ -418,13 +431,6 @@ void dt_dev_process_image_job(dt_develop_t *dev,
418
431
window_width = port -> width * port -> ppd / (1 <<closeup );
419
432
window_height = port -> height * port -> ppd / (1 <<closeup );
420
433
}
421
- // else
422
- // {
423
- // // FIXME full pipe may be busy, so update processed sizes here
424
- // // make sure preview pipe is newer than full/preview2 pipes
425
- // dev->full.pipe->processed_width = pipe->processed_width * pipe->iscale;
426
- // dev->full.pipe->processed_height = pipe->processed_height * pipe->iscale;
427
- // }
428
434
429
435
const int wd = MIN (window_width , scale * pipe -> processed_width );
430
436
const int ht = MIN (window_height , scale * pipe -> processed_height );
@@ -435,8 +441,25 @@ void dt_dev_process_image_job(dt_develop_t *dev,
435
441
436
442
if (dt_dev_pixelpipe_process (pipe , dev , x , y , wd , ht , scale , devid ))
437
443
{
444
+ const gboolean img_changed = dev -> image_force_reload || pipe -> loading || pipe -> input_changed ;
445
+ // As image_force_reload could be set while we are restarting we clear it and possibly flush the cache too.
446
+ if (dev -> image_force_reload ) dt_dev_pixelpipe_cache_flush (pipe );
447
+ dev -> image_force_reload = FALSE;
448
+ const dt_dev_pixelpipe_stopper_t shutdown = dt_atomic_exch_int (& pipe -> shutdown , DT_DEV_PIXELPIPE_STOP_NO );
449
+ if (shutdown != DT_DEV_PIXELPIPE_STOP_NO || img_changed )
450
+ dt_print_pipe (DT_DEBUG_PIPE ,
451
+ shutdown == DT_DEV_PIXELPIPE_STOP_NODES ? "DT_DEV_PIXELPIPE_STOP_NODES shutdown"
452
+ : shutdown == DT_DEV_PIXELPIPE_STOP_HQ ? "DT_DEV_PIXELPIPE_STOP_HQ shutdown"
453
+ : shutdown == DT_DEV_PIXELPIPE_STOP_NO ? "pixelpipe_process ERR"
454
+ : "PROCESS shutdown" ,
455
+ pipe , NULL , DT_DEVICE_NONE , NULL , NULL ,
456
+ "%s%s%sshutdown=%d" ,
457
+ dev -> image_force_reload ? "image_force_reload, " : "" ,
458
+ pipe -> loading ? "pipe loading, " : "" ,
459
+ pipe -> input_changed ? "input_changed, " : "" ,
460
+ shutdown );
438
461
// interrupted because image changed?
439
- if (dev -> image_force_reload || pipe -> loading || pipe -> input_changed )
462
+ if (img_changed )
440
463
{
441
464
dt_mipmap_cache_release (& buf );
442
465
dt_control_busy_leave ();
@@ -447,12 +470,6 @@ void dt_dev_process_image_job(dt_develop_t *dev,
447
470
// or because the pipeline changed or shutdown?
448
471
else
449
472
{
450
- const dt_dev_pixelpipe_stopper_t downer = dt_atomic_exch_int (& pipe -> shutdown , DT_DEV_PIXELPIPE_STOP_NO );
451
- if (downer )
452
- dt_print_pipe (DT_DEBUG_PIPE , downer == DT_DEV_PIXELPIPE_STOP_NODES ? "DT_DEV_PIXELPIPE_STOP_NODES shutdown"
453
- : downer == DT_DEV_PIXELPIPE_STOP_HQ ? "DT_DEV_PIXELPIPE_STOP_HQ shutdown"
454
- : "PROCESS shutdown" ,
455
- pipe , NULL , DT_DEVICE_NONE , NULL , NULL , "downer=%d" , downer );
456
473
if (port && port -> widget ) dt_control_queue_redraw_widget (port -> widget );
457
474
goto restart ;
458
475
}
@@ -463,7 +480,11 @@ void dt_dev_process_image_job(dt_develop_t *dev,
463
480
_dev_average_delay_update (& start , & pipe -> average_delay );
464
481
465
482
// maybe we got zoomed/panned in the meantime?
466
- if (port && pipe -> changed != DT_DEV_PIPE_UNCHANGED ) goto restart ;
483
+ if (port && pipe -> changed != DT_DEV_PIPE_UNCHANGED )
484
+ {
485
+ dt_atomic_set_int (& pipe -> shutdown , DT_DEV_PIXELPIPE_STOP_NO );
486
+ goto restart ;
487
+ }
467
488
468
489
pipe -> status = DT_DEV_PIXELPIPE_VALID ;
469
490
pipe -> loading = FALSE;
0 commit comments