diff options
author | Jens Arnold <amiconn@rockbox.org> | 2009-06-20 18:12:34 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2009-06-20 18:12:34 +0000 |
commit | 96904ba7c3a32083b4e49a6291891fbbc3442b88 (patch) | |
tree | a7946c98536f9bd2d742f095b972f06e263da14a /apps | |
parent | cfd2f2c0743e1a8c80d257719d70318cb0b85e8f (diff) | |
download | rockbox-96904ba7c3a32083b4e49a6291891fbbc3442b88.tar.gz rockbox-96904ba7c3a32083b4e49a6291891fbbc3442b88.zip |
Plugin for testing LCD driver and greylib drawing performance.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21405 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/test_gfx.c | 474 |
1 files changed, 474 insertions, 0 deletions
diff --git a/apps/plugins/test_gfx.c b/apps/plugins/test_gfx.c new file mode 100644 index 0000000000..728eb5600e --- /dev/null +++ b/apps/plugins/test_gfx.c | |||
@@ -0,0 +1,474 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Jens Arnold | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "plugin.h" | ||
20 | #include "lib/grey.h" | ||
21 | #include "lib/helper.h" | ||
22 | |||
23 | //#define TEST_GREYLIB /* Uncomment for testing greylib instead of core gfx */ | ||
24 | |||
25 | #ifdef TEST_GREYLIB | ||
26 | #define MYLCD(fn) grey_ ## fn | ||
27 | GREY_INFO_STRUCT | ||
28 | static unsigned char *gbuf; | ||
29 | static size_t gbuf_size = 0; | ||
30 | #else | ||
31 | #define MYLCD(fn) rb->lcd_ ## fn | ||
32 | #endif | ||
33 | |||
34 | #define DURATION (HZ) /* longer duration gives more precise results */ | ||
35 | #define RND_SEED 0x43A678C3 /* arbirary */ | ||
36 | |||
37 | PLUGIN_HEADER | ||
38 | |||
39 | static uint16_t rand_table[0x400]; | ||
40 | static int log_fd; | ||
41 | |||
42 | |||
43 | static int log_init(void) | ||
44 | { | ||
45 | char logfilename[MAX_PATH]; | ||
46 | int fd; | ||
47 | |||
48 | rb->create_numbered_filename(logfilename, "/", "test_gfx_log_", ".txt", | ||
49 | 2 IF_CNFN_NUM_(, NULL)); | ||
50 | fd = rb->open(logfilename, O_RDWR|O_CREAT|O_TRUNC); | ||
51 | return fd; | ||
52 | } | ||
53 | |||
54 | static void init_rand_table(void) | ||
55 | { | ||
56 | int i; | ||
57 | |||
58 | rb->srand(RND_SEED); /* make it reproducable */ | ||
59 | for (i = 0; i < 0x400; i++) | ||
60 | rand_table[i] = rb->rand(); | ||
61 | } | ||
62 | |||
63 | static void time_drawpixel(void) | ||
64 | { | ||
65 | long time_start; /* start tickcount */ | ||
66 | long time_end; /* end tickcount */ | ||
67 | int count1, count2, count3, count4; | ||
68 | |||
69 | /* Test 1: DRMODE_SOLID */ | ||
70 | MYLCD(set_drawmode)(DRMODE_SOLID); | ||
71 | count1 = 0; | ||
72 | rb->sleep(0); /* sync to tick */ | ||
73 | time_start = *rb->current_tick; | ||
74 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
75 | { | ||
76 | unsigned rnd = rand_table[count1++ & 0x3ff]; | ||
77 | MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); | ||
78 | } | ||
79 | |||
80 | /* Test 2: DRMODE_FG */ | ||
81 | MYLCD(set_drawmode)(DRMODE_FG); | ||
82 | count2 = 0; | ||
83 | rb->sleep(0); /* sync to tick */ | ||
84 | time_start = *rb->current_tick; | ||
85 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
86 | { | ||
87 | unsigned rnd = rand_table[count2++ & 0x3ff]; | ||
88 | MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); | ||
89 | } | ||
90 | /* Test 3: DRMODE_BG */ | ||
91 | MYLCD(set_drawmode)(DRMODE_BG); | ||
92 | count3 = 0; | ||
93 | rb->sleep(0); /* sync to tick */ | ||
94 | time_start = *rb->current_tick; | ||
95 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
96 | { | ||
97 | unsigned rnd = rand_table[count3++ & 0x3ff]; | ||
98 | MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); | ||
99 | } | ||
100 | /* Test 4: DRMODE_COMPLEMENT */ | ||
101 | MYLCD(set_drawmode)(DRMODE_COMPLEMENT); | ||
102 | count4 = 0; | ||
103 | rb->sleep(0); /* sync to tick */ | ||
104 | time_start = *rb->current_tick; | ||
105 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
106 | { | ||
107 | unsigned rnd = rand_table[count4++ & 0x3ff]; | ||
108 | MYLCD(drawpixel)((rnd >> 8) & 0x3f, rnd & 0x3f); | ||
109 | } | ||
110 | |||
111 | rb->fdprintf(log_fd, "lcd_drawpixel (pixels/s): %d/%d/%d/%d\n", | ||
112 | count1, count2, count3, count4); | ||
113 | } | ||
114 | |||
115 | static void time_drawline(void) | ||
116 | { | ||
117 | long time_start; /* start tickcount */ | ||
118 | long time_end; /* end tickcount */ | ||
119 | int count1, count2, count3, count4; | ||
120 | |||
121 | /* Test 1: DRMODE_SOLID */ | ||
122 | MYLCD(set_drawmode)(DRMODE_SOLID); | ||
123 | count1 = 0; | ||
124 | rb->sleep(0); /* sync to tick */ | ||
125 | time_start = *rb->current_tick; | ||
126 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
127 | { | ||
128 | unsigned rnd1 = rand_table[count1++ & 0x3ff]; | ||
129 | unsigned rnd2 = rand_table[count1++ & 0x3ff]; | ||
130 | MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, | ||
131 | (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); | ||
132 | } | ||
133 | |||
134 | /* Test 2: DRMODE_FG */ | ||
135 | MYLCD(set_drawmode)(DRMODE_FG); | ||
136 | count2 = 0; | ||
137 | rb->sleep(0); /* sync to tick */ | ||
138 | time_start = *rb->current_tick; | ||
139 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
140 | { | ||
141 | unsigned rnd1 = rand_table[count2++ & 0x3ff]; | ||
142 | unsigned rnd2 = rand_table[count2++ & 0x3ff]; | ||
143 | MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, | ||
144 | (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); | ||
145 | } | ||
146 | /* Test 3: DRMODE_BG */ | ||
147 | MYLCD(set_drawmode)(DRMODE_BG); | ||
148 | count3 = 0; | ||
149 | rb->sleep(0); /* sync to tick */ | ||
150 | time_start = *rb->current_tick; | ||
151 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
152 | { | ||
153 | unsigned rnd1 = rand_table[count3++ & 0x3ff]; | ||
154 | unsigned rnd2 = rand_table[count3++ & 0x3ff]; | ||
155 | MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, | ||
156 | (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); | ||
157 | } | ||
158 | /* Test 4: DRMODE_COMPLEMENT */ | ||
159 | MYLCD(set_drawmode)(DRMODE_COMPLEMENT); | ||
160 | count4 = 0; | ||
161 | rb->sleep(0); /* sync to tick */ | ||
162 | time_start = *rb->current_tick; | ||
163 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
164 | { | ||
165 | unsigned rnd1 = rand_table[count4++ & 0x3ff]; | ||
166 | unsigned rnd2 = rand_table[count4++ & 0x3ff]; | ||
167 | MYLCD(drawline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, | ||
168 | (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); | ||
169 | } | ||
170 | |||
171 | rb->fdprintf(log_fd, "lcd_drawline (lines/s): %d/%d/%d/%d\n", | ||
172 | count1, count2, count3, count4); | ||
173 | } | ||
174 | |||
175 | static void time_hline(void) | ||
176 | { | ||
177 | long time_start; /* start tickcount */ | ||
178 | long time_end; /* end tickcount */ | ||
179 | int count1, count2, count3, count4; | ||
180 | |||
181 | /* Test 1: DRMODE_SOLID */ | ||
182 | MYLCD(set_drawmode)(DRMODE_SOLID); | ||
183 | count1 = 0; | ||
184 | rb->sleep(0); /* sync to tick */ | ||
185 | time_start = *rb->current_tick; | ||
186 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
187 | { | ||
188 | unsigned rnd1 = rand_table[count1++ & 0x3ff]; | ||
189 | unsigned rnd2 = rand_table[count1++ & 0x3ff]; | ||
190 | MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); | ||
191 | } | ||
192 | |||
193 | /* Test 2: DRMODE_FG */ | ||
194 | MYLCD(set_drawmode)(DRMODE_FG); | ||
195 | count2 = 0; | ||
196 | rb->sleep(0); /* sync to tick */ | ||
197 | time_start = *rb->current_tick; | ||
198 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
199 | { | ||
200 | unsigned rnd1 = rand_table[count2++ & 0x3ff]; | ||
201 | unsigned rnd2 = rand_table[count2++ & 0x3ff]; | ||
202 | MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); | ||
203 | } | ||
204 | /* Test 3: DRMODE_BG */ | ||
205 | MYLCD(set_drawmode)(DRMODE_BG); | ||
206 | count3 = 0; | ||
207 | rb->sleep(0); /* sync to tick */ | ||
208 | time_start = *rb->current_tick; | ||
209 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
210 | { | ||
211 | unsigned rnd1 = rand_table[count3++ & 0x3ff]; | ||
212 | unsigned rnd2 = rand_table[count3++ & 0x3ff]; | ||
213 | MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); | ||
214 | } | ||
215 | /* Test 4: DRMODE_COMPLEMENT */ | ||
216 | MYLCD(set_drawmode)(DRMODE_COMPLEMENT); | ||
217 | count4 = 0; | ||
218 | rb->sleep(0); /* sync to tick */ | ||
219 | time_start = *rb->current_tick; | ||
220 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
221 | { | ||
222 | unsigned rnd1 = rand_table[count4++ & 0x3ff]; | ||
223 | unsigned rnd2 = rand_table[count4++ & 0x3ff]; | ||
224 | MYLCD(hline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); | ||
225 | } | ||
226 | |||
227 | rb->fdprintf(log_fd, "lcd_hline (lines/s): %d/%d/%d/%d\n", | ||
228 | count1, count2, count3, count4); | ||
229 | } | ||
230 | |||
231 | static void time_vline(void) | ||
232 | { | ||
233 | long time_start; /* start tickcount */ | ||
234 | long time_end; /* end tickcount */ | ||
235 | int count1, count2, count3, count4; | ||
236 | |||
237 | /* Test 1: DRMODE_SOLID */ | ||
238 | MYLCD(set_drawmode)(DRMODE_SOLID); | ||
239 | count1 = 0; | ||
240 | rb->sleep(0); /* sync to tick */ | ||
241 | time_start = *rb->current_tick; | ||
242 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
243 | { | ||
244 | unsigned rnd1 = rand_table[count1++ & 0x3ff]; | ||
245 | unsigned rnd2 = rand_table[count1++ & 0x3ff]; | ||
246 | MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); | ||
247 | } | ||
248 | |||
249 | /* Test 2: DRMODE_FG */ | ||
250 | MYLCD(set_drawmode)(DRMODE_FG); | ||
251 | count2 = 0; | ||
252 | rb->sleep(0); /* sync to tick */ | ||
253 | time_start = *rb->current_tick; | ||
254 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
255 | { | ||
256 | unsigned rnd1 = rand_table[count2++ & 0x3ff]; | ||
257 | unsigned rnd2 = rand_table[count2++ & 0x3ff]; | ||
258 | MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); | ||
259 | } | ||
260 | /* Test 3: DRMODE_BG */ | ||
261 | MYLCD(set_drawmode)(DRMODE_BG); | ||
262 | count3 = 0; | ||
263 | rb->sleep(0); /* sync to tick */ | ||
264 | time_start = *rb->current_tick; | ||
265 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
266 | { | ||
267 | unsigned rnd1 = rand_table[count3++ & 0x3ff]; | ||
268 | unsigned rnd2 = rand_table[count3++ & 0x3ff]; | ||
269 | MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); | ||
270 | } | ||
271 | /* Test 4: DRMODE_COMPLEMENT */ | ||
272 | MYLCD(set_drawmode)(DRMODE_COMPLEMENT); | ||
273 | count4 = 0; | ||
274 | rb->sleep(0); /* sync to tick */ | ||
275 | time_start = *rb->current_tick; | ||
276 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
277 | { | ||
278 | unsigned rnd1 = rand_table[count4++ & 0x3ff]; | ||
279 | unsigned rnd2 = rand_table[count4++ & 0x3ff]; | ||
280 | MYLCD(vline)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, rnd2 & 0x3f); | ||
281 | } | ||
282 | |||
283 | rb->fdprintf(log_fd, "lcd_vline (lines/s): %d/%d/%d/%d\n", | ||
284 | count1, count2, count3, count4); | ||
285 | } | ||
286 | |||
287 | static void time_fillrect(void) | ||
288 | { | ||
289 | long time_start; /* start tickcount */ | ||
290 | long time_end; /* end tickcount */ | ||
291 | int count1, count2, count3, count4; | ||
292 | |||
293 | /* Test 1: DRMODE_SOLID */ | ||
294 | MYLCD(set_drawmode)(DRMODE_SOLID); | ||
295 | count1 = 0; | ||
296 | rb->sleep(0); /* sync to tick */ | ||
297 | time_start = *rb->current_tick; | ||
298 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
299 | { | ||
300 | unsigned rnd1 = rand_table[count1++ & 0x3ff]; | ||
301 | unsigned rnd2 = rand_table[count1++ & 0x3ff]; | ||
302 | MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, | ||
303 | (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); | ||
304 | } | ||
305 | |||
306 | /* Test 2: DRMODE_FG */ | ||
307 | MYLCD(set_drawmode)(DRMODE_FG); | ||
308 | count2 = 0; | ||
309 | rb->sleep(0); /* sync to tick */ | ||
310 | time_start = *rb->current_tick; | ||
311 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
312 | { | ||
313 | unsigned rnd1 = rand_table[count2++ & 0x3ff]; | ||
314 | unsigned rnd2 = rand_table[count2++ & 0x3ff]; | ||
315 | MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, | ||
316 | (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); | ||
317 | } | ||
318 | /* Test 3: DRMODE_BG */ | ||
319 | MYLCD(set_drawmode)(DRMODE_BG); | ||
320 | count3 = 0; | ||
321 | rb->sleep(0); /* sync to tick */ | ||
322 | time_start = *rb->current_tick; | ||
323 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
324 | { | ||
325 | unsigned rnd1 = rand_table[count3++ & 0x3ff]; | ||
326 | unsigned rnd2 = rand_table[count3++ & 0x3ff]; | ||
327 | MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, | ||
328 | (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); | ||
329 | } | ||
330 | /* Test 4: DRMODE_COMPLEMENT */ | ||
331 | MYLCD(set_drawmode)(DRMODE_COMPLEMENT); | ||
332 | count4 = 0; | ||
333 | rb->sleep(0); /* sync to tick */ | ||
334 | time_start = *rb->current_tick; | ||
335 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
336 | { | ||
337 | unsigned rnd1 = rand_table[count4++ & 0x3ff]; | ||
338 | unsigned rnd2 = rand_table[count4++ & 0x3ff]; | ||
339 | MYLCD(fillrect)((rnd1 >> 8) & 0x3f, rnd1 & 0x3f, | ||
340 | (rnd2 >> 8) & 0x3f, rnd2 & 0x3f); | ||
341 | } | ||
342 | |||
343 | rb->fdprintf(log_fd, "lcd_fillrect (rects/s): %d/%d/%d/%d\n", | ||
344 | count1, count2, count3, count4); | ||
345 | } | ||
346 | |||
347 | static void time_text(void) /* tests mono_bitmap performance */ | ||
348 | { | ||
349 | long time_start; /* start tickcount */ | ||
350 | long time_end; /* end tickcount */ | ||
351 | int count1, count2, count3, count4; | ||
352 | |||
353 | rb->lcd_setfont(FONT_SYSFIXED); | ||
354 | |||
355 | /* Test 1: DRMODE_SOLID */ | ||
356 | MYLCD(set_drawmode)(DRMODE_SOLID); | ||
357 | count1 = 0; | ||
358 | rb->sleep(0); /* sync to tick */ | ||
359 | time_start = *rb->current_tick; | ||
360 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
361 | { | ||
362 | unsigned rnd = rand_table[count1++ & 0x3ff]; | ||
363 | MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); | ||
364 | } | ||
365 | |||
366 | /* Test 2: DRMODE_FG */ | ||
367 | MYLCD(set_drawmode)(DRMODE_FG); | ||
368 | count2 = 0; | ||
369 | rb->sleep(0); /* sync to tick */ | ||
370 | time_start = *rb->current_tick; | ||
371 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
372 | { | ||
373 | unsigned rnd = rand_table[count2++ & 0x3ff]; | ||
374 | MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); | ||
375 | } | ||
376 | /* Test 3: DRMODE_BG */ | ||
377 | MYLCD(set_drawmode)(DRMODE_BG); | ||
378 | count3 = 0; | ||
379 | rb->sleep(0); /* sync to tick */ | ||
380 | time_start = *rb->current_tick; | ||
381 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
382 | { | ||
383 | unsigned rnd = rand_table[count3++ & 0x3ff]; | ||
384 | MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); | ||
385 | } | ||
386 | /* Test 4: DRMODE_COMPLEMENT */ | ||
387 | MYLCD(set_drawmode)(DRMODE_COMPLEMENT); | ||
388 | count4 = 0; | ||
389 | rb->sleep(0); /* sync to tick */ | ||
390 | time_start = *rb->current_tick; | ||
391 | while((time_end = *rb->current_tick) - time_start < DURATION) | ||
392 | { | ||
393 | unsigned rnd = rand_table[count4++ & 0x3ff]; | ||
394 | MYLCD(putsxy)((rnd >> 8) & 0x3f, rnd & 0x3f, "Rockbox!"); | ||
395 | } | ||
396 | |||
397 | rb->fdprintf(log_fd, "lcd_putsxy (strings/s): %d/%d/%d/%d\n", | ||
398 | count1, count2, count3, count4); | ||
399 | } | ||
400 | |||
401 | /* plugin entry point */ | ||
402 | enum plugin_status plugin_start(const void* parameter) | ||
403 | { | ||
404 | #ifndef SIMULATOR | ||
405 | int cpu_freq; | ||
406 | #endif | ||
407 | |||
408 | /* standard stuff */ | ||
409 | (void)parameter; | ||
410 | |||
411 | log_fd = log_init(); | ||
412 | if (log_fd < 0) | ||
413 | { | ||
414 | rb->splash(HZ, "Could not create logfile"); | ||
415 | return PLUGIN_ERROR; | ||
416 | } | ||
417 | rb->fdprintf(log_fd, "%s", | ||
418 | #ifdef TEST_GREYLIB | ||
419 | "Greylib performance test.\n" | ||
420 | #else | ||
421 | "LCD driver performance test.\n" | ||
422 | #endif | ||
423 | "----------------------------\n\n" | ||
424 | "Results are printed in the following drawmode order:\n" | ||
425 | "solid/foreground/background/complement\n\n"); | ||
426 | |||
427 | #ifdef TEST_GREYLIB | ||
428 | /* get the remainder of the plugin buffer */ | ||
429 | gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); | ||
430 | |||
431 | /* initialize the greyscale buffer.*/ | ||
432 | if (!grey_init(gbuf, gbuf_size, GREY_BUFFERED|GREY_ON_COP, | ||
433 | LCD_WIDTH, LCD_HEIGHT, NULL)) | ||
434 | { | ||
435 | rb->close(log_fd); | ||
436 | rb->splash(HZ, "Couldn't init greyscale library"); | ||
437 | return PLUGIN_ERROR; | ||
438 | } | ||
439 | #elif LCD_DEPTH > 1 | ||
440 | rb->lcd_set_backdrop(NULL); | ||
441 | rb->lcd_clear_display(); | ||
442 | #endif | ||
443 | backlight_force_on(); /* backlight control in lib/helper.c */ | ||
444 | |||
445 | rb->splashf(0, "LCD driver performance test, please wait %d sec", | ||
446 | 6*4*DURATION/HZ); | ||
447 | init_rand_table(); | ||
448 | |||
449 | #ifndef SIMULATOR | ||
450 | cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */ | ||
451 | #endif | ||
452 | |||
453 | time_drawpixel(); | ||
454 | time_drawline(); | ||
455 | time_hline(); | ||
456 | time_vline(); | ||
457 | time_fillrect(); | ||
458 | time_text(); | ||
459 | |||
460 | #ifndef SIMULATOR | ||
461 | if (*rb->cpu_frequency != cpu_freq) | ||
462 | rb->fdprintf(log_fd, "\nCPU: %s\n", "clock changed!"); | ||
463 | else | ||
464 | rb->fdprintf(log_fd, "\nCPU: %d MHz\n", | ||
465 | (cpu_freq + 500000) / 1000000); | ||
466 | #endif | ||
467 | rb->close(log_fd); | ||
468 | backlight_use_settings(); | ||
469 | #ifdef TEST_GREYLIB | ||
470 | grey_release(); | ||
471 | #endif | ||
472 | |||
473 | return PLUGIN_OK; | ||
474 | } | ||