diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/test_fps.c | 109 |
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; | |||
50 | static int remote_line; | 50 | static int remote_line; |
51 | static int remote_max_line; | 51 | static int remote_max_line; |
52 | #endif | 52 | #endif |
53 | #if LCD_DEPTH < 4 | ||
54 | static unsigned char *gbuf; | ||
55 | static size_t gbuf_size; | ||
56 | #endif | ||
57 | 53 | ||
58 | static void log_init(void) | 54 | static void log_init(void) |
59 | { | 55 | { |
@@ -105,6 +101,8 @@ static void time_main_update(void) | |||
105 | const int part14_y = LCD_HEIGHT/4; /* y-offset for 1/4 update test */ | 101 | const int part14_y = LCD_HEIGHT/4; /* y-offset for 1/4 update test */ |
106 | const int part14_h = LCD_HEIGHT/2; /* y-size for 1/4 update test */ | 102 | const int part14_h = LCD_HEIGHT/2; /* y-size for 1/4 update test */ |
107 | 103 | ||
104 | log_text("Main LCD Update"); | ||
105 | |||
108 | /* Test 1: full LCD update */ | 106 | /* Test 1: full LCD update */ |
109 | frame_count = 0; | 107 | frame_count = 0; |
110 | rb->sleep(0); /* sync to tick */ | 108 | rb->sleep(0); /* sync to tick */ |
@@ -182,6 +180,8 @@ static void time_main_yuv(void) | |||
182 | const int part14_y = YUV_HEIGHT/4; /* y-offset for 1/4 update test */ | 180 | const int part14_y = YUV_HEIGHT/4; /* y-offset for 1/4 update test */ |
183 | const int part14_h = YUV_HEIGHT/2; /* y-size for 1/4 update test */ | 181 | const int part14_h = YUV_HEIGHT/2; /* y-size for 1/4 update test */ |
184 | 182 | ||
183 | log_text("Main LCD YUV"); | ||
184 | |||
185 | rb->memset(ydata, 128, sizeof(ydata)); /* medium grey */ | 185 | rb->memset(ydata, 128, sizeof(ydata)); /* medium grey */ |
186 | 186 | ||
187 | /* Test 1: full LCD update */ | 187 | /* Test 1: full LCD update */ |
@@ -232,6 +232,8 @@ static void time_remote_update(void) | |||
232 | const int part14_y = LCD_REMOTE_HEIGHT/4; /* y-offset for 1/4 update test */ | 232 | const int part14_y = LCD_REMOTE_HEIGHT/4; /* y-offset for 1/4 update test */ |
233 | const int part14_h = LCD_REMOTE_HEIGHT/2; /* y-size for 1/4 update test */ | 233 | const int part14_h = LCD_REMOTE_HEIGHT/2; /* y-size for 1/4 update test */ |
234 | 234 | ||
235 | log_text("Remote LCD Update"); | ||
236 | |||
235 | /* Test 1: full LCD update */ | 237 | /* Test 1: full LCD update */ |
236 | frame_count = 0; | 238 | frame_count = 0; |
237 | rb->sleep(0); /* sync to tick */ | 239 | rb->sleep(0); /* sync to tick */ |
@@ -284,52 +286,67 @@ static void time_greyscale(void) | |||
284 | long time_1, time_2; | 286 | long time_1, time_2; |
285 | int frames_1, frames_2; | 287 | int frames_1, frames_2; |
286 | int fps, load; | 288 | int fps, load; |
289 | size_t gbuf_size; | ||
290 | unsigned char *gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); | ||
287 | 291 | ||
288 | gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); | 292 | #if NUM_CORES > 1 |
289 | if (!grey_init(gbuf, gbuf_size, GREY_ON_COP, | 293 | int i; |
290 | LCD_WIDTH, LCD_HEIGHT, NULL)) | 294 | for (i = 0; i < NUM_CORES; i++) |
291 | { | ||
292 | log_text("greylib: out of memory."); | ||
293 | return; | ||
294 | } | ||
295 | make_grey_rect(LCD_WIDTH, LCD_HEIGHT); | ||
296 | |||
297 | /* Test 1 - greyscale overlay not yet enabled */ | ||
298 | frames_1 = 0; | ||
299 | rb->sleep(0); /* sync to tick */ | ||
300 | time_start = *rb->current_tick; | ||
301 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
302 | { | 295 | { |
303 | grey_ub_gray_bitmap(greydata[0], 0, 0, LCD_WIDTH, LCD_HEIGHT); | 296 | rb->snprintf(str, sizeof(str), "Greyscale (%s)", |
304 | frames_1++; | 297 | (i > 0) ? "COP" : "CPU"); |
305 | } | 298 | log_text(str); |
306 | time_1 = time_end - time_start; | 299 | #else |
307 | 300 | const int i = 0; | |
308 | /* Test 2 - greyscale overlay enabled */ | 301 | log_text("Greyscale library"); |
309 | grey_show(true); | ||
310 | frames_2 = 0; | ||
311 | rb->sleep(0); /* sync to tick */ | ||
312 | time_start = *rb->current_tick; | ||
313 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
314 | { | 302 | { |
315 | grey_ub_gray_bitmap(greydata[0], 0, 0, LCD_WIDTH, LCD_HEIGHT); | 303 | #endif |
316 | frames_2++; | ||
317 | } | ||
318 | time_2 = time_end - time_start; | ||
319 | |||
320 | grey_release(); | ||
321 | fps = calc_tenth_fps(frames_2, time_2); | ||
322 | load = 100 - (100 * frames_2 * time_1) / (frames_1 * time_2); | ||
323 | rb->snprintf(str, sizeof(str), "1/1: %d.%d fps", fps / 10, fps % 10); | ||
324 | log_text(str); | ||
325 | 304 | ||
326 | if (load > 0 && load < 100) | 305 | if (!grey_init(gbuf, gbuf_size, (i > 0) ? GREY_ON_COP : 0, |
327 | { | 306 | LCD_WIDTH, LCD_HEIGHT, NULL)) |
328 | rb->snprintf(str, sizeof(str), "CPU load: %d%%", load); | 307 | { |
308 | log_text("greylib: out of memory."); | ||
309 | return; | ||
310 | } | ||
311 | make_grey_rect(LCD_WIDTH, LCD_HEIGHT); | ||
312 | |||
313 | /* Test 1 - greyscale overlay not yet enabled */ | ||
314 | frames_1 = 0; | ||
315 | rb->sleep(0); /* sync to tick */ | ||
316 | time_start = *rb->current_tick; | ||
317 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
318 | { | ||
319 | grey_ub_gray_bitmap(greydata[0], 0, 0, LCD_WIDTH, LCD_HEIGHT); | ||
320 | frames_1++; | ||
321 | } | ||
322 | time_1 = time_end - time_start; | ||
323 | |||
324 | /* Test 2 - greyscale overlay enabled */ | ||
325 | grey_show(true); | ||
326 | frames_2 = 0; | ||
327 | rb->sleep(0); /* sync to tick */ | ||
328 | time_start = *rb->current_tick; | ||
329 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
330 | { | ||
331 | grey_ub_gray_bitmap(greydata[0], 0, 0, LCD_WIDTH, LCD_HEIGHT); | ||
332 | frames_2++; | ||
333 | } | ||
334 | time_2 = time_end - time_start; | ||
335 | |||
336 | grey_release(); | ||
337 | fps = calc_tenth_fps(frames_2, time_2); | ||
338 | load = 100 - (100 * frames_2 * time_1) / (frames_1 * time_2); | ||
339 | rb->snprintf(str, sizeof(str), "1/1: %d.%d fps", fps / 10, fps % 10); | ||
329 | log_text(str); | 340 | log_text(str); |
341 | |||
342 | if (load > 0 && load < 100) | ||
343 | { | ||
344 | rb->snprintf(str, sizeof(str), "CPU load: %d%%", load); | ||
345 | log_text(str); | ||
346 | } | ||
347 | else | ||
348 | log_text("CPU load err (boost?)"); | ||
330 | } | 349 | } |
331 | else | ||
332 | log_text("CPU load err (boost?)"); | ||
333 | } | 350 | } |
334 | #endif | 351 | #endif |
335 | 352 | ||
@@ -350,18 +367,14 @@ enum plugin_status plugin_start(const void* parameter) | |||
350 | #endif | 367 | #endif |
351 | backlight_force_on(); /* backlight control in lib/helper.c */ | 368 | backlight_force_on(); /* backlight control in lib/helper.c */ |
352 | 369 | ||
353 | log_text("Main LCD Update"); | ||
354 | time_main_update(); | 370 | time_main_update(); |
355 | #if defined(HAVE_LCD_COLOR) && (MEMORYSIZE > 2) | 371 | #if defined(HAVE_LCD_COLOR) && (MEMORYSIZE > 2) |
356 | log_text("Main LCD YUV"); | ||
357 | time_main_yuv(); | 372 | time_main_yuv(); |
358 | #endif | 373 | #endif |
359 | #if LCD_DEPTH < 4 | 374 | #if LCD_DEPTH < 4 |
360 | log_text("Greyscale library"); | ||
361 | time_greyscale(); | 375 | time_greyscale(); |
362 | #endif | 376 | #endif |
363 | #ifdef HAVE_REMOTE_LCD | 377 | #ifdef HAVE_REMOTE_LCD |
364 | log_text("Remote LCD Update"); | ||
365 | time_remote_update(); | 378 | time_remote_update(); |
366 | #endif | 379 | #endif |
367 | 380 | ||