diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2022-10-13 11:03:53 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2022-10-13 11:08:06 -0400 |
commit | 418169aff8faf2cf90124cd95dba0af821cea73d (patch) | |
tree | 4fc206af57c9a07fba6cbcb3517fa946a7b84668 /firmware/target/arm/tms320dm320 | |
parent | f9ea1fc79d6aaff9949a5b11ae011b4e04e0e9d9 (diff) | |
download | rockbox-418169aff8faf2cf90124cd95dba0af821cea73d.tar.gz rockbox-418169aff8faf2cf90124cd95dba0af821cea73d.zip |
Revert "Remove YUV blitting functions and LCD modes"
This reverts commit fe6aa21e9eb88f49005863efd2003d0982920048.
Change-Id: I8bb1e5d6c52ed1478002d2140ef494ec5d62b8e3
Diffstat (limited to 'firmware/target/arm/tms320dm320')
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 86 |
1 files changed, 85 insertions, 1 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index e851c421a6..8620c672e1 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | |||
@@ -273,7 +273,15 @@ void lcd_init_device(void) | |||
273 | #if defined(HAVE_LCD_MODES) | 273 | #if defined(HAVE_LCD_MODES) |
274 | void lcd_set_mode(int mode) | 274 | void lcd_set_mode(int mode) |
275 | { | 275 | { |
276 | if(mode==LCD_MODE_RGB565) { | 276 | if(mode==LCD_MODE_YUV) { |
277 | /* Turn off the RGB buffer and enable the YUV buffer with zoom */ | ||
278 | IO_OSD_OSDWINMD0 |= 0x04; | ||
279 | IO_OSD_VIDWINMD |= 0x01; | ||
280 | #if LCD_NATIVE_WIDTH > 240 | ||
281 | IO_OSD_VIDWINMD |= (0x05<<2); /* This does a 2x zoom */ | ||
282 | #endif | ||
283 | memset16(FRAME2, 0x0080, LCD_NATIVE_HEIGHT*(LCD_NATIVE_WIDTH+LCD_FUDGE)); | ||
284 | } else if(mode==LCD_MODE_RGB565) { | ||
277 | /* Turn on the RGB window, set it to 16 bit and turn YUV window off */ | 285 | /* Turn on the RGB window, set it to 16 bit and turn YUV window off */ |
278 | IO_OSD_VIDWINMD &= ~(0x01); | 286 | IO_OSD_VIDWINMD &= ~(0x01); |
279 | IO_OSD_OSDWIN0OFST = LCD_NATIVE_WIDTH / 16; | 287 | IO_OSD_OSDWIN0OFST = LCD_NATIVE_WIDTH / 16; |
@@ -636,6 +644,82 @@ void lcd_pal256_update_pal(fb_data *palette) | |||
636 | } | 644 | } |
637 | #endif | 645 | #endif |
638 | 646 | ||
647 | /* Performance function to blit a YUV bitmap directly to the LCD */ | ||
648 | /* Show it rotated so the LCD_WIDTH is now the height */ | ||
649 | void lcd_blit_yuv(unsigned char * const src[3], | ||
650 | int src_x, int src_y, int stride, | ||
651 | int x, int y, int width, int height) | ||
652 | { | ||
653 | unsigned char const * yuv_src[3]; | ||
654 | |||
655 | if (!lcd_on) | ||
656 | return; | ||
657 | |||
658 | /* y has to be on a 16 pixel boundary */ | ||
659 | y &= ~0xF; | ||
660 | |||
661 | if( ((y | x | height | width ) < 0) | ||
662 | || y>LCD_NATIVE_HEIGHT || x>LCD_NATIVE_WIDTH ) | ||
663 | return; | ||
664 | |||
665 | if(y+height>LCD_NATIVE_WIDTH) | ||
666 | { | ||
667 | height=LCD_NATIVE_WIDTH-y; | ||
668 | } | ||
669 | if(x+width>LCD_NATIVE_HEIGHT) | ||
670 | { | ||
671 | width=LCD_NATIVE_HEIGHT-x; | ||
672 | } | ||
673 | |||
674 | /* Sorry, but width and height must be >= 2 or else */ | ||
675 | width &= ~1; | ||
676 | height>>=1; | ||
677 | |||
678 | fb_data * dst = FRAME2 | ||
679 | + ((LCD_NATIVE_WIDTH+LCD_FUDGE)*(LCD_NATIVE_HEIGHT-1)) | ||
680 | - (LCD_NATIVE_WIDTH+LCD_FUDGE)*x + y ; | ||
681 | |||
682 | /* Scope z */ | ||
683 | { | ||
684 | off_t z; | ||
685 | z = stride*src_y; | ||
686 | yuv_src[0] = src[0] + z + src_x; | ||
687 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | ||
688 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | ||
689 | } | ||
690 | |||
691 | int cbcr_remain=(stride>>1)-(width>>1); | ||
692 | int y_remain=(stride<<1)-width; | ||
693 | do | ||
694 | { | ||
695 | register int c_width=width; | ||
696 | register unsigned int *c_dst=(unsigned int*)dst; | ||
697 | do | ||
698 | { | ||
699 | register unsigned short Y=*((unsigned short*)yuv_src[0]); | ||
700 | register unsigned short Yst=*((unsigned short*)(yuv_src[0]+stride)); | ||
701 | yuv_src[0]+=2; | ||
702 | |||
703 | register unsigned char Cb=*yuv_src[1]++; | ||
704 | register unsigned char Cr=*yuv_src[2]++; | ||
705 | |||
706 | *c_dst = (Yst<<24) | (Cr << 16) | ((Y&0xFF)<<8) | Cb; | ||
707 | *(c_dst - (LCD_NATIVE_WIDTH+LCD_FUDGE)/2) = | ||
708 | ( (Yst&0xFF00)<<16) | (Cr << 16) | (Y&0xFF00) | Cb; | ||
709 | |||
710 | c_dst -= (LCD_NATIVE_WIDTH+LCD_FUDGE); | ||
711 | |||
712 | c_width -= 2; | ||
713 | } while (c_width); | ||
714 | |||
715 | yuv_src[0] += y_remain; /* Skip down two luma lines-width */ | ||
716 | yuv_src[1] += cbcr_remain; /* Skip down one chroma line-width/2 */ | ||
717 | yuv_src[2] += cbcr_remain; | ||
718 | |||
719 | dst+=2; | ||
720 | } while (--height); | ||
721 | } | ||
722 | |||
639 | void lcd_set_contrast(int val) { | 723 | void lcd_set_contrast(int val) { |
640 | (void) val; | 724 | (void) val; |
641 | // TODO: | 725 | // TODO: |