summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2009-04-01 05:17:20 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2009-04-01 05:17:20 +0000
commit8580674b10072b43531660652ff8103c6a980157 (patch)
tree111f6e9278413372812061c8c9f6bd3edf12d572
parentf047e3aee92a929cbfd6ff0faf12d82c3b468844 (diff)
downloadrockbox-8580674b10072b43531660652ff8103c6a980157.zip
rockbox-8580674b10072b43531660652ff8103c6a980157.tar.gz
rockbox-8580674b10072b43531660652ff8103c6a980157.tar.bz2
rockbox-8580674b10072b43531660652ff8103c6a980157.tar.xz
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.c4
-rw-r--r--apps/plugin.h4
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c15
-rw-r--r--firmware/export/config-mrobe500.h2
-rw-r--r--firmware/export/lcd.h7
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c31
6 files changed, 58 insertions, 5 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index b909a55..2126641 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -633,6 +633,10 @@ static const struct plugin_api rockbox_api = {
appsversion,
/* new stuff at the end, sort into place next time
the API gets incompatible */
+
+#if defined(HAVE_LCD_MODES)
+ lcd_set_mode,
+#endif
};
int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 06d8aba..8954373 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -791,6 +791,10 @@ struct plugin_api {
const char *appsversion;
/* new stuff at the end, sort into place next time
the API gets incompatible */
+
+#if defined(HAVE_LCD_MODES)
+ void (*lcd_set_mode)(int mode);
+#endif
};
/* plugin header */
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 82ebfb1..055c1b2 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -1459,6 +1459,10 @@ static void button_loop(void)
rb->lcd_clear_display();
rb->lcd_update();
+#if (HAVE_LCD_MODES & LCD_MODE_YUV)
+ rb->lcd_set_mode(LCD_MODE_YUV);
+#endif
+
wvs_init();
/* Start playback at the specified starting time */
@@ -1537,6 +1541,10 @@ static void button_loop(void)
stream_show_vo(false);
wvs_backlight_brightness_video_mode(false);
+#if (HAVE_LCD_MODES & LCD_MODE_YUV)
+ rb->lcd_set_mode(LCD_MODE_RGB565);
+#endif
+
result = mpeg_menu(0);
/* The menu can change the font, so restore */
@@ -1549,6 +1557,9 @@ static void button_loop(void)
break;
default:
+#if (HAVE_LCD_MODES & LCD_MODE_YUV)
+ rb->lcd_set_mode(LCD_MODE_YUV);
+#endif
/* If not stopped, show video again */
if (state != STREAM_STOPPED) {
wvs_show(WVS_SHOW);
@@ -1707,6 +1718,10 @@ enum plugin_status plugin_start(const void* parameter)
rb->splashf(HZ*2, errstring, err);
}
}
+
+#if (HAVE_LCD_MODES & LCD_MODE_YUV)
+ rb->lcd_set_mode(LCD_MODE_RGB565);
+#endif
stream_exit();
diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h
index 25699bd..08f8ba0 100644
--- a/firmware/export/config-mrobe500.h
+++ b/firmware/export/config-mrobe500.h
@@ -44,6 +44,8 @@
/* define this if you want album art for this target */
//#define HAVE_ALBUMART
+#define HAVE_LCD_MODES LCD_MODE_RGB565 | LCD_MODE_YUV | LCD_MODE_PAL256
+
/* define this if you have access to the quickscreen */
#define HAVE_QUICKSCREEN
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index e34fac5..4f35927 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -92,6 +92,13 @@ typedef unsigned long fb_data;
typedef unsigned char fb_data;
#endif
+#if defined(HAVE_LCD_MODES)
+void lcd_set_mode(int mode);
+#define LCD_MODE_RGB565 0x00000001
+#define LCD_MODE_YUV 0x00000002
+#define LCD_MODE_PAL256 0x00000004
+#endif
+
/* common functions */
extern void lcd_write_command(int byte);
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 0357b46..3fa8a7e 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)
{
if (!lcd_on)
return;
+
#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
lcd_copy_buffer_rect((fb_data *)FRAME, &lcd_framebuffer[0][0],
LCD_WIDTH*LCD_HEIGHT, 1);
@@ -264,6 +265,30 @@ void lcd_update(void)
#endif
}
+#if defined(HAVE_LCD_MODES)
+void lcd_set_mode(int mode)
+{
+ if(mode==LCD_MODE_YUV)
+ {
+ /* Turn off the RGB buffer and enable the YUV buffer */
+ IO_OSD_OSDWINMD0&=~(0x01);
+ IO_OSD_VIDWINMD|=0x01;
+ memset16(FRAME, 0x0080, LCD_WIDTH*LCD_HEIGHT);
+ }
+ else if(mode==LCD_MODE_RGB565)
+ {
+ /* Turn on the RGB window and the YUV window off (This should probably be
+ * made into a function).
+ */
+ IO_OSD_OSDWINMD0|=0x01;
+ IO_OSD_VIDWINMD&=~(0x01);
+ }
+ else if(mode==LCD_MODE_PAL256)
+ {
+ }
+}
+#endif
+
void lcd_blit_yuv(unsigned char * const src[3],
int src_x, int src_y, int stride,
int x, int y, int width,
@@ -280,13 +305,9 @@ void lcd_blit_yuv(unsigned char * const src[3],
unsigned char const * yuv_src[3];
off_t z;
- /* Turn off the RGB buffer and enable the YUV buffer */
- IO_OSD_OSDWINMD0&=~(0x01);
- IO_OSD_VIDWINMD|=0x01;
-
if (!lcd_on)
return;
-
+
/* y has to be at multiple of 2 or else it will mess up the HW (interleaving) */
y &= ~1;