From 2ef9aa51f34263955bfa1528f6a4fd074b69ec91 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 7 Jan 2014 14:06:26 +0100 Subject: test_gfx: Add benchmark for put_line(). Change-Id: I94cd5cec5ce169a4ddb60fcb3c09e2ffb50a3401 --- apps/plugins/test_gfx.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'apps') 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 */ count1, count2, count3, count4); } +static void time_put_line(void) /* tests put_line performance */ +{ + long time_start, time_end; + int count1, count2, count3, count4; + struct screen *display = rb->screens[SCREEN_MAIN]; + const char fmt[] = "$iRockbox!"; + + rb->lcd_setfont(FONT_SYSFIXED); + count1 = count2 = count3 = count4 = 0; + + struct line_desc desc = LINE_DESC_DEFINIT; + rb->sleep(0); /* sync to tick */ + time_start = *rb->current_tick; + while((time_end = *rb->current_tick) - time_start < DURATION) + { + unsigned rnd = rand_table[count1++ & 0x3ff]; + display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio); + } + + desc.style = STYLE_INVERT; + rb->sleep(0); /* sync to tick */ + time_start = *rb->current_tick; + while((time_end = *rb->current_tick) - time_start < DURATION) + { + unsigned rnd = rand_table[count2++ & 0x3ff]; + display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio); + } + + desc.style = STYLE_COLORBAR; + rb->sleep(0); /* sync to tick */ + time_start = *rb->current_tick; + while((time_end = *rb->current_tick) - time_start < DURATION) + { + unsigned rnd = rand_table[count3++ & 0x3ff]; + display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio); + } + + desc.style = STYLE_GRADIENT; + rb->sleep(0); /* sync to tick */ + time_start = *rb->current_tick; + while((time_end = *rb->current_tick) - time_start < DURATION) + { + unsigned rnd = rand_table[count4++ & 0x3ff]; + display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio); + } + + rb->fdprintf(log_fd, "\nput_line (lines (icon+text)/s): \n" + " default: %d\n" + " inverted: %d\n" + " colorbar: %d\n" + " gradient: %d\n", + count1, count2, count3, count4); +} + /* plugin entry point */ enum plugin_status plugin_start(const void* parameter) { @@ -444,7 +498,7 @@ enum plugin_status plugin_start(const void* parameter) backlight_ignore_timeout(); rb->splashf(0, "LCD driver performance test, please wait %d sec", - 6*4*DURATION/HZ); + 7*4*DURATION/HZ); init_rand_table(); #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -457,6 +511,7 @@ enum plugin_status plugin_start(const void* parameter) time_vline(); time_fillrect(); time_text(); + time_put_line(); #ifdef HAVE_ADJUSTABLE_CPU_FREQ if (*rb->cpu_frequency != cpu_freq) -- cgit v1.2.3