diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-09-30 20:10:27 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-09-30 20:10:27 +0000 |
commit | 1a40e109333b8206140594fce746f7972a4d0d86 (patch) | |
tree | a4f0589682ae4f8c894222b7691efebd989d763f /apps/plugins/lib/gray_draw.c | |
parent | 8b9c64f19db3abf8872b8dd85ea8ee1343f322e3 (diff) | |
download | rockbox-1a40e109333b8206140594fce746f7972a4d0d86.tar.gz rockbox-1a40e109333b8206140594fce746f7972a4d0d86.zip |
H1x0: Changed lcd_blit() and the grayscale library to use the same internal format as on archos (1bpp). While the slowdown of the ISR is minimal (the intermediate buffers are in IRAM), the planar grayscale buffer takes only half the space for a given depth, and gray_update[_rect]() and unbuffered drawing/scrolling are faster because less data needs to be moved. It should also make porting of video.rock somewhat easier. * Archos recorders, Ondios: Some slight optimisations of the grayscale library.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7571 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/gray_draw.c')
-rw-r--r-- | apps/plugins/lib/gray_draw.c | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/apps/plugins/lib/gray_draw.c b/apps/plugins/lib/gray_draw.c index ab1b286137..4b2237197c 100644 --- a/apps/plugins/lib/gray_draw.c +++ b/apps/plugins/lib/gray_draw.c | |||
@@ -754,13 +754,13 @@ static void _writearray(unsigned char *address, const unsigned char *src, | |||
754 | _src = src; | 754 | _src = src; |
755 | 755 | ||
756 | /* precalculate the bit patterns with random shifts | 756 | /* precalculate the bit patterns with random shifts |
757 | for all 4 pixels and put them on an extra "stack" */ | 757 | for all 8 pixels and put them on an extra "stack" */ |
758 | asm volatile ( | 758 | asm volatile ( |
759 | "moveq.l #4,%%d3 \n" /* loop count in d3: 4 pixels */ | 759 | "moveq.l #8,%%d3 \n" /* loop count in d3: 4 pixels */ |
760 | 760 | ||
761 | ".wa_loop: \n" /** load pattern for pixel **/ | 761 | ".wa_loop: \n" /** load pattern for pixel **/ |
762 | "clr.l %%d2 \n" /* pattern for skipped pixel must be 0 */ | 762 | "clr.l %%d2 \n" /* pattern for skipped pixel must be 0 */ |
763 | "lsr.l #2,%[mask] \n" /* shift out 2 lsbs of mask */ | 763 | "lsr.l #1,%[mask] \n" /* shift out 2 lsbs of mask */ |
764 | "bcc.b .wa_skip \n" /* skip this pixel */ | 764 | "bcc.b .wa_skip \n" /* skip this pixel */ |
765 | 765 | ||
766 | "clr.l %%d0 \n" | 766 | "clr.l %%d0 \n" |
@@ -816,10 +816,10 @@ static void _writearray(unsigned char *address, const unsigned char *src, | |||
816 | end = addr + MULU16(_gray_info.depth, _gray_info.plane_size); | 816 | end = addr + MULU16(_gray_info.depth, _gray_info.plane_size); |
817 | _mask = mask; | 817 | _mask = mask; |
818 | 818 | ||
819 | /* set the bits for all 4 pixels in all bytes according to the | 819 | /* set the bits for all 8 pixels in all bytes according to the |
820 | * precalculated patterns on the pattern stack */ | 820 | * precalculated patterns on the pattern stack */ |
821 | asm volatile ( | 821 | asm volatile ( |
822 | "movem.l (%[patp]),%%d2-%%d5 \n" /* pop all 4 patterns */ | 822 | "movem.l (%[patp]),%%d2-%%d6/%%a0-%%a2 \n" /* pop all 8 patterns */ |
823 | 823 | ||
824 | "not.l %[mask] \n" /* "set" mask -> "keep" mask */ | 824 | "not.l %[mask] \n" /* "set" mask -> "keep" mask */ |
825 | "and.l #0xFF,%[mask] \n" | 825 | "and.l #0xFF,%[mask] \n" |
@@ -829,18 +829,26 @@ static void _writearray(unsigned char *address, const unsigned char *src, | |||
829 | "clr.l %%d0 \n" | 829 | "clr.l %%d0 \n" |
830 | "lsr.l #1,%%d2 \n" /* shift out mask bit */ | 830 | "lsr.l #1,%%d2 \n" /* shift out mask bit */ |
831 | "addx.l %%d0,%%d0 \n" /* puts bit into LSB, shifts left by 1 */ | 831 | "addx.l %%d0,%%d0 \n" /* puts bit into LSB, shifts left by 1 */ |
832 | "lsl.l #1,%%d0 \n" /* shift by another 1 for a total of 2 */ | ||
833 | "lsr.l #1,%%d3 \n" | 832 | "lsr.l #1,%%d3 \n" |
834 | "addx.l %%d0,%%d0 \n" | 833 | "addx.l %%d0,%%d0 \n" |
835 | "lsl.l #1,%%d0 \n" | ||
836 | "lsr.l #1,%%d4 \n" | 834 | "lsr.l #1,%%d4 \n" |
837 | "addx.l %%d0,%%d0 \n" | 835 | "addx.l %%d0,%%d0 \n" |
838 | "lsl.l #1,%%d0 \n" | ||
839 | "lsr.l #1,%%d5 \n" | 836 | "lsr.l #1,%%d5 \n" |
840 | "addx.l %%d0,%%d0 \n" | 837 | "addx.l %%d0,%%d0 \n" |
841 | "move.l %%d0,%%d1 \n" /* duplicate bits 0, 2, 4, 6, ... */ | 838 | "lsr.l #1,%%d6 \n" |
842 | "lsl.l #1,%%d1 \n" /* to 1, 3, 5, 7, ... */ | 839 | "addx.l %%d0,%%d0 \n" |
843 | "or.l %%d1,%%d0 \n" | 840 | "move.l %%a0,%%d1 \n" |
841 | "lsr.l #1,%%d1 \n" | ||
842 | "addx.l %%d0,%%d0 \n" | ||
843 | "move.l %%d1,%%a0 \n" | ||
844 | "move.l %%a1,%%d1 \n" | ||
845 | "lsr.l #1,%%d1 \n" | ||
846 | "addx.l %%d0,%%d0 \n" | ||
847 | "move.l %%d1,%%a1 \n" | ||
848 | "move.l %%a2,%%d1 \n" | ||
849 | "lsr.l #1,%%d1 \n" | ||
850 | "addx.l %%d0,%%d0 \n" | ||
851 | "move.l %%d1,%%a2 \n" | ||
844 | 852 | ||
845 | "move.b (%[addr]),%%d1 \n" /* read old value */ | 853 | "move.b (%[addr]),%%d1 \n" /* read old value */ |
846 | "and.l %[mask],%%d1 \n" /* mask out unneeded bits */ | 854 | "and.l %[mask],%%d1 \n" /* mask out unneeded bits */ |
@@ -857,18 +865,26 @@ static void _writearray(unsigned char *address, const unsigned char *src, | |||
857 | "clr.l %%d0 \n" | 865 | "clr.l %%d0 \n" |
858 | "lsr.l #1,%%d2 \n" /* shift out mask bit */ | 866 | "lsr.l #1,%%d2 \n" /* shift out mask bit */ |
859 | "addx.l %%d0,%%d0 \n" /* puts bit into LSB, shifts left by 1 */ | 867 | "addx.l %%d0,%%d0 \n" /* puts bit into LSB, shifts left by 1 */ |
860 | "lsl.l #1,%%d0 \n" /* shift by another 1 for a total of 2 */ | ||
861 | "lsr.l #1,%%d3 \n" | 868 | "lsr.l #1,%%d3 \n" |
862 | "addx.l %%d0,%%d0 \n" | 869 | "addx.l %%d0,%%d0 \n" |
863 | "lsl.l #1,%%d0 \n" | ||
864 | "lsr.l #1,%%d4 \n" | 870 | "lsr.l #1,%%d4 \n" |
865 | "addx.l %%d0,%%d0 \n" | 871 | "addx.l %%d0,%%d0 \n" |
866 | "lsl.l #1,%%d0 \n" | ||
867 | "lsr.l #1,%%d5 \n" | 872 | "lsr.l #1,%%d5 \n" |
868 | "addx.l %%d0,%%d0 \n" | 873 | "addx.l %%d0,%%d0 \n" |
869 | "move.l %%d0,%%d1 \n" /* duplicate bits 0, 2, 4, 6, ... */ | 874 | "lsr.l #1,%%d6 \n" |
870 | "lsl.l #1,%%d1 \n" /* to 1, 3, 5, 7, ... */ | 875 | "addx.l %%d0,%%d0 \n" |
871 | "or.l %%d1,%%d0 \n" | 876 | "move.l %%a0,%%d1 \n" |
877 | "lsr.l #1,%%d1 \n" | ||
878 | "addx.l %%d0,%%d0 \n" | ||
879 | "move.l %%d1,%%a0 \n" | ||
880 | "move.l %%a1,%%d1 \n" | ||
881 | "lsr.l #1,%%d1 \n" | ||
882 | "addx.l %%d0,%%d0 \n" | ||
883 | "move.l %%d1,%%a1 \n" | ||
884 | "move.l %%a2,%%d1 \n" | ||
885 | "lsr.l #1,%%d1 \n" | ||
886 | "addx.l %%d0,%%d0 \n" | ||
887 | "move.l %%d1,%%a2 \n" | ||
872 | 888 | ||
873 | "move.b %%d0,(%[addr]) \n" /* store byte to bitplane */ | 889 | "move.b %%d0,(%[addr]) \n" /* store byte to bitplane */ |
874 | "add.l %[psiz],%[addr] \n" /* advance to next bitplane */ | 890 | "add.l %[psiz],%[addr] \n" /* advance to next bitplane */ |
@@ -880,11 +896,11 @@ static void _writearray(unsigned char *address, const unsigned char *src, | |||
880 | [addr]"+a"(addr), | 896 | [addr]"+a"(addr), |
881 | [mask]"+d"(_mask) | 897 | [mask]"+d"(_mask) |
882 | : /* inputs */ | 898 | : /* inputs */ |
883 | [psiz]"r"(_gray_info.plane_size), | 899 | [psiz]"a"(_gray_info.plane_size), |
884 | [end] "a"(end), | 900 | [end] "a"(end), |
885 | [patp]"a"(pat_ptr) | 901 | [patp]"a"(pat_ptr) |
886 | : /* clobbers */ | 902 | : /* clobbers */ |
887 | "d0", "d1", "d2", "d3", "d4", "d5" | 903 | "d0", "d1", "d2", "d3", "d4", "d5", "d6", "a0", "a1", "a2" |
888 | ); | 904 | ); |
889 | #endif | 905 | #endif |
890 | } | 906 | } |
@@ -938,8 +954,8 @@ void gray_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
938 | + MULU16(_gray_info.width, y >> _PBLOCK_EXP); | 954 | + MULU16(_gray_info.width, y >> _PBLOCK_EXP); |
939 | ny = height - 1 + shift; | 955 | ny = height - 1 + shift; |
940 | 956 | ||
941 | mask = 0xFFu << (LCD_DEPTH * shift); | 957 | mask = 0xFFu << shift; |
942 | mask_bottom = 0xFFu >> (LCD_DEPTH * (~ny & (_PBLOCK-1))); | 958 | mask_bottom = 0xFFu >> (~ny & (_PBLOCK-1)); |
943 | 959 | ||
944 | for (; ny >= _PBLOCK; ny -= _PBLOCK) | 960 | for (; ny >= _PBLOCK; ny -= _PBLOCK) |
945 | { | 961 | { |