summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-05-28 10:17:16 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-05-28 10:17:16 +0000
commitadf2e4c9a012fda200431c92cb2c1707dbe2f0a3 (patch)
tree3a2755b05f9e2092d5bff458929b825c955c66f1
parentb57b779fbced4a3fc1ecd0799a7666c2f1645f17 (diff)
downloadrockbox-adf2e4c9a012fda200431c92cb2c1707dbe2f0a3.tar.gz
rockbox-adf2e4c9a012fda200431c92cb2c1707dbe2f0a3.zip
Targets with HAVE_LCD_ENABLE: Provide a means to receive notifications when the lcd is enabled and the image is refreshed so overlayed drawing can also be refreshed. Chiefly mpegplayer needs this so it can redraw the YUV data after the backlight is turned on while paused or when using 'Set Start Time'.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17640 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugin.c4
-rw-r--r--apps/plugin.h6
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c22
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c23
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.h3
-rw-r--r--firmware/drivers/lcd-16bit.c21
-rw-r--r--firmware/export/kernel.h1
-rw-r--r--firmware/export/lcd.h4
-rw-r--r--firmware/target/arm/iriver/h10/lcd-h10_20gb.c1
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c1
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/lcd-e200.c1
-rw-r--r--firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c1
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c1
-rw-r--r--firmware/target/coldfire/iaudio/x5/lcd-x5.c1
-rw-r--r--firmware/target/coldfire/iriver/h300/lcd-h300.c1
15 files changed, 90 insertions, 1 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index e7b66a1cb2..9a435b24bc 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -601,6 +601,10 @@ static const struct plugin_api rockbox_api = {
601 simplelist_info_init, 601 simplelist_info_init,
602 simplelist_show_list, 602 simplelist_show_list,
603 603
604#ifdef HAVE_LCD_ENABLE
605 lcd_set_enable_hook,
606 &button_queue,
607#endif
604}; 608};
605 609
606int plugin_load(const char* plugin, const void* parameter) 610int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index c23e6457cf..edd54989da 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -124,7 +124,7 @@ void* plugin_get_buffer(size_t *buffer_size);
124#define PLUGIN_MAGIC 0x526F634B /* RocK */ 124#define PLUGIN_MAGIC 0x526F634B /* RocK */
125 125
126/* increase this every time the api struct changes */ 126/* increase this every time the api struct changes */
127#define PLUGIN_API_VERSION 115 127#define PLUGIN_API_VERSION 116
128 128
129/* update this to latest version if a change to the api struct breaks 129/* update this to latest version if a change to the api struct breaks
130 backwards compatibility (and please take the opportunity to sort in any 130 backwards compatibility (and please take the opportunity to sort in any
@@ -752,6 +752,10 @@ struct plugin_api {
752 int count, void* data); 752 int count, void* data);
753 bool (*simplelist_show_list)(struct simplelist_info *info); 753 bool (*simplelist_show_list)(struct simplelist_info *info);
754 754
755#ifdef HAVE_LCD_ENABLE
756 void (*lcd_set_enable_hook)(void (*enable_hook)(void));
757 struct event_queue *button_queue;
758#endif
755}; 759};
756 760
757/* plugin header */ 761/* plugin header */
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index 70b41a00e2..17a1cbbb69 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -543,6 +543,13 @@ static uint32_t increment_time(uint32_t val, int32_t amount, uint32_t range)
543 return val; 543 return val;
544} 544}
545 545
546#ifdef HAVE_LCD_ENABLE
547static void get_start_time_lcd_enable_hook(void)
548{
549 rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_0, 0);
550}
551#endif /* HAVE_LCD_ENABLE */
552
546static int get_start_time(uint32_t duration) 553static int get_start_time(uint32_t duration)
547{ 554{
548 int button = 0; 555 int button = 0;
@@ -556,6 +563,10 @@ static int get_start_time(uint32_t duration)
556 lcd_(clear_display)(); 563 lcd_(clear_display)();
557 lcd_(update)(); 564 lcd_(update)();
558 565
566#ifdef HAVE_LCD_ENABLE
567 rb->lcd_set_enable_hook(get_start_time_lcd_enable_hook);
568#endif
569
559 draw_slider(0, 100, &rc_bound); 570 draw_slider(0, 100, &rc_bound);
560 rc_bound.b = rc_bound.t - SLIDER_TMARGIN; 571 rc_bound.b = rc_bound.t - SLIDER_TMARGIN;
561 rc_bound.t = SCREEN_MARGIN; 572 rc_bound.t = SCREEN_MARGIN;
@@ -707,6 +718,13 @@ static int get_start_time(uint32_t duration)
707 slider_state = state9; 718 slider_state = state9;
708 break; 719 break;
709 720
721#ifdef HAVE_LCD_ENABLE
722 case LCD_ENABLE_EVENT_0:
723 if (slider_state == state2)
724 display_thumb_image(&rc_vid);
725 continue;
726#endif
727
710 default: 728 default:
711 rb->default_event_handler(button); 729 rb->default_event_handler(button);
712 rb->yield(); 730 rb->yield();
@@ -736,6 +754,10 @@ static int get_start_time(uint32_t duration)
736 rb->yield(); 754 rb->yield();
737 } 755 }
738 756
757#ifdef HAVE_LCD_ENABLE
758 rb->lcd_set_enable_hook(NULL);
759#endif
760
739#ifndef HAVE_LCD_COLOR 761#ifndef HAVE_LCD_COLOR
740 stream_gray_show(false); 762 stream_gray_show(false);
741 grey_clear_display(); 763 grey_clear_display();
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 5b92ccced1..42e0ddd5ad 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -587,13 +587,27 @@ static void draw_putsxy_oriented(int x, int y, const char *str)
587} 587}
588#endif /* LCD_PORTRAIT */ 588#endif /* LCD_PORTRAIT */
589 589
590#ifdef HAVE_LCD_ENABLE
591/* So we can refresh the overlay */
592static void wvs_lcd_enable_hook(void)
593{
594 rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_1, 0);
595}
596#endif
597
590static void wvs_backlight_on_video_mode(bool video_on) 598static void wvs_backlight_on_video_mode(bool video_on)
591{ 599{
592 if (video_on) { 600 if (video_on) {
593 /* Turn off backlight timeout */ 601 /* Turn off backlight timeout */
594 /* backlight control in lib/helper.c */ 602 /* backlight control in lib/helper.c */
595 backlight_force_on(rb); 603 backlight_force_on(rb);
604#ifdef HAVE_LCD_ENABLE
605 rb->lcd_set_enable_hook(NULL);
606#endif
596 } else { 607 } else {
608#ifdef HAVE_LCD_ENABLE
609 rb->lcd_set_enable_hook(wvs_lcd_enable_hook);
610#endif
597 /* Revert to user's backlight settings */ 611 /* Revert to user's backlight settings */
598 backlight_use_settings(rb); 612 backlight_use_settings(rb);
599 } 613 }
@@ -1441,6 +1455,15 @@ static void button_loop(void)
1441 continue; 1455 continue;
1442 } /* BUTTON_NONE: */ 1456 } /* BUTTON_NONE: */
1443 1457
1458#ifdef HAVE_LCD_ENABLE
1459 case LCD_ENABLE_EVENT_1:
1460 {
1461 /* Draw the current frame if prepared already */
1462 stream_draw_frame(true);
1463 break;
1464 } /* LCD_ENABLE_EVENT_1: */
1465#endif
1466
1444 case MPEG_VOLUP: 1467 case MPEG_VOLUP:
1445 case MPEG_VOLUP|BUTTON_REPEAT: 1468 case MPEG_VOLUP|BUTTON_REPEAT:
1446#ifdef MPEG_VOLUP2 1469#ifdef MPEG_VOLUP2
diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h
index fa13a1e378..571c28883d 100644
--- a/apps/plugins/mpegplayer/mpegplayer.h
+++ b/apps/plugins/mpegplayer/mpegplayer.h
@@ -104,4 +104,7 @@ enum mpeg_malloc_reason_t
104#include "disk_buf.h" 104#include "disk_buf.h"
105#include "stream_mgr.h" 105#include "stream_mgr.h"
106 106
107#define LCD_ENABLE_EVENT_0 MAKE_SYS_EVENT(SYS_EVENT_CLS_PRIVATE, 0)
108#define LCD_ENABLE_EVENT_1 MAKE_SYS_EVENT(SYS_EVENT_CLS_PRIVATE, 1)
109
107#endif /* MPEGPLAYER_H */ 110#endif /* MPEGPLAYER_H */
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index c91d222830..020d6bf63a 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -49,6 +49,10 @@ fb_data lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH]
49static fb_data* lcd_backdrop = NULL; 49static fb_data* lcd_backdrop = NULL;
50static long lcd_backdrop_offset IDATA_ATTR = 0; 50static long lcd_backdrop_offset IDATA_ATTR = 0;
51 51
52#ifdef HAVE_LCD_ENABLE
53static void (*lcd_enable_hook)(void) = NULL;
54#endif
55
52static struct viewport default_vp = 56static struct viewport default_vp =
53{ 57{
54 .x = 0, 58 .x = 0,
@@ -84,6 +88,23 @@ void lcd_init(void)
84 scroll_init(); 88 scroll_init();
85} 89}
86 90
91/*** Helpers - consolidate optional code ***/
92#ifdef HAVE_LCD_ENABLE
93void lcd_set_enable_hook(void (*enable_hook)(void))
94{
95 lcd_enable_hook = enable_hook;
96}
97
98/* To be called by target driver after enabling display and refreshing it */
99void lcd_call_enable_hook(void)
100{
101 void (*enable_hook)(void) = lcd_enable_hook;
102
103 if (enable_hook != NULL)
104 enable_hook();
105}
106#endif
107
87/*** Viewports ***/ 108/*** Viewports ***/
88 109
89void lcd_set_viewport(struct viewport* vp) 110void lcd_set_viewport(struct viewport* vp)
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h
index 60c37bd3f1..88f3b80cdc 100644
--- a/firmware/export/kernel.h
+++ b/firmware/export/kernel.h
@@ -45,6 +45,7 @@
45#define SYS_EVENT_CLS_FILESYS 3 45#define SYS_EVENT_CLS_FILESYS 3
46#define SYS_EVENT_CLS_PLUG 4 46#define SYS_EVENT_CLS_PLUG 4
47#define SYS_EVENT_CLS_MISC 5 47#define SYS_EVENT_CLS_MISC 5
48#define SYS_EVENT_CLS_PRIVATE 7 /* For use inside plugins */
48/* make sure SYS_EVENT_CLS_BITS has enough range */ 49/* make sure SYS_EVENT_CLS_BITS has enough range */
49 50
50/* Bit 31->|S|c...c|i...i| */ 51/* Bit 31->|S|c...c|i...i| */
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 3e0ec780d2..45a6850db9 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -341,6 +341,10 @@ void lcd_poweroff(void);
341/* Enable/disable the main display. */ 341/* Enable/disable the main display. */
342extern void lcd_enable(bool on); 342extern void lcd_enable(bool on);
343extern bool lcd_enabled(void); 343extern bool lcd_enabled(void);
344/* Register a hook that is called when the lcd is powered and after the
345 * framebuffer data is synchronized */
346void lcd_set_enable_hook(void (*enable_hook)(void));
347void lcd_call_enable_hook(void);
344#endif /* HAVE_LCD_ENABLE */ 348#endif /* HAVE_LCD_ENABLE */
345 349
346#ifdef HAVE_LCD_SLEEP 350#ifdef HAVE_LCD_SLEEP
diff --git a/firmware/target/arm/iriver/h10/lcd-h10_20gb.c b/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
index 1ee43c390f..7d942662b8 100644
--- a/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
+++ b/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
@@ -361,6 +361,7 @@ void lcd_enable(bool on)
361 /* Probably out of sync and we don't wanna pepper the code with 361 /* Probably out of sync and we don't wanna pepper the code with
362 lcd_update() calls for this. */ 362 lcd_update() calls for this. */
363 lcd_update(); 363 lcd_update();
364 lcd_call_enable_hook();
364 } 365 }
365 else 366 else
366 { 367 {
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
index 7484cae94e..1833639cf0 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
@@ -287,6 +287,7 @@ void lcd_enable(bool state)
287 287
288 lcd_on = true; 288 lcd_on = true;
289 lcd_update(); 289 lcd_update();
290 lcd_call_enable_hook();
290 } 291 }
291 else 292 else
292 { 293 {
diff --git a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
index acdb2c9956..9f8f580802 100644
--- a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
@@ -436,6 +436,7 @@ void lcd_enable(bool on)
436 DEV_EN |= DEV_LCD; /* Enable LCD controller */ 436 DEV_EN |= DEV_LCD; /* Enable LCD controller */
437 lcd_display_on(); /* Turn on display */ 437 lcd_display_on(); /* Turn on display */
438 lcd_update(); /* Resync display */ 438 lcd_update(); /* Resync display */
439 lcd_call_enable_hook();
439 LCD_REG_6 |= 1; /* Restart DMA */ 440 LCD_REG_6 |= 1; /* Restart DMA */
440 sleep(HZ/50); /* Wait for a frame to be written */ 441 sleep(HZ/50); /* Wait for a frame to be written */
441 } 442 }
diff --git a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
index 8a268db4cc..062b178a05 100644
--- a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
+++ b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
@@ -212,6 +212,7 @@ void lcd_enable(bool on)
212 lcd_display_on(); 212 lcd_display_on();
213 LCDC_CTRL |= 1; /* controller enable */ 213 LCDC_CTRL |= 1; /* controller enable */
214 lcd_update(); /* Resync display */ 214 lcd_update(); /* Resync display */
215 lcd_call_enable_hook();
215 } 216 }
216 else 217 else
217 { 218 {
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c
index a2634f0de7..b4b76d4241 100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c
+++ b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c
@@ -235,6 +235,7 @@ return;
235 { 235 {
236 lcd_display_on(false); /* Turn on display */ 236 lcd_display_on(false); /* Turn on display */
237 lcd_update(); /* Resync display */ 237 lcd_update(); /* Resync display */
238 lcd_call_enable_hook();
238 } 239 }
239 else 240 else
240 { 241 {
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 19faf0474d..5aecb366ca 100644
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -383,6 +383,7 @@ void lcd_enable(bool on)
383 /* Probably out of sync and we don't wanna pepper the code with 383 /* Probably out of sync and we don't wanna pepper the code with
384 lcd_update() calls for this. */ 384 lcd_update() calls for this. */
385 lcd_update(); 385 lcd_update();
386 lcd_call_enable_hook();
386 } 387 }
387 else 388 else
388 { 389 {
diff --git a/firmware/target/coldfire/iriver/h300/lcd-h300.c b/firmware/target/coldfire/iriver/h300/lcd-h300.c
index 5081366d41..61d0a6cabd 100644
--- a/firmware/target/coldfire/iriver/h300/lcd-h300.c
+++ b/firmware/target/coldfire/iriver/h300/lcd-h300.c
@@ -261,6 +261,7 @@ void lcd_enable(bool on)
261 if(on) 261 if(on)
262 { 262 {
263 _display_on(); 263 _display_on();
264 lcd_call_enable_hook();
264 } 265 }
265 else 266 else
266 { 267 {