@@ -448,7 +448,6 @@ void update_sc_config(mode_data_t *vm_in, mode_data_t *vm_out, vm_proc_config_t
448448 hv_in_config3 .v_synclen = vm_in -> timings .v_synclen ;
449449 hv_in_config2 .v_backporch = vm_in -> timings .v_backporch ;
450450 hv_in_config2 .interlaced = vm_in -> timings .interlaced ;
451- hv_in_config3 .v_startline = vm_in -> timings .v_synclen + vm_in -> timings .v_backporch + 12 ;
452451 hv_in_config2 .h_skip = vm_conf -> h_skip ;
453452 hv_in_config2 .h_sample_sel = vm_conf -> h_sample_sel ;
454453
@@ -534,6 +533,15 @@ void update_sc_config(mode_data_t *vm_in, mode_data_t *vm_out, vm_proc_config_t
534533 sl_config3 .sl_c_overlay = 0 ;
535534 }
536535
536+ h_blank = vm_out -> timings .h_total - vm_conf -> x_size ;
537+ v_blank = (vm_out -> timings .v_total >>vm_out -> timings .interlaced )- vm_conf -> y_size ;
538+ h_frontporch = h_blank - vm_conf -> x_offset - vm_out -> timings .h_backporch - vm_out -> timings .h_synclen ;
539+ v_frontporch = v_blank - vm_conf -> y_offset - vm_out -> timings .v_backporch - vm_out -> timings .v_synclen ;
540+
541+ // VIP frame reader swaps buffers at the end of read frame while writer apparently does it just before frame to be written (?)
542+ // SOF needs to be offset accordingly to minimize FB latency
543+ hv_in_config3 .v_startline = vm_in -> timings .v_synclen + vm_in -> timings .v_backporch + 20 + ((v_frontporch * 100 * vm_in -> timings .v_total )/(100 * vm_out -> timings .v_total ));
544+
537545 sc -> hv_in_config = hv_in_config ;
538546 sc -> hv_in_config2 = hv_in_config2 ;
539547 sc -> hv_in_config3 = hv_in_config3 ;
@@ -645,11 +653,6 @@ void update_sc_config(mode_data_t *vm_in, mode_data_t *vm_out, vm_proc_config_t
645653 //vip_fb->locked = vm_conf->framelock; // causes cvo fifo underflows
646654 vip_fb -> locked = 0 ;
647655
648- h_blank = vm_out -> timings .h_total - vm_conf -> x_size ;
649- v_blank = (vm_out -> timings .v_total >>vm_out -> timings .interlaced )- vm_conf -> y_size ;
650- h_frontporch = h_blank - vm_conf -> x_offset - vm_out -> timings .h_backporch - vm_out -> timings .h_synclen ;
651- v_frontporch = v_blank - vm_conf -> y_offset - vm_out -> timings .v_backporch - vm_out -> timings .v_synclen ;
652-
653656 if ((vip_cvo -> h_active != vm_conf -> x_size ) ||
654657 (vip_cvo -> v_active != vm_conf -> y_size ) ||
655658 (vip_cvo -> h_synclen != vm_out -> timings .h_synclen ) ||
0 commit comments