summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-07 14:06:26 +0100
committerThomas Martitz <kugel@rockbox.org>2014-01-07 14:13:41 +0100
commit2ef9aa51f34263955bfa1528f6a4fd074b69ec91 (patch)
tree8e1031f6d06923bb8025ffc2968f8070a6475bbb /apps
parent5aa5a923f3cc48a189f690fa47eafac389e8fbe4 (diff)
downloadrockbox-2ef9aa51f34263955bfa1528f6a4fd074b69ec91.tar.gz
rockbox-2ef9aa51f34263955bfa1528f6a4fd074b69ec91.zip
test_gfx: Add benchmark for put_line().
Change-Id: I94cd5cec5ce169a4ddb60fcb3c09e2ffb50a3401
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/test_gfx.c57
1 files changed, 56 insertions, 1 deletions
diff --git a/apps/plugins/test_gfx.c b/apps/plugins/test_gfx.c
index 1dfab8c3b4..51d8f40cd7 100644
--- a/apps/plugins/test_gfx.c
+++ b/apps/plugins/test_gfx.c
@@ -399,6 +399,60 @@ static void time_text(void) /* tests mono_bitmap performance */
399 count1, count2, count3, count4); 399 count1, count2, count3, count4);
400} 400}
401 401
402static void time_put_line(void) /* tests put_line performance */
403{
404 long time_start, time_end;
405 int count1, count2, count3, count4;
406 struct screen *display = rb->screens[SCREEN_MAIN];
407 const char fmt[] = "$iRockbox!";
408
409 rb->lcd_setfont(FONT_SYSFIXED);
410 count1 = count2 = count3 = count4 = 0;
411
412 struct line_desc desc = LINE_DESC_DEFINIT;
413 rb->sleep(0); /* sync to tick */
414 time_start = *rb->current_tick;
415 while((time_end = *rb->current_tick) - time_start < DURATION)
416 {
417 unsigned rnd = rand_table[count1++ & 0x3ff];
418 display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
419 }
420
421 desc.style = STYLE_INVERT;
422 rb->sleep(0); /* sync to tick */
423 time_start = *rb->current_tick;
424 while((time_end = *rb->current_tick) - time_start < DURATION)
425 {
426 unsigned rnd = rand_table[count2++ & 0x3ff];
427 display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
428 }
429
430 desc.style = STYLE_COLORBAR;
431 rb->sleep(0); /* sync to tick */
432 time_start = *rb->current_tick;
433 while((time_end = *rb->current_tick) - time_start < DURATION)
434 {
435 unsigned rnd = rand_table[count3++ & 0x3ff];
436 display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
437 }
438
439 desc.style = STYLE_GRADIENT;
440 rb->sleep(0); /* sync to tick */
441 time_start = *rb->current_tick;
442 while((time_end = *rb->current_tick) - time_start < DURATION)
443 {
444 unsigned rnd = rand_table[count4++ & 0x3ff];
445 display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
446 }
447
448 rb->fdprintf(log_fd, "\nput_line (lines (icon+text)/s): \n"
449 " default: %d\n"
450 " inverted: %d\n"
451 " colorbar: %d\n"
452 " gradient: %d\n",
453 count1, count2, count3, count4);
454}
455
402/* plugin entry point */ 456/* plugin entry point */
403enum plugin_status plugin_start(const void* parameter) 457enum plugin_status plugin_start(const void* parameter)
404{ 458{
@@ -444,7 +498,7 @@ enum plugin_status plugin_start(const void* parameter)
444 backlight_ignore_timeout(); 498 backlight_ignore_timeout();
445 499
446 rb->splashf(0, "LCD driver performance test, please wait %d sec", 500 rb->splashf(0, "LCD driver performance test, please wait %d sec",
447 6*4*DURATION/HZ); 501 7*4*DURATION/HZ);
448 init_rand_table(); 502 init_rand_table();
449 503
450#ifdef HAVE_ADJUSTABLE_CPU_FREQ 504#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -457,6 +511,7 @@ enum plugin_status plugin_start(const void* parameter)
457 time_vline(); 511 time_vline();
458 time_fillrect(); 512 time_fillrect();
459 time_text(); 513 time_text();
514 time_put_line();
460 515
461#ifdef HAVE_ADJUSTABLE_CPU_FREQ 516#ifdef HAVE_ADJUSTABLE_CPU_FREQ
462 if (*rb->cpu_frequency != cpu_freq) 517 if (*rb->cpu_frequency != cpu_freq)