diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-12-16 23:40:39 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-12-16 23:40:39 +0000 |
commit | 95e6043d5e256df72c20db39c3be59a3ba977b19 (patch) | |
tree | 20a86cd626c43e92436459b6a408c4a13f4c21ef /firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c | |
parent | 13b2f5381310bc4e58d34f8dac0c8b9bdbd736d2 (diff) | |
download | rockbox-95e6043d5e256df72c20db39c3be59a3ba977b19.tar.gz rockbox-95e6043d5e256df72c20db39c3be59a3ba977b19.zip |
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
Diffstat (limited to 'firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c')
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c | 87 |
1 files changed, 5 insertions, 82 deletions
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c index 140e448630..8edc4b7758 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/lcd-fuzeplus.c | |||
@@ -29,18 +29,14 @@ | |||
29 | #include "pinctrl-imx233.h" | 29 | #include "pinctrl-imx233.h" |
30 | #include "logf.h" | 30 | #include "logf.h" |
31 | 31 | ||
32 | extern bool lcd_on; /* lcd-memframe.c */ | ||
33 | |||
32 | /* Copies a rectangle from one framebuffer to another. Can be used in | 34 | /* Copies a rectangle from one framebuffer to another. Can be used in |
33 | single transfer mode with width = num pixels, and height = 1 which | 35 | single transfer mode with width = num pixels, and height = 1 which |
34 | allows a full-width rectangle to be copied more efficiently. */ | 36 | allows a full-width rectangle to be copied more efficiently. */ |
35 | extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, | 37 | extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, |
36 | int width, int height); | 38 | int width, int height); |
37 | 39 | ||
38 | static unsigned lcd_yuv_options = 0; | ||
39 | |||
40 | #ifdef HAVE_LCD_ENABLE | ||
41 | static bool lcd_on = true; | ||
42 | #endif | ||
43 | |||
44 | static enum lcd_kind_t | 40 | static enum lcd_kind_t |
45 | { | 41 | { |
46 | LCD_KIND_7783 = 0x7783, | 42 | LCD_KIND_7783 = 0x7783, |
@@ -386,6 +382,8 @@ void lcd_init_device(void) | |||
386 | lcd_kind = LCD_KIND_7783; | 382 | lcd_kind = LCD_KIND_7783; |
387 | lcd_init_seq_7783(); break; | 383 | lcd_init_seq_7783(); break; |
388 | } | 384 | } |
385 | |||
386 | lcd_on = true; | ||
389 | } | 387 | } |
390 | 388 | ||
391 | #ifdef HAVE_LCD_ENABLE | 389 | #ifdef HAVE_LCD_ENABLE |
@@ -469,6 +467,7 @@ void lcd_enable(bool enable) | |||
469 | { | 467 | { |
470 | if(lcd_on == enable) | 468 | if(lcd_on == enable) |
471 | return; | 469 | return; |
470 | |||
472 | lcd_on = enable; | 471 | lcd_on = enable; |
473 | 472 | ||
474 | if(enable) | 473 | if(enable) |
@@ -482,11 +481,6 @@ void lcd_enable(bool enable) | |||
482 | if(!enable) | 481 | if(!enable) |
483 | common_lcd_enable(false); | 482 | common_lcd_enable(false); |
484 | } | 483 | } |
485 | |||
486 | bool lcd_active(void) | ||
487 | { | ||
488 | return lcd_on; | ||
489 | } | ||
490 | #endif | 484 | #endif |
491 | 485 | ||
492 | void lcd_update(void) | 486 | void lcd_update(void) |
@@ -520,74 +514,3 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
520 | (void) height; | 514 | (void) height; |
521 | lcd_update(); | 515 | lcd_update(); |
522 | } | 516 | } |
523 | |||
524 | void lcd_yuv_set_options(unsigned options) | ||
525 | { | ||
526 | lcd_yuv_options = options; | ||
527 | } | ||
528 | |||
529 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ | ||
530 | extern void lcd_write_yuv420_lines(fb_data *dst, | ||
531 | unsigned char const * const src[3], | ||
532 | int width, | ||
533 | int stride); | ||
534 | extern void lcd_write_yuv420_lines_odither(fb_data *dst, | ||
535 | unsigned char const * const src[3], | ||
536 | int width, | ||
537 | int stride, | ||
538 | int x_screen, /* To align dither pattern */ | ||
539 | int y_screen); | ||
540 | /* Performance function to blit a YUV bitmap directly to the LCD */ | ||
541 | /* So the LCD_WIDTH is now the height */ | ||
542 | void lcd_blit_yuv(unsigned char * const src[3], | ||
543 | int src_x, int src_y, int stride, | ||
544 | int x, int y, int width, int height) | ||
545 | { | ||
546 | /* Caches for chroma data so it only need be recaculated every other | ||
547 | line */ | ||
548 | unsigned char const * yuv_src[3]; | ||
549 | off_t z; | ||
550 | |||
551 | #ifdef HAVE_LCD_ENABLE | ||
552 | if (!lcd_on) | ||
553 | return; | ||
554 | #endif | ||
555 | |||
556 | /* Sorry, but width and height must be >= 2 or else */ | ||
557 | width &= ~1; | ||
558 | height >>= 1; | ||
559 | |||
560 | y = LCD_WIDTH - 1 - y; | ||
561 | fb_data *dst = (fb_data*)FRAME + x * LCD_WIDTH + y; | ||
562 | |||
563 | z = stride*src_y; | ||
564 | yuv_src[0] = src[0] + z + src_x; | ||
565 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | ||
566 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | ||
567 | |||
568 | if (lcd_yuv_options & LCD_YUV_DITHER) | ||
569 | { | ||
570 | do | ||
571 | { | ||
572 | lcd_write_yuv420_lines_odither(dst, yuv_src, width, stride, y, x); | ||
573 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | ||
574 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | ||
575 | yuv_src[2] += stride >> 1; | ||
576 | dst -= 2; | ||
577 | y -= 2; | ||
578 | } | ||
579 | while (--height > 0); | ||
580 | } | ||
581 | else | ||
582 | { | ||
583 | do | ||
584 | { | ||
585 | lcd_write_yuv420_lines(dst, yuv_src, width, stride); | ||
586 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | ||
587 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | ||
588 | yuv_src[2] += stride >> 1; | ||
589 | dst -= 2; | ||
590 | } | ||
591 | while (--height > 0); | ||
592 | } | ||
593 | } | ||