summaryrefslogtreecommitdiff
path: root/apps/plugins/pictureflow
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pictureflow')
-rw-r--r--apps/plugins/pictureflow/pictureflow.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index 73eee2e4c4..39213e5cb7 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -2185,12 +2185,15 @@ static void thread(void)
2185 /* we just woke up */ 2185 /* we just woke up */
2186 break; 2186 break;
2187 } 2187 }
2188 if(ev.id != SYS_TIMEOUT) 2188
2189 while ( load_new_slide() ) { 2189 if(ev.id != SYS_TIMEOUT) {
2190 rb->yield(); 2190 while ( rb->queue_empty(&thread_q) ) {
2191 switch (ev.id) { 2191 buf_ctx_lock();
2192 case EV_EXIT: 2192 bool slide_loaded = load_new_slide();
2193 return; 2193 buf_ctx_unlock();
2194 if (!slide_loaded)
2195 break;
2196 rb->yield();
2194 } 2197 }
2195 } 2198 }
2196 } 2199 }
@@ -2517,7 +2520,6 @@ static inline bool load_and_prepare_surface(const int slide_index,
2517*/ 2520*/
2518bool load_new_slide(void) 2521bool load_new_slide(void)
2519{ 2522{
2520 buf_ctx_lock();
2521 if (wants_to_quit) 2523 if (wants_to_quit)
2522 return false; 2524 return false;
2523 2525
@@ -2571,7 +2573,6 @@ bool load_new_slide(void)
2571 pf_sldcache.center_idx = i; 2573 pf_sldcache.center_idx = i;
2572 pf_sldcache.left_idx = i; 2574 pf_sldcache.left_idx = i;
2573 pf_sldcache.right_idx = i; 2575 pf_sldcache.right_idx = i;
2574 buf_ctx_unlock();
2575 return true; 2576 return true;
2576 } 2577 }
2577 } 2578 }
@@ -2605,7 +2606,6 @@ bool load_new_slide(void)
2605 { 2606 {
2606 if (pf_sldcache.free == -1 && !free_slide_prio(prio_l)) 2607 if (pf_sldcache.free == -1 && !free_slide_prio(prio_l))
2607 { 2608 {
2608 buf_ctx_unlock();
2609 return false; 2609 return false;
2610 } 2610 }
2611 2611
@@ -2614,14 +2614,12 @@ bool load_new_slide(void)
2614 { 2614 {
2615 lla_insert_before(&pf_sldcache.used, i, pf_sldcache.left_idx); 2615 lla_insert_before(&pf_sldcache.used, i, pf_sldcache.left_idx);
2616 pf_sldcache.left_idx = i; 2616 pf_sldcache.left_idx = i;
2617 buf_ctx_unlock();
2618 return true; 2617 return true;
2619 } 2618 }
2620 } else if(right < number_of_slides - 1) 2619 } else if(right < number_of_slides - 1)
2621 { 2620 {
2622 if (pf_sldcache.free == -1 && !free_slide_prio(prio_r)) 2621 if (pf_sldcache.free == -1 && !free_slide_prio(prio_r))
2623 { 2622 {
2624 buf_ctx_unlock();
2625 return false; 2623 return false;
2626 } 2624 }
2627 2625
@@ -2630,7 +2628,6 @@ bool load_new_slide(void)
2630 { 2628 {
2631 lla_insert_after(i, pf_sldcache.right_idx); 2629 lla_insert_after(i, pf_sldcache.right_idx);
2632 pf_sldcache.right_idx = i; 2630 pf_sldcache.right_idx = i;
2633 buf_ctx_unlock();
2634 return true; 2631 return true;
2635 } 2632 }
2636 } 2633 }
@@ -2645,7 +2642,6 @@ insert_first_slide:
2645 pf_sldcache.left_idx = i; 2642 pf_sldcache.left_idx = i;
2646 pf_sldcache.right_idx = i; 2643 pf_sldcache.right_idx = i;
2647 pf_sldcache.used = i; 2644 pf_sldcache.used = i;
2648 buf_ctx_unlock();
2649 return true; 2645 return true;
2650 } 2646 }
2651 } 2647 }
@@ -2654,12 +2650,10 @@ fail_and_refree:
2654 { 2650 {
2655 lla_insert_tail(&pf_sldcache.free, i); 2651 lla_insert_tail(&pf_sldcache.free, i);
2656 } 2652 }
2657 buf_ctx_unlock();
2658 return false; 2653 return false;
2659fatal_fail: 2654fatal_fail:
2660 free_all_slide_prio(0); 2655 free_all_slide_prio(0);
2661 initialize_slide_cache(); 2656 initialize_slide_cache();
2662 buf_ctx_unlock();
2663 return false; 2657 return false;
2664} 2658}
2665 2659