summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2010-10-03 11:57:47 +0000
committerJens Arnold <amiconn@rockbox.org>2010-10-03 11:57:47 +0000
commit3e9f797f6e3676e537a82308ef3b3509006346bd (patch)
tree4daa694e17214e301decb5deb82f254335afb878
parente4bd9e3774bb345e0458f5362ee6b1783e7056e2 (diff)
downloadrockbox-3e9f797f6e3676e537a82308ef3b3509006346bd.tar.gz
rockbox-3e9f797f6e3676e537a82308ef3b3509006346bd.zip
Make test_fps test the greylib on both cores of dual core targets.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28202 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/test_fps.c109
1 files changed, 61 insertions, 48 deletions
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c
index c03adc49a6..4f197e0d5b 100644
--- a/apps/plugins/test_fps.c
+++ b/apps/plugins/test_fps.c
@@ -50,10 +50,6 @@ static int max_line;
static int remote_line;
static int remote_max_line;
#endif
-#if LCD_DEPTH < 4
-static unsigned char *gbuf;
-static size_t gbuf_size;
-#endif
static void log_init(void)
{
@@ -105,6 +101,8 @@ static void time_main_update(void)
const int part14_y = LCD_HEIGHT/4; /* y-offset for 1/4 update test */
const int part14_h = LCD_HEIGHT/2; /* y-size for 1/4 update test */
+ log_text("Main LCD Update");
+
/* Test 1: full LCD update */
frame_count = 0;
rb->sleep(0); /* sync to tick */
@@ -182,6 +180,8 @@ static void time_main_yuv(void)
const int part14_y = YUV_HEIGHT/4; /* y-offset for 1/4 update test */
const int part14_h = YUV_HEIGHT/2; /* y-size for 1/4 update test */
+ log_text("Main LCD YUV");
+
rb->memset(ydata, 128, sizeof(ydata)); /* medium grey */
/* Test 1: full LCD update */
@@ -232,6 +232,8 @@ static void time_remote_update(void)
const int part14_y = LCD_REMOTE_HEIGHT/4; /* y-offset for 1/4 update test */
const int part14_h = LCD_REMOTE_HEIGHT/2; /* y-size for 1/4 update test */
+ log_text("Remote LCD Update");
+
/* Test 1: full LCD update */
frame_count = 0;
rb->sleep(0); /* sync to tick */
@@ -284,52 +286,67 @@ static void time_greyscale(void)
long time_1, time_2;
int frames_1, frames_2;
int fps, load;
+ size_t gbuf_size;
+ unsigned char *gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
- gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
- if (!grey_init(gbuf, gbuf_size, GREY_ON_COP,
- LCD_WIDTH, LCD_HEIGHT, NULL))
- {
- log_text("greylib: out of memory.");
- return;
- }
- make_grey_rect(LCD_WIDTH, LCD_HEIGHT);
-
- /* Test 1 - greyscale overlay not yet enabled */
- frames_1 = 0;
- rb->sleep(0); /* sync to tick */
- time_start = *rb->current_tick;
- while((time_end = *rb->current_tick) - time_start < DURATION)
+#if NUM_CORES > 1
+ int i;
+ for (i = 0; i < NUM_CORES; i++)
{
- grey_ub_gray_bitmap(greydata[0], 0, 0, LCD_WIDTH, LCD_HEIGHT);
- frames_1++;
- }
- time_1 = time_end - time_start;
-
- /* Test 2 - greyscale overlay enabled */
- grey_show(true);
- frames_2 = 0;
- rb->sleep(0); /* sync to tick */
- time_start = *rb->current_tick;
- while((time_end = *rb->current_tick) - time_start < DURATION)
+ rb->snprintf(str, sizeof(str), "Greyscale (%s)",
+ (i > 0) ? "COP" : "CPU");
+ log_text(str);
+#else
+ const int i = 0;
+ log_text("Greyscale library");
{
- grey_ub_gray_bitmap(greydata[0], 0, 0, LCD_WIDTH, LCD_HEIGHT);
- frames_2++;
- }
- time_2 = time_end - time_start;
-
- grey_release();
- fps = calc_tenth_fps(frames_2, time_2);
- load = 100 - (100 * frames_2 * time_1) / (frames_1 * time_2);
- rb->snprintf(str, sizeof(str), "1/1: %d.%d fps", fps / 10, fps % 10);
- log_text(str);
+#endif
- if (load > 0 && load < 100)
- {
- rb->snprintf(str, sizeof(str), "CPU load: %d%%", load);
+ if (!grey_init(gbuf, gbuf_size, (i > 0) ? GREY_ON_COP : 0,
+ LCD_WIDTH, LCD_HEIGHT, NULL))
+ {
+ log_text("greylib: out of memory.");
+ return;
+ }
+ make_grey_rect(LCD_WIDTH, LCD_HEIGHT);
+
+ /* Test 1 - greyscale overlay not yet enabled */
+ frames_1 = 0;
+ rb->sleep(0); /* sync to tick */
+ time_start = *rb->current_tick;
+ while((time_end = *rb->current_tick) - time_start < DURATION)
+ {
+ grey_ub_gray_bitmap(greydata[0], 0, 0, LCD_WIDTH, LCD_HEIGHT);
+ frames_1++;
+ }
+ time_1 = time_end - time_start;
+
+ /* Test 2 - greyscale overlay enabled */
+ grey_show(true);
+ frames_2 = 0;
+ rb->sleep(0); /* sync to tick */
+ time_start = *rb->current_tick;
+ while((time_end = *rb->current_tick) - time_start < DURATION)
+ {
+ grey_ub_gray_bitmap(greydata[0], 0, 0, LCD_WIDTH, LCD_HEIGHT);
+ frames_2++;
+ }
+ time_2 = time_end - time_start;
+
+ grey_release();
+ fps = calc_tenth_fps(frames_2, time_2);
+ load = 100 - (100 * frames_2 * time_1) / (frames_1 * time_2);
+ rb->snprintf(str, sizeof(str), "1/1: %d.%d fps", fps / 10, fps % 10);
log_text(str);
+
+ if (load > 0 && load < 100)
+ {
+ rb->snprintf(str, sizeof(str), "CPU load: %d%%", load);
+ log_text(str);
+ }
+ else
+ log_text("CPU load err (boost?)");
}
- else
- log_text("CPU load err (boost?)");
}
#endif
@@ -350,18 +367,14 @@ enum plugin_status plugin_start(const void* parameter)
#endif
backlight_force_on(); /* backlight control in lib/helper.c */
- log_text("Main LCD Update");
time_main_update();
#if defined(HAVE_LCD_COLOR) && (MEMORYSIZE > 2)
- log_text("Main LCD YUV");
time_main_yuv();
#endif
#if LCD_DEPTH < 4
- log_text("Greyscale library");
time_greyscale();
#endif
#ifdef HAVE_REMOTE_LCD
- log_text("Remote LCD Update");
time_remote_update();
#endif