summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/grey_core.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-03-25 19:57:23 +0000
committerJens Arnold <amiconn@rockbox.org>2008-03-25 19:57:23 +0000
commit1f4bcc86dac8e57aa2fba4e5b3149fbe52ead323 (patch)
treea3862957ba38ea22bfd01504c0389d23cb4b09a9 /apps/plugins/lib/grey_core.c
parent386f77b0521433f55811f5735aa7a7df5c422760 (diff)
downloadrockbox-1f4bcc86dac8e57aa2fba4e5b3149fbe52ead323.tar.gz
rockbox-1f4bcc86dac8e57aa2fba4e5b3149fbe52ead323.zip
Revert accidental tree commit. /me needs a smaller enter key...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16805 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/grey_core.c')
-rw-r--r--apps/plugins/lib/grey_core.c87
1 files changed, 9 insertions, 78 deletions
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index ad8f306dea..caa7af2f25 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -26,8 +26,7 @@
26#include "plugin.h" 26#include "plugin.h"
27#include "grey.h" 27#include "grey.h"
28 28
29#if defined(HAVE_ADJUSTABLE_CPU_FREQ) && \ 29#if defined(CPU_PP) && defined(HAVE_ADJUSTABLE_CPU_FREQ)
30 (defined(CPU_PP) || (CONFIG_LCD == LCD_TL0350A))
31#define NEED_BOOST 30#define NEED_BOOST
32#endif 31#endif
33 32
@@ -144,42 +143,6 @@ static const unsigned char lcdlinear[256] = {
144 203, 206, 209, 212, 215, 219, 222, 226, 143 203, 206, 209, 212, 215, 219, 222, 226,
145 229, 233, 236, 240, 244, 248, 251, 255 144 229, 233, 236, 240, 244, 248, 251, 255
146}; 145};
147#elif CONFIG_LCD == LCD_TL0350A
148/* generic linear curve - not yet measured */
149static const unsigned char lcdlinear[256] = {
150 0, 1, 2, 3, 4, 5, 6, 7,
151 8, 9, 10, 11, 12, 13, 14, 15,
152 16, 17, 18, 19, 20, 21, 22, 23,
153 24, 25, 26, 27, 28, 29, 30, 31,
154 32, 33, 34, 35, 36, 37, 38, 39,
155 40, 41, 42, 43, 44, 45, 46, 47,
156 48, 49, 50, 51, 52, 53, 54, 55,
157 56, 57, 58, 59, 60, 61, 62, 63,
158 64, 65, 66, 67, 68, 69, 70, 71,
159 72, 73, 74, 75, 76, 77, 78, 79,
160 80, 81, 82, 83, 84, 85, 86, 87,
161 88, 89, 90, 91, 92, 93, 94, 95,
162 96, 97, 98, 99, 100, 101, 102, 103,
163 104, 105, 106, 107, 108, 109, 110, 111,
164 112, 113, 114, 115, 116, 117, 118, 119,
165 120, 121, 122, 123, 124, 125, 126, 127,
166 128, 129, 130, 131, 132, 133, 134, 135,
167 136, 137, 138, 139, 140, 141, 142, 143,
168 144, 145, 146, 147, 148, 149, 150, 151,
169 152, 153, 154, 155, 156, 157, 158, 159,
170 160, 161, 162, 163, 164, 165, 166, 167,
171 168, 169, 170, 171, 172, 173, 174, 175,
172 176, 177, 178, 179, 180, 181, 182, 183,
173 184, 185, 186, 187, 188, 189, 190, 191,
174 192, 193, 194, 195, 196, 197, 198, 199,
175 200, 201, 202, 203, 204, 205, 206, 207,
176 208, 209, 210, 211, 212, 213, 214, 215,
177 216, 217, 218, 219, 220, 221, 222, 223,
178 224, 225, 226, 227, 228, 229, 230, 231,
179 232, 233, 234, 235, 236, 237, 238, 239,
180 240, 241, 242, 243, 244, 245, 246, 247,
181 248, 249, 250, 251, 252, 253, 254, 255
182};
183#endif 146#endif
184#else /* SIMULATOR */ 147#else /* SIMULATOR */
185/* undo a (generic) PC display gamma of 2.0 to simulate target behaviour */ 148/* undo a (generic) PC display gamma of 2.0 to simulate target behaviour */
@@ -262,7 +225,7 @@ static unsigned long _grey_get_pixel(int x, int y)
262 int yg = y - _grey_info.y; 225 int yg = y - _grey_info.y;
263#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 226#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
264 int idx = _grey_info.width * yg + xg; 227 int idx = _grey_info.width * yg + xg;
265#else /* vertical packing or vertical interleaved */ 228#else
266 int idx = _grey_info.width * (yg & ~_GREY_BMASK) 229 int idx = _grey_info.width * (yg & ~_GREY_BMASK)
267 + (xg << _GREY_BSHIFT) + (~yg & _GREY_BMASK); 230 + (xg << _GREY_BSHIFT) + (~yg & _GREY_BMASK);
268#endif 231#endif
@@ -280,7 +243,7 @@ static void _timer_isr(void)
280 _grey_info.bx, _grey_info.y, 243 _grey_info.bx, _grey_info.y,
281 _grey_info.bwidth, _grey_info.height, 244 _grey_info.bwidth, _grey_info.height,
282 _grey_info.width); 245 _grey_info.width);
283#else /* vertical packing or vertical interleaved */ 246#else
284 _grey_info.rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases, 247 _grey_info.rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases,
285 _grey_info.x, _grey_info.by, 248 _grey_info.x, _grey_info.by,
286 _grey_info.width, _grey_info.bheight, 249 _grey_info.width, _grey_info.bheight,
@@ -392,8 +355,8 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
392#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 355#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
393 bdim = (width + 7) >> 3; 356 bdim = (width + 7) >> 3;
394 width = bdim << 3; 357 width = bdim << 3;
395#else /* vertical packing or vertical interleaved */ 358#else /* vertical packing */
396#if (LCD_DEPTH == 1) || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) 359#if LCD_DEPTH == 1
397 bdim = (height + 7) >> 3; 360 bdim = (height + 7) >> 3;
398 height = bdim << 3; 361 height = bdim << 3;
399#elif LCD_DEPTH == 2 362#elif LCD_DEPTH == 2
@@ -445,7 +408,7 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
445#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 408#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
446 _grey_info.bx = 0; 409 _grey_info.bx = 0;
447 _grey_info.bwidth = bdim; 410 _grey_info.bwidth = bdim;
448#else /* vertical packing or vertical interleaved */ 411#else
449 _grey_info.by = 0; 412 _grey_info.by = 0;
450 _grey_info.bheight = bdim; 413 _grey_info.bheight = bdim;
451#endif 414#endif
@@ -528,9 +491,6 @@ void grey_show(bool enable)
528 _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr); 491 _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr);
529#elif CONFIG_LCD == LCD_MROBE100 492#elif CONFIG_LCD == LCD_MROBE100
530 _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr); /* not calibrated/tested */ 493 _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr); /* not calibrated/tested */
531#elif CONFIG_LCD == LCD_TL0350A
532 _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 75, 1, _timer_isr); /* verified */
533 /* This is half of the actual frame frequency, but 150Hz is too much */
534#endif /* CONFIG_LCD */ 494#endif /* CONFIG_LCD */
535#endif /* !SIMULATOR */ 495#endif /* !SIMULATOR */
536 _grey_info.rb->screen_dump_set_hook(grey_screendump_hook); 496 _grey_info.rb->screen_dump_set_hook(grey_screendump_hook);
@@ -647,11 +607,8 @@ static void grey_screendump_hook(int fd)
647#elif LCD_DEPTH == 2 607#elif LCD_DEPTH == 2
648 int shift; 608 int shift;
649#endif 609#endif
650#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED 610#endif /* LCD_PIXELFORMAT == VERTICAL_PACKING */
651 unsigned data; 611 unsigned char *lcdptr;
652 int shift;
653#endif /* LCD_PIXELFORMAT */
654 fb_data *lcdptr;
655 unsigned char *clut_entry; 612 unsigned char *clut_entry;
656 unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)]; 613 unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)];
657 614
@@ -703,7 +660,7 @@ static void grey_screendump_hook(int fd)
703 lcdptr++; 660 lcdptr++;
704 } 661 }
705#endif /* LCD_DEPTH */ 662#endif /* LCD_DEPTH */
706#elif LCD_PIXELFORMAT == VERTICAL_PACKING 663#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
707#if LCD_DEPTH == 1 664#if LCD_DEPTH == 1
708 mask = 1 << (y & 7); 665 mask = 1 << (y & 7);
709 lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3); 666 lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
@@ -751,32 +708,6 @@ static void grey_screendump_hook(int fd)
751 lcdptr++; 708 lcdptr++;
752 } 709 }
753#endif /* LCD_DEPTH */ 710#endif /* LCD_DEPTH */
754#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
755#if LCD_DEPTH == 2
756 shift = y & 7;
757 lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
758
759 for (x = 0; x < LCD_WIDTH; x++)
760 {
761 gx = x - _grey_info.x;
762
763 if (((unsigned)gy < (unsigned)_grey_info.height)
764 && ((unsigned)gx < (unsigned)_grey_info.width))
765 {
766 linebuf[x] = BMP_FIXEDCOLORS
767 + _grey_info.values[_GREY_MULUQ(_grey_info.width,
768 gy & ~_GREY_BMASK)
769 + (gx << _GREY_BSHIFT)
770 + (~gy & _GREY_BMASK)];
771 }
772 else
773 {
774 data = (*lcdptr >> shift) & 0x0101;
775 linebuf[x] = ((data >> 7) | data) & 3;
776 }
777 lcdptr++;
778 }
779#endif /* LCD_DEPTH */
780#endif /* LCD_PIXELFORMAT */ 711#endif /* LCD_PIXELFORMAT */
781 712
782 _grey_info.rb->write(fd, linebuf, BMP_LINESIZE); 713 _grey_info.rb->write(fd, linebuf, BMP_LINESIZE);