summaryrefslogtreecommitdiff
path: root/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/sandisk/sansa-e200/lcd-e200.c')
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/lcd-e200.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
index 3e1f74d7a1..0d3a1a3049 100644
--- a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
@@ -29,6 +29,7 @@
29/* Power and display status */ 29/* Power and display status */
30static bool power_on = false; /* Is the power turned on? */ 30static bool power_on = false; /* Is the power turned on? */
31static bool display_on NOCACHEBSS_ATTR = false; /* Is the display turned on? */ 31static bool display_on NOCACHEBSS_ATTR = false; /* Is the display turned on? */
32static unsigned lcd_yuv_options NOCACHEBSS_ATTR = 0;
32 33
33/* Reverse Flag */ 34/* Reverse Flag */
34#define R_DISP_CONTROL_NORMAL 0x0004 35#define R_DISP_CONTROL_NORMAL 0x0004
@@ -625,11 +626,22 @@ void lcd_blit(const fb_data* data, int x, int by, int width,
625 (void)stride; 626 (void)stride;
626} 627}
627 628
629void lcd_yuv_set_options(unsigned options)
630{
631 lcd_yuv_options = options;
632}
633
628/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ 634/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */
629extern void lcd_write_yuv420_lines(fb_data *dst, 635extern void lcd_write_yuv420_lines(fb_data *dst,
630 unsigned char const * const src[3], 636 unsigned char const * const src[3],
631 int width, 637 int width,
632 int stride); 638 int stride);
639extern void lcd_write_yuv420_lines_odither(fb_data *dst,
640 unsigned char const * const src[3],
641 int width,
642 int stride,
643 int x_screen, /* To align dither pattern */
644 int y_screen);
633/* Performance function to blit a YUV bitmap directly to the LCD */ 645/* Performance function to blit a YUV bitmap directly to the LCD */
634/* For the e200 - show it rotated */ 646/* For the e200 - show it rotated */
635/* So the LCD_WIDTH is now the height */ 647/* So the LCD_WIDTH is now the height */
@@ -647,21 +659,38 @@ void lcd_yuv_blit(unsigned char * const src[3],
647 width &= ~1; 659 width &= ~1;
648 height >>= 1; 660 height >>= 1;
649 661
662 y = LCD_WIDTH - 1 - y;
650 fb_data *dst = (fb_data*)lcd_driver_framebuffer + 663 fb_data *dst = (fb_data*)lcd_driver_framebuffer +
651 x * LCD_WIDTH + (LCD_WIDTH - y) - 1; 664 x * LCD_WIDTH + y;
652 665
653 z = stride*src_y; 666 z = stride*src_y;
654 yuv_src[0] = src[0] + z + src_x; 667 yuv_src[0] = src[0] + z + src_x;
655 yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); 668 yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1);
656 yuv_src[2] = src[2] + (yuv_src[1] - src[1]); 669 yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
657 670
658 do 671 if (lcd_yuv_options & LCD_YUV_DITHER)
672 {
673 do
674 {
675 lcd_write_yuv420_lines_odither(dst, yuv_src, width, stride, y, x);
676 yuv_src[0] += stride << 1; /* Skip down two luma lines */
677 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
678 yuv_src[2] += stride >> 1;
679 dst -= 2;
680 y -= 2;
681 }
682 while (--height > 0);
683 }
684 else
659 { 685 {
660 lcd_write_yuv420_lines(dst, yuv_src, width, stride); 686 do
661 yuv_src[0] += stride << 1; /* Skip down two luma lines */ 687 {
662 yuv_src[1] += stride >> 1; /* Skip down one chroma line */ 688 lcd_write_yuv420_lines(dst, yuv_src, width, stride);
663 yuv_src[2] += stride >> 1; 689 yuv_src[0] += stride << 1; /* Skip down two luma lines */
664 dst -= 2; 690 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
691 yuv_src[2] += stride >> 1;
692 dst -= 2;
693 }
694 while (--height > 0);
665 } 695 }
666 while (--height > 0);
667} 696}