From 95e6043d5e256df72c20db39c3be59a3ba977b19 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 16 Dec 2011 23:40:39 +0000 Subject: Convert remaining memframe LCDs that can be convert to common code. Massage the way it interfaces a bit to make things more flexible. The chroma_buf scheme on Sansa Connect and Creative ZVx calling the lcd_write_yuv420_lines implementation in lcd-as-memframe.S with five params with a chroma buffer that the function can't use wouldn't work anyway so just have them use the stock implementation (really, how was that working?). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31335 a1c6a512-1295-4272-9138-f99709370657 --- .../tms320dm320/sansa-connect/lcd-sansaconnect.c | 111 +-------------------- 1 file changed, 4 insertions(+), 107 deletions(-) (limited to 'firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c') diff --git a/firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c index 308b4297c2..ad417663fe 100644 --- a/firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c +++ b/firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c @@ -30,18 +30,7 @@ #include "lcd-target.h" #include "avr-sansaconnect.h" -/* Copies a rectangle from one framebuffer to another. Can be used in - single transfer mode with width = num pixels, and height = 1 which - allows a full-width rectangle to be copied more efficiently. */ -extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, - int width, int height); - -static bool lcd_on = true; - -bool lcd_active(void) -{ - return lcd_on; -} +extern bool lcd_on; /* lcd-memframe.c */ #if defined(HAVE_LCD_SLEEP) void lcd_sleep(void) @@ -49,6 +38,7 @@ void lcd_sleep(void) if (lcd_on) { lcd_on = false; + avr_hid_lcm_sleep(); sleep(HZ/20); @@ -67,6 +57,7 @@ void lcd_awake(void) if (!lcd_on) { lcd_on = true; + /* enable video encoder clock */ bitset16(&IO_CLK_MOD1, CLK_MOD1_VENC); @@ -159,56 +150,7 @@ void lcd_init_device(void) /* Enable Video Encoder - RGB666, custom timing */ IO_VID_ENC_VMOD = 0x2011; avr_hid_lcm_wake(); -} - -/* Update a fraction of the display. */ -void lcd_update_rect(int x, int y, int width, int height) - __attribute__ ((section(".icode"))); -void lcd_update_rect(int x, int y, int width, int height) -{ - register fb_data *dst, *src; - - if (!lcd_on) - return; - - if ((width | height) < 0) - return; /* Nothing left to do */ - - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; /* Clip right */ - if (x < 0) - width += x, x = 0; /* Clip left */ - - if (y + height > LCD_HEIGHT) - height = LCD_HEIGHT - y; /* Clip bottom */ - if (y < 0) - height += y, y = 0; /* Clip top */ - - dst = FRAME + LCD_WIDTH*y + x; - src = &lcd_framebuffer[y][x]; - - /* Copy part of the Rockbox framebuffer to the second framebuffer */ - if (width < LCD_WIDTH) - { - /* Not full width - do line-by-line */ - lcd_copy_buffer_rect(dst, src, width, height); - } - else - { - /* Full width - copy as one line */ - lcd_copy_buffer_rect(dst, src, LCD_WIDTH*height, 1); - } -} - -/* Update the display. - This must be called after all other LCD functions that change the display. */ -void lcd_update(void) __attribute__ ((section(".icode"))); -void lcd_update(void) -{ - if (!lcd_on) - return; - - lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); + lcd_on = true; } void lcd_set_contrast(int val) { @@ -225,48 +167,3 @@ void lcd_set_flip(bool yesno) { (void) yesno; // TODO: } - -/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ -extern void lcd_write_yuv420_lines(fb_data *dst, - unsigned char chroma_buf[LCD_HEIGHT/2*3], - unsigned char const * const src[3], - int width, int stride); - -/* Performance function to blit a YUV bitmap directly to the LCD */ -void lcd_blit_yuv(unsigned char * const src[3], - int src_x, int src_y, int stride, - int x, int y, int width, int height) -{ - /* Caches for chroma data so it only need be recalculated every other - line */ - unsigned char chroma_buf[LCD_HEIGHT/2*3]; /* 480 bytes */ - unsigned char const * yuv_src[3]; - off_t z; - - if (!lcd_on) - return; - - /* Sorry, but width and height must be >= 2 or else */ - width &= ~1; - height >>= 1; - - fb_data *dst = (fb_data*)FRAME + x * LCD_WIDTH + (LCD_WIDTH - y) - 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]); - - do - { - lcd_write_yuv420_lines(dst, chroma_buf, 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; - dst -= 2; - } - while (--height > 0); -} - -- cgit v1.2.3