@@ -735,6 +735,9 @@ void __video_most_time_critical_func(prepare_for_active_scanline_irqs_enabled)()
735
735
#if PICO_SCANVIDEO_ENABLE_VIDEO_RECOVERY
736
736
if (!pio_sm_is_tx_fifo_empty (video_pio , PICO_SCANVIDEO_SCANLINE_SM )) {
737
737
pio_sm_clear_fifos (video_pio , PICO_SCANVIDEO_SCANLINE_SM );
738
+ // if there wsa something in the FIFO, then there's a good chance there's a possibility that there was something
739
+ // in the OSR still, too
740
+ pio_sm_exec (video_pio , PICO_SCANVIDEO_SCANLINE_SM , pio_encode_out (pio_null , 32 ));
738
741
}
739
742
if (video_pio -> sm [PICO_SCANVIDEO_SCANLINE_SM ].instr != PIO_WAIT_IRQ4 ) {
740
743
// hmm the problem here is we don't know if we should wait or not, because that is purely based on timing..
@@ -744,7 +747,12 @@ void __video_most_time_critical_func(prepare_for_active_scanline_irqs_enabled)()
744
747
// - id irq already posted, and we don't wait: GOOD
745
748
pio_sm_exec (video_pio , PICO_SCANVIDEO_SCANLINE_SM , pio_encode_wait_irq (1 , false, 4 ));
746
749
if (pio_sm_is_exec_stalled (video_pio , PICO_SCANVIDEO_SCANLINE_SM )) {
747
- pio_sm_exec (video_pio , PICO_SCANVIDEO_SCANLINE_SM , pio_encode_jmp (shared_state .scanline_program_wait_index ));
750
+ // special case check that we are have actually presumably seen the IRQ, but are blocked on the OUT after it, in
751
+ // which case we don't want to block again
752
+ if (video_pio -> sm [PICO_SCANVIDEO_SCANLINE_SM ].addr != shared_state .scanline_program_wait_index + 1 ) {
753
+ pio_sm_exec (video_pio , PICO_SCANVIDEO_SCANLINE_SM ,
754
+ pio_encode_jmp (shared_state .scanline_program_wait_index ));
755
+ }
748
756
} else {
749
757
pio_sm_exec (video_pio , PICO_SCANVIDEO_SCANLINE_SM ,
750
758
pio_encode_jmp (shared_state .scanline_program_wait_index + 1 ));
0 commit comments