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
This commit is contained in:
Karl Kurbjun 2009-04-01 05:17:20 +00:00
parent f047e3aee9
commit 8580674b10
6 changed files with 58 additions and 5 deletions

View file

@ -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)

View file

@ -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 */

View file

@ -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);
@ -1708,6 +1719,10 @@ enum plugin_status plugin_start(const void* parameter)
}
}
#if (HAVE_LCD_MODES & LCD_MODE_YUV)
rb->lcd_set_mode(LCD_MODE_RGB565);
#endif
stream_exit();
rb->talk_disable(false);

View file

@ -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

View file

@ -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);

View file

@ -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,10 +305,6 @@ 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;