summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-04-04 22:13:53 +0000
committerJens Arnold <amiconn@rockbox.org>2008-04-04 22:13:53 +0000
commit32bd0f8ab1526e32011937a827b6e44476a6743e (patch)
treec0bdfebc167a0b06daba4de23beba31027b0d693 /apps/plugins/lib
parent391377725ea18688aa93c542a3b470df73b88f51 (diff)
downloadrockbox-32bd0f8ab1526e32011937a827b6e44476a6743e.zip
rockbox-32bd0f8ab1526e32011937a827b6e44476a6743e.tar.gz
rockbox-32bd0f8ab1526e32011937a827b6e44476a6743e.tar.bz2
rockbox-32bd0f8ab1526e32011937a827b6e44476a6743e.tar.xz
Greyscale library: Optionally put the greyscale ISR on COP on portalplayertargets (only use with the grey_info structure in IRAM atm\!). This speeds up doom by ~50%, and makes mpegplayer work without stuttering audio on targets using it (measured on iPod 2nd Gen and Mini 2nd Gen). It needs corelocking certain functions in the LCD driver on 1st/2nd Gen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16973 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r--apps/plugins/lib/grey.h6
-rw-r--r--apps/plugins/lib/grey_core.c21
2 files changed, 20 insertions, 7 deletions
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h
index 3f7be44..95dca6b 100644
--- a/apps/plugins/lib/grey.h
+++ b/apps/plugins/lib/grey.h
@@ -45,8 +45,10 @@
#define GREY_INFO_STRUCT_IRAM struct _grey_info _grey_info IBSS_ATTR;
/* Features you can request on library init (ORed together): */
-#define GREY_BUFFERED 0x0001
-#define GREY_RAWMAPPED 0x0002
+#define GREY_BUFFERED 0x0001 /* Use a chunky buffer */
+#define GREY_RAWMAPPED 0x0002 /* No gamma & LCD linearisation */
+#define GREY_ON_COP 0x0004 /* Run ISR on COP (PP targets) */
+ /* TODO: only usable in conjunction with GREY_INFO_STRUCT_IRAM atm */
/* Library initialisation and release */
bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index 20c33a6..1326599 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -495,11 +495,12 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
#endif
plane_size = _GREY_MULUQ(width, height);
-#ifdef CPU_COLDFIRE
- plane_size += (-plane_size) & 0xf; /* All buffers should be line aligned */
+#if defined(CPU_COLDFIRE) /* Buffers should be line aligned */ \
+ || defined(CPU_PP) && (NUM_CORES > 1) /* Buffers must be cache line aligned */
+ plane_size += (-plane_size) & 0xf;
buftaken = (-(long)gbuf) & 0xf;
-#else
- buftaken = (-(long)gbuf) & 3; /* All buffers must be long aligned. */
+#else /* Buffers must be 32 bit aligned. */
+ buftaken = (-(long)gbuf) & 3;
#endif
gbuf += buftaken;
@@ -509,6 +510,10 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
gbuf += plane_size;
buftaken += plane_size;
}
+#if NUM_CORES > 1 /* Values and phases must be uncached when running on COP */
+ if (features & GREY_ON_COP)
+ gbuf = UNCACHED_ADDR(gbuf);
+#endif
_grey_info.values = gbuf;
gbuf += plane_size;
_grey_info.phases = gbuf;
@@ -602,8 +607,14 @@ void grey_show(bool enable)
#ifdef NEED_BOOST
_grey_info.rb->cpu_boost(true);
#endif
+#if NUM_CORES > 1
+ _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE,
+ 1, _timer_isr,
+ (_grey_info.flags & GREY_ON_COP) ? COP : CPU);
+#else
_grey_info.rb->timer_register(1, NULL, TIMER_FREQ / LCD_SCANRATE, 1,
- _timer_isr IF_COP(, CPU));
+ _timer_isr);
+#endif
#endif /* !SIMULATOR */
_grey_info.rb->screen_dump_set_hook(grey_screendump_hook);
}