diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-04-01 05:17:20 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-04-01 05:17:20 +0000 |
commit | 8580674b10072b43531660652ff8103c6a980157 (patch) | |
tree | 111f6e9278413372812061c8c9f6bd3edf12d572 | |
parent | f047e3aee92a929cbfd6ff0faf12d82c3b468844 (diff) | |
download | rockbox-8580674b10072b43531660652ff8103c6a980157.tar.gz rockbox-8580674b10072b43531660652ff8103c6a980157.zip |
Add initial support for changing the LCD mode in MPEG player for hardware YUV conversion (256 color palette mode will also be added for doom and rockboy). This fixes the LCD mode/colors when MPEGPlayer exits.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20600 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugin.c | 4 | ||||
-rw-r--r-- | apps/plugin.h | 4 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 15 | ||||
-rw-r--r-- | firmware/export/config-mrobe500.h | 2 | ||||
-rw-r--r-- | firmware/export/lcd.h | 7 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 31 |
6 files changed, 58 insertions, 5 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index b909a55f46..2126641572 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -633,6 +633,10 @@ static const struct plugin_api rockbox_api = { | |||
633 | appsversion, | 633 | appsversion, |
634 | /* new stuff at the end, sort into place next time | 634 | /* new stuff at the end, sort into place next time |
635 | the API gets incompatible */ | 635 | the API gets incompatible */ |
636 | |||
637 | #if defined(HAVE_LCD_MODES) | ||
638 | lcd_set_mode, | ||
639 | #endif | ||
636 | }; | 640 | }; |
637 | 641 | ||
638 | int plugin_load(const char* plugin, const void* parameter) | 642 | int plugin_load(const char* plugin, const void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index 06d8abaaee..8954373d23 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -791,6 +791,10 @@ struct plugin_api { | |||
791 | const char *appsversion; | 791 | const char *appsversion; |
792 | /* new stuff at the end, sort into place next time | 792 | /* new stuff at the end, sort into place next time |
793 | the API gets incompatible */ | 793 | the API gets incompatible */ |
794 | |||
795 | #if defined(HAVE_LCD_MODES) | ||
796 | void (*lcd_set_mode)(int mode); | ||
797 | #endif | ||
794 | }; | 798 | }; |
795 | 799 | ||
796 | /* plugin header */ | 800 | /* plugin header */ |
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 82ebfb1111..055c1b2b84 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -1459,6 +1459,10 @@ static void button_loop(void) | |||
1459 | rb->lcd_clear_display(); | 1459 | rb->lcd_clear_display(); |
1460 | rb->lcd_update(); | 1460 | rb->lcd_update(); |
1461 | 1461 | ||
1462 | #if (HAVE_LCD_MODES & LCD_MODE_YUV) | ||
1463 | rb->lcd_set_mode(LCD_MODE_YUV); | ||
1464 | #endif | ||
1465 | |||
1462 | wvs_init(); | 1466 | wvs_init(); |
1463 | 1467 | ||
1464 | /* Start playback at the specified starting time */ | 1468 | /* Start playback at the specified starting time */ |
@@ -1537,6 +1541,10 @@ static void button_loop(void) | |||
1537 | stream_show_vo(false); | 1541 | stream_show_vo(false); |
1538 | wvs_backlight_brightness_video_mode(false); | 1542 | wvs_backlight_brightness_video_mode(false); |
1539 | 1543 | ||
1544 | #if (HAVE_LCD_MODES & LCD_MODE_YUV) | ||
1545 | rb->lcd_set_mode(LCD_MODE_RGB565); | ||
1546 | #endif | ||
1547 | |||
1540 | result = mpeg_menu(0); | 1548 | result = mpeg_menu(0); |
1541 | 1549 | ||
1542 | /* The menu can change the font, so restore */ | 1550 | /* The menu can change the font, so restore */ |
@@ -1549,6 +1557,9 @@ static void button_loop(void) | |||
1549 | break; | 1557 | break; |
1550 | 1558 | ||
1551 | default: | 1559 | default: |
1560 | #if (HAVE_LCD_MODES & LCD_MODE_YUV) | ||
1561 | rb->lcd_set_mode(LCD_MODE_YUV); | ||
1562 | #endif | ||
1552 | /* If not stopped, show video again */ | 1563 | /* If not stopped, show video again */ |
1553 | if (state != STREAM_STOPPED) { | 1564 | if (state != STREAM_STOPPED) { |
1554 | wvs_show(WVS_SHOW); | 1565 | wvs_show(WVS_SHOW); |
@@ -1707,6 +1718,10 @@ enum plugin_status plugin_start(const void* parameter) | |||
1707 | rb->splashf(HZ*2, errstring, err); | 1718 | rb->splashf(HZ*2, errstring, err); |
1708 | } | 1719 | } |
1709 | } | 1720 | } |
1721 | |||
1722 | #if (HAVE_LCD_MODES & LCD_MODE_YUV) | ||
1723 | rb->lcd_set_mode(LCD_MODE_RGB565); | ||
1724 | #endif | ||
1710 | 1725 | ||
1711 | stream_exit(); | 1726 | stream_exit(); |
1712 | 1727 | ||
diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h index 25699bd005..08f8ba07e8 100644 --- a/firmware/export/config-mrobe500.h +++ b/firmware/export/config-mrobe500.h | |||
@@ -44,6 +44,8 @@ | |||
44 | /* define this if you want album art for this target */ | 44 | /* define this if you want album art for this target */ |
45 | //#define HAVE_ALBUMART | 45 | //#define HAVE_ALBUMART |
46 | 46 | ||
47 | #define HAVE_LCD_MODES LCD_MODE_RGB565 | LCD_MODE_YUV | LCD_MODE_PAL256 | ||
48 | |||
47 | /* define this if you have access to the quickscreen */ | 49 | /* define this if you have access to the quickscreen */ |
48 | #define HAVE_QUICKSCREEN | 50 | #define HAVE_QUICKSCREEN |
49 | 51 | ||
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index e34fac5d31..4f35927353 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -92,6 +92,13 @@ typedef unsigned long fb_data; | |||
92 | typedef unsigned char fb_data; | 92 | typedef unsigned char fb_data; |
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | #if defined(HAVE_LCD_MODES) | ||
96 | void lcd_set_mode(int mode); | ||
97 | #define LCD_MODE_RGB565 0x00000001 | ||
98 | #define LCD_MODE_YUV 0x00000002 | ||
99 | #define LCD_MODE_PAL256 0x00000004 | ||
100 | #endif | ||
101 | |||
95 | /* common functions */ | 102 | /* common functions */ |
96 | extern void lcd_write_command(int byte); | 103 | extern void lcd_write_command(int byte); |
97 | extern void lcd_write_command_e(int cmd, int data); | 104 | extern void lcd_write_command_e(int cmd, int data); |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index 0357b469d9..3fa8a7e6c1 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | |||
@@ -256,6 +256,7 @@ void lcd_update(void) | |||
256 | { | 256 | { |
257 | if (!lcd_on) | 257 | if (!lcd_on) |
258 | return; | 258 | return; |
259 | |||
259 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT | 260 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT |
260 | lcd_copy_buffer_rect((fb_data *)FRAME, &lcd_framebuffer[0][0], | 261 | lcd_copy_buffer_rect((fb_data *)FRAME, &lcd_framebuffer[0][0], |
261 | LCD_WIDTH*LCD_HEIGHT, 1); | 262 | LCD_WIDTH*LCD_HEIGHT, 1); |
@@ -264,6 +265,30 @@ void lcd_update(void) | |||
264 | #endif | 265 | #endif |
265 | } | 266 | } |
266 | 267 | ||
268 | #if defined(HAVE_LCD_MODES) | ||
269 | void lcd_set_mode(int mode) | ||
270 | { | ||
271 | if(mode==LCD_MODE_YUV) | ||
272 | { | ||
273 | /* Turn off the RGB buffer and enable the YUV buffer */ | ||
274 | IO_OSD_OSDWINMD0&=~(0x01); | ||
275 | IO_OSD_VIDWINMD|=0x01; | ||
276 | memset16(FRAME, 0x0080, LCD_WIDTH*LCD_HEIGHT); | ||
277 | } | ||
278 | else if(mode==LCD_MODE_RGB565) | ||
279 | { | ||
280 | /* Turn on the RGB window and the YUV window off (This should probably be | ||
281 | * made into a function). | ||
282 | */ | ||
283 | IO_OSD_OSDWINMD0|=0x01; | ||
284 | IO_OSD_VIDWINMD&=~(0x01); | ||
285 | } | ||
286 | else if(mode==LCD_MODE_PAL256) | ||
287 | { | ||
288 | } | ||
289 | } | ||
290 | #endif | ||
291 | |||
267 | void lcd_blit_yuv(unsigned char * const src[3], | 292 | void lcd_blit_yuv(unsigned char * const src[3], |
268 | int src_x, int src_y, int stride, | 293 | int src_x, int src_y, int stride, |
269 | int x, int y, int width, | 294 | int x, int y, int width, |
@@ -280,13 +305,9 @@ void lcd_blit_yuv(unsigned char * const src[3], | |||
280 | unsigned char const * yuv_src[3]; | 305 | unsigned char const * yuv_src[3]; |
281 | off_t z; | 306 | off_t z; |
282 | 307 | ||
283 | /* Turn off the RGB buffer and enable the YUV buffer */ | ||
284 | IO_OSD_OSDWINMD0&=~(0x01); | ||
285 | IO_OSD_VIDWINMD|=0x01; | ||
286 | |||
287 | if (!lcd_on) | 308 | if (!lcd_on) |
288 | return; | 309 | return; |
289 | 310 | ||
290 | /* y has to be at multiple of 2 or else it will mess up the HW (interleaving) */ | 311 | /* y has to be at multiple of 2 or else it will mess up the HW (interleaving) */ |
291 | y &= ~1; | 312 | y &= ~1; |
292 | 313 | ||