@@ -341,6 +341,9 @@ static bool video_timing_enabled = false;
341
341
static bool display_enabled = true;
342
342
343
343
static scanvideo_scanline_repeat_count_fn _scanline_repeat_count_fn ;
344
+ #if PICO_SCANVIDEO_SCANLINE_RELEASE_FUNCTION
345
+ static scanvideo_scanline_release_fn _scanline_release_fn ;
346
+ #endif
344
347
345
348
inline static void list_prepend (full_scanline_buffer_t * * phead , full_scanline_buffer_t * fsb ) {
346
349
scanline_assert (fsb );
@@ -466,6 +469,9 @@ inline static void free_local_free_list_irqs_enabled(full_scanline_buffer_t *loc
466
469
spin_unlock (shared_state .free_list .lock , save );
467
470
// note also this is useful for triggering scanvideo_wait_for_scanline_complete check
468
471
__sev ();
472
+ #if PICO_SCANVIDEO_SCANLINE_RELEASE_FUNCTION
473
+ if (_scanline_release_fn ) _scanline_release_fn ();
474
+ #endif
469
475
}
470
476
}
471
477
@@ -872,7 +878,6 @@ static void __video_time_critical_func(prepare_for_vblank_scanline_irqs_enabled)
872
878
873
879
// because IRQs are enabled, we may obviously be pre-empted before or between either of these
874
880
release_scanline_irqs_enabled (buffers_to_free_count , & local_free_list );
875
-
876
881
free_local_free_list_irqs_enabled (local_free_list );
877
882
878
883
if (signal ) {
@@ -1041,7 +1046,6 @@ extern bool scanvideo_in_vblank() {
1041
1046
return * (volatile bool * ) & shared_state .scanline .in_vblank ;
1042
1047
}
1043
1048
1044
-
1045
1049
static uint default_scanvideo_scanline_repeat_count_fn (uint32_t scanline_id ) {
1046
1050
return 1 ;
1047
1051
}
@@ -1254,6 +1258,13 @@ void scanvideo_set_scanline_repeat_fn(scanvideo_scanline_repeat_count_fn fn) {
1254
1258
_scanline_repeat_count_fn = fn ? fn : default_scanvideo_scanline_repeat_count_fn ;
1255
1259
}
1256
1260
1261
+ #if PICO_SCANVIDEO_SCANLINE_RELEASE_FUNCTION
1262
+ void scanvideo_set_scanline_release_fn (scanvideo_scanline_release_fn fn ) {
1263
+ _scanline_release_fn = fn ;
1264
+ }
1265
+ #endif
1266
+
1267
+
1257
1268
bool scanvideo_setup (const scanvideo_mode_t * mode ) {
1258
1269
return scanvideo_setup_with_timing (mode , mode -> default_timing );
1259
1270
}
@@ -1377,7 +1388,7 @@ bool scanvideo_setup_with_timing(const scanvideo_mode_t *mode, const scanvideo_t
1377
1388
#if PICO_SCANVIDEO_ENABLE_VIDEO_RECOVERY
1378
1389
int program_wait_index = -1 ;
1379
1390
#endif
1380
- #if PICO_SCANVIDEO_ENABLE_VIDEO_RECOVERY || PARAM_ASSERTIONS_ENABLED (SCANVIDEO_DBI )
1391
+ #if PICO_SCANVIDEO_ENABLE_VIDEO_RECOVERY || PARAM_ASSERTIONS_ENABLED (SCANVIDEO_DPI )
1381
1392
for (int i = 0 ; i < mode -> pio_program -> program -> length ; i ++ ) {
1382
1393
if (instructions [i ] == PIO_WAIT_IRQ4 ) {
1383
1394
#if PICO_SCANVIDEO_ENABLE_VIDEO_RECOVERY
0 commit comments