Index: apps/plugins/mpegplayer/mpeg_settings.c =================================================================== --- apps/plugins/mpegplayer/mpeg_settings.c (revision 20779) +++ apps/plugins/mpegplayer/mpeg_settings.c (working copy) @@ -205,7 +205,7 @@ NULL}, {TYPE_INT, 0, MPEG_RESUME_NUM_OPTIONS, { .int_p = &settings.resume_options }, "Resume options", NULL}, -#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) +#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) || defined(SANSA_E200V2) {TYPE_INT, 0, INT_MAX, { .int_p = &settings.displayoptions }, "Display options", NULL}, #endif Index: apps/plugins/mpegplayer/mpeg_settings.h =================================================================== --- apps/plugins/mpegplayer/mpeg_settings.h (revision 20779) +++ apps/plugins/mpegplayer/mpeg_settings.h (working copy) @@ -6,7 +6,7 @@ #define SETTINGS_FILENAME "mpegplayer.cfg" #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \ - || defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) + || defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) || defined(SANSA_E200V2) #define MPEG_OPTION_DITHERING_ENABLED 1 #endif Index: apps/plugin.c =================================================================== --- apps/plugin.c (revision 20779) +++ apps/plugin.c (working copy) @@ -128,7 +128,7 @@ lcd_bitmap_transparent, lcd_blit_yuv, #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \ - || defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) + || defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) || defined(SANSA_E200V2) lcd_yuv_set_options, #endif #elif (LCD_DEPTH < 4) && !defined(SIMULATOR) Index: apps/plugin.h =================================================================== --- apps/plugin.h (revision 20779) +++ apps/plugin.h (working copy) @@ -209,7 +209,7 @@ int src_x, int src_y, int stride, int x, int y, int width, int height); #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \ - || defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) + || defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) || defined(SANSA_E200V2) void (*lcd_yuv_set_options)(unsigned options); #endif #elif (LCD_DEPTH < 4) && !defined(SIMULATOR) Index: firmware/SOURCES =================================================================== --- firmware/SOURCES (revision 20779) +++ firmware/SOURCES (working copy) @@ -1109,6 +1109,7 @@ #ifndef SIMULATOR target/arm/as3525/sansa-e200v2/lcd-e200v2.c target/arm/as3525/sansa-e200v2/button-e200v2.c +target/arm/as3525/sansa-e200v2/lcd-as-e200v2.S target/arm/as3525/backlight-e200v2-fuze.c #ifndef BOOTLOADER target/arm/powermgmt-ascodec.c Index: firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c =================================================================== --- firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c (revision 20779) +++ firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c (working copy) @@ -86,6 +86,7 @@ #define R_ENTRY_MODE_HORZ_NORMAL 0x7030 #define R_ENTRY_MODE_HORZ_FLIPPED 0x7000 +#define R_ENTRY_MODE_VIDEO 0x7020 #define R_ENTRY_MODE_VERT 0x7038 #define R_ENTRY_MODE_SOLID_VERT 0x1038 static unsigned short r_entry_mode = R_ENTRY_MODE_HORZ_NORMAL; @@ -357,6 +358,30 @@ /*** update functions ***/ +static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; + +/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ +extern void lcd_write_yuv420_lines(unsigned char const * const src[3], + int width, + int stride); +extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3], + int width, + int stride, + int x_screen, /* To align dither pattern */ + int y_screen); + +void lcd_yuv_set_options(unsigned options) +{ + lcd_yuv_options = options; +} + +static void lcd_window_blit(int xmin, int ymin, int xmax, int ymax) +{ + lcd_write_reg(R_HORIZ_RAM_ADDR_POS, ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); + lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); + lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | (LCD_WIDTH-1 - xmin)); +} + /* Performance function to blit a YUV bitmap directly to the LCD * src_x, src_y, width and height should be even * x, y, width and height have to be within LCD bounds @@ -365,14 +390,58 @@ int src_x, int src_y, int stride, int x, int y, int width, int height) { - (void)src; - (void)src_x; - (void)src_y; - (void)stride; - (void)x; - (void)y; - (void)width; - (void)height; + unsigned char const * yuv_src[3]; + off_t z; + + lcd_busy = true; + + /* Sorry, but width and height must be >= 2 or else */ + width &= ~1; + height >>= 1; + + z = stride*src_y; + yuv_src[0] = src[0] + z + src_x; + yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); + yuv_src[2] = src[2] + (yuv_src[1] - src[1]); + + lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VIDEO); + + if (lcd_yuv_options & LCD_YUV_DITHER) + { + do + { + lcd_window_blit(y, x, y+1, x+width-1); + + /* Start write to GRAM */ + lcd_write_cmd(R_WRITE_DATA_2_GRAM); + + lcd_write_yuv420_lines_odither(yuv_src, width, stride, x, y); + yuv_src[0] += stride << 1; /* Skip down two luma lines */ + yuv_src[1] += stride >> 1; /* Skip down one chroma line */ + yuv_src[2] += stride >> 1; + y+=2; + } + while (--height > 0); + } + else + { + do + { + lcd_window_blit(y, x, y+1, x+width-1); + + /* Start write to GRAM */ + lcd_write_cmd(R_WRITE_DATA_2_GRAM); + + lcd_write_yuv420_lines(yuv_src, width, stride); + yuv_src[0] += stride << 1; /* Skip down two luma lines */ + yuv_src[1] += stride >> 1; /* Skip down one chroma line */ + yuv_src[2] += stride >> 1; + y+=2; + } + while (--height > 0); + } + + lcd_busy = false; } /* Update the display. @@ -458,3 +527,5 @@ lcd_write_data(&data, 1); return true; } + +