Merge lp:~afrantzis/ubuntu/maverick/glmemperf/ignore-problematic-benchmarks into lp:ubuntu/maverick/glmemperf
- Maverick (10.10)
- ignore-problematic-benchmarks
- Merge into maverick
Proposed by
Alexandros Frantzis
Status: | Merged |
---|---|
Merged at revision: | 3 |
Proposed branch: | lp:~afrantzis/ubuntu/maverick/glmemperf/ignore-problematic-benchmarks |
Merge into: | lp:ubuntu/maverick/glmemperf |
Diff against target: |
1233 lines (+1099/-9) 13 files modified
.pc/applied-patches (+2/-0) .pc/do_not_use_invalid_egl_config.patch/glmemperf.cpp (+503/-0) .pc/exception_instead_of_assert.patch/cpuinterleavingtest.cpp (+315/-0) .pc/exception_instead_of_assert.patch/util.h (+154/-0) cpuinterleavingtest.cpp (+2/-1) debian/changelog (+12/-0) debian/patches/add_missing_includes.patch (+2/-1) debian/patches/do_not_use_invalid_egl_config.patch (+26/-0) debian/patches/exception_instead_of_assert.patch (+59/-0) debian/patches/optional_gles2_defines.patch (+2/-1) debian/patches/series (+2/-0) glmemperf.cpp (+4/-2) util.h (+16/-4) |
To merge this branch: | bzr merge lp:~afrantzis/ubuntu/maverick/glmemperf/ignore-problematic-benchmarks |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stefano Rivera | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Stefano Rivera (stefanor) wrote : | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Stefano Rivera (stefanor) : | # |
review:
Needs Fixing
- 4. By Alexandros Frantzis
-
* debian/
patches/ *.patch: Add 'Bug' field for patches that have been forwarded upstream.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alexandros Frantzis (afrantzis) wrote : | # |
I have forwarded the relevant patches upstream and have updated the quilt headers to reflect this.
Thanks!
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Stefano Rivera (stefanor) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.pc/applied-patches' |
2 | --- .pc/applied-patches 2010-06-30 11:17:12 +0000 |
3 | +++ .pc/applied-patches 2010-08-04 08:33:44 +0000 |
4 | @@ -1,4 +1,6 @@ |
5 | optional_gles2_defines.patch |
6 | add_missing_includes.patch |
7 | +exception_instead_of_assert.patch |
8 | +do_not_use_invalid_egl_config.patch |
9 | no_makefile_in_debian_dir.patch |
10 | autoreconf.patch |
11 | |
12 | === added directory '.pc/do_not_use_invalid_egl_config.patch' |
13 | === added file '.pc/do_not_use_invalid_egl_config.patch/glmemperf.cpp' |
14 | --- .pc/do_not_use_invalid_egl_config.patch/glmemperf.cpp 1970-01-01 00:00:00 +0000 |
15 | +++ .pc/do_not_use_invalid_egl_config.patch/glmemperf.cpp 2010-08-04 08:33:44 +0000 |
16 | @@ -0,0 +1,503 @@ |
17 | +/** |
18 | + * OpenGL ES 2.0 memory performance estimator |
19 | + * Copyright (C) 2009 Nokia |
20 | + * |
21 | + * This program is free software; you can redistribute it and/or modify |
22 | + * it under the terms of the GNU General Public License as published by |
23 | + * the Free Software Foundation; either version 2 of the License, or |
24 | + * (at your option) any later version. |
25 | + * |
26 | + * This program is distributed in the hope that it will be useful, |
27 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
28 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
29 | + * GNU General Public License for more details. |
30 | + * |
31 | + * You should have received a copy of the GNU General Public License along |
32 | + * with this program; if not, write to the Free Software Foundation, Inc., |
33 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
34 | + * |
35 | + * \author Sami Kyöstilä <sami.kyostila@nokia.com> |
36 | + */ |
37 | +#include <GLES2/gl2.h> |
38 | +#include <GLES2/gl2ext.h> |
39 | +#include <X11/Xutil.h> |
40 | +#include <EGL/egl.h> |
41 | +#include <string> |
42 | +#include <unistd.h> |
43 | +#include <time.h> |
44 | +#include <memory> |
45 | +#include <list> |
46 | +#include <iostream> |
47 | +#include <algorithm> |
48 | +#include <sys/stat.h> |
49 | +#include <stdio.h> |
50 | + |
51 | +#include "native.h" |
52 | +#include "util.h" |
53 | +#include "test.h" |
54 | +#include "blittest.h" |
55 | +#include "cleartest.h" |
56 | +#include "pixmapblittest.h" |
57 | +#include "fboblittest.h" |
58 | +#include "shaderblittest.h" |
59 | +#include "cpuinterleavingtest.h" |
60 | +#include "config.h" |
61 | + |
62 | +#if defined(HAVE_LIBOSSO) |
63 | +#include <libosso.h> |
64 | +#endif |
65 | + |
66 | +/** |
67 | + * Command line options |
68 | + */ |
69 | +static struct |
70 | +{ |
71 | + int bitsPerPixel; |
72 | + bool verbose; |
73 | + int minTime; |
74 | + std::list<std::string> includedTests; |
75 | + std::list<std::string> excludedTests; |
76 | +} options; |
77 | + |
78 | +/** Shared EGL objects */ |
79 | +struct Context ctx; |
80 | + |
81 | +#if defined(HAVE_LIBOSSO) |
82 | +osso_context_t* ossoContext; |
83 | +#endif |
84 | + |
85 | +bool initializeEgl(int width, int height, const EGLint* configAttrs, const EGLint* contextAttrs) |
86 | +{ |
87 | + EGLint configCount = 0; |
88 | + |
89 | +#if defined(HAVE_LIBOSSO) |
90 | + ossoContext = osso_initialize("com.nokia.memperf", "1.0", FALSE, NULL); |
91 | + if (!ossoContext) |
92 | + { |
93 | + perror("osso_initialize"); |
94 | + goto out_error; |
95 | + } |
96 | +#endif |
97 | + |
98 | + ctx.dpy = eglGetDisplay(ctx.nativeDisplay); |
99 | + ASSERT_EGL(); |
100 | + |
101 | + eglInitialize(ctx.dpy, NULL, NULL); |
102 | + eglChooseConfig(ctx.dpy, configAttrs, &ctx.config, 1, &configCount); |
103 | + ASSERT_EGL(); |
104 | + |
105 | + if (!configCount) |
106 | + { |
107 | + printf("Config not found\n"); |
108 | + goto out_error; |
109 | + } |
110 | + |
111 | + if (options.verbose) |
112 | + { |
113 | + printf("Config attributes:\n"); |
114 | + dumpConfig(ctx.dpy, ctx.config); |
115 | + } |
116 | + |
117 | + if (!nativeCreateWindow(ctx.nativeDisplay, ctx.dpy, ctx.config, __FILE__, |
118 | + width, height, &ctx.win)) |
119 | + { |
120 | + printf("Unable to create a window\n"); |
121 | + goto out_error; |
122 | + } |
123 | + |
124 | + ctx.context = eglCreateContext(ctx.dpy, ctx.config, EGL_NO_CONTEXT, contextAttrs); |
125 | + ASSERT_EGL(); |
126 | + if (!ctx.context) |
127 | + { |
128 | + printf("Unable to create a context\n"); |
129 | + goto out_error; |
130 | + } |
131 | + |
132 | + ctx.surface = eglCreateWindowSurface(ctx.dpy, ctx.config, ctx.win, NULL); |
133 | + ASSERT_EGL(); |
134 | + if (!ctx.surface) |
135 | + { |
136 | + printf("Unable to create a surface\n"); |
137 | + goto out_error; |
138 | + } |
139 | + |
140 | + eglMakeCurrent(ctx.dpy, ctx.surface, ctx.surface, ctx.context); |
141 | + ASSERT_EGL(); |
142 | + |
143 | + eglSwapInterval(ctx.dpy, 0); |
144 | + return true; |
145 | + |
146 | +out_error: |
147 | + eglMakeCurrent(ctx.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); |
148 | + eglDestroySurface(ctx.dpy, ctx.surface); |
149 | + eglDestroyContext(ctx.dpy, ctx.context); |
150 | + eglTerminate(ctx.dpy); |
151 | + nativeDestroyWindow(ctx.nativeDisplay, ctx.win); |
152 | + nativeDestroyDisplay(ctx.nativeDisplay); |
153 | + return false; |
154 | +} |
155 | + |
156 | +void terminateEgl() |
157 | +{ |
158 | + eglMakeCurrent(ctx.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); |
159 | + eglDestroySurface(ctx.dpy, ctx.surface); |
160 | + eglDestroyContext(ctx.dpy, ctx.context); |
161 | + eglTerminate(ctx.dpy); |
162 | + nativeDestroyWindow(ctx.nativeDisplay, ctx.win); |
163 | + nativeDestroyDisplay(ctx.nativeDisplay); |
164 | + |
165 | +#if defined(HAVE_LIBOSSO) |
166 | + osso_deinitialize(ossoContext); |
167 | + ossoContext = 0; |
168 | +#endif |
169 | +} |
170 | + |
171 | +int64_t timeDiff(const struct timespec& start, const struct timespec& end) |
172 | +{ |
173 | + int64_t s = start.tv_sec * (1000 * 1000 * 1000LL) + start.tv_nsec; |
174 | + int64_t e = end.tv_sec * (1000 * 1000 * 1000LL) + end.tv_nsec; |
175 | + return e - s; |
176 | +} |
177 | + |
178 | +bool shouldRunTest(const std::string& testName) |
179 | +{ |
180 | + std::list<std::string>::iterator i; |
181 | + bool result = true; |
182 | + |
183 | + if (options.includedTests.size()) |
184 | + { |
185 | + result = false; |
186 | + for (i = options.includedTests.begin(); i != options.includedTests.end(); ++i) |
187 | + { |
188 | + if (testName.find(*i) != std::string::npos) |
189 | + { |
190 | + result = true; |
191 | + break; |
192 | + } |
193 | + } |
194 | + } |
195 | + |
196 | + for (i = options.excludedTests.begin(); i != options.excludedTests.end(); ++i) |
197 | + { |
198 | + if (testName.find(*i) != std::string::npos) |
199 | + { |
200 | + result = false; |
201 | + break; |
202 | + } |
203 | + } |
204 | + |
205 | + return result; |
206 | +} |
207 | + |
208 | +void runTest(Test& test) |
209 | +{ |
210 | + int frames = 0; |
211 | + int frameLimit = 100; |
212 | + int warmup = 20; |
213 | + int64_t minTime = options.minTime * 1000 * 1000 * 1000LL; |
214 | + struct timespec res, start, end; |
215 | + |
216 | + if (!shouldRunTest(test.name())) |
217 | + { |
218 | + return; |
219 | + } |
220 | + |
221 | + clock_getres(CLOCK_REALTIME, &res); |
222 | + //printf("Timer resolution: %d.%09d s\n", res.tv_sec, res.tv_nsec); |
223 | + printf("%-40s", (test.name() + ":").c_str()); |
224 | + fflush(stdout); |
225 | + |
226 | + try |
227 | + { |
228 | + test.prepare(); |
229 | + ASSERT_GL(); |
230 | + ASSERT_EGL(); |
231 | + } catch (const std::exception& e) |
232 | + { |
233 | + printf("%s\n", e.what()); |
234 | + return; |
235 | + } |
236 | + |
237 | + while (warmup--) |
238 | + { |
239 | + test(0); |
240 | + swapBuffers(); |
241 | + } |
242 | + |
243 | + ASSERT_GL(); |
244 | + ASSERT_EGL(); |
245 | + |
246 | +#if defined(HAVE_LIBOSSO) |
247 | + osso_display_blanking_pause(ossoContext); |
248 | +#endif |
249 | + |
250 | + clock_gettime(CLOCK_REALTIME, &start); |
251 | + while (frames < frameLimit) |
252 | + { |
253 | + test(frames); |
254 | + swapBuffers(); |
255 | + clock_gettime(CLOCK_REALTIME, &end); |
256 | + frames++; |
257 | + if (frames >= frameLimit && timeDiff(start, end) < minTime) |
258 | + { |
259 | + frameLimit *= 2; |
260 | + } |
261 | + } |
262 | + |
263 | + ASSERT_GL(); |
264 | + ASSERT_EGL(); |
265 | + |
266 | + test.teardown(); |
267 | + ASSERT_GL(); |
268 | + ASSERT_EGL(); |
269 | + |
270 | + int64_t diff = timeDiff(start, end); |
271 | + int fps = static_cast<int>((1000 * 1000 * 1000LL * frames) / diff); |
272 | + //printf("%d frames in %6.2f ms (%3d fps) ", frames, diff / (1000.0f * 1000.0f), fps); |
273 | + printf("%3d fps ", fps); |
274 | + |
275 | + while (fps > 0) |
276 | + { |
277 | + fputc('#', stdout); |
278 | + fps -= 3; |
279 | + } |
280 | + fputc('\n', stdout); |
281 | +} |
282 | + |
283 | +void getScreenSize(int& width, int& height) |
284 | +{ |
285 | + Window rootWindow = DefaultRootWindow(ctx.nativeDisplay); |
286 | + XWindowAttributes rootAttrs; |
287 | + |
288 | + XGetWindowAttributes(ctx.nativeDisplay, rootWindow, &rootAttrs); |
289 | + |
290 | + width = rootAttrs.width; |
291 | + height = rootAttrs.height; |
292 | +} |
293 | + |
294 | +void showIntro() |
295 | +{ |
296 | + std::cout << |
297 | + "GLMemPerf v" PACKAGE_VERSION " - OpenGL ES 2.0 memory performance benchmark\n" |
298 | + "Copyright (C) 2009 Nokia Corporation. GLMemPerf comes with ABSOLUTELY\n" |
299 | + "NO WARRANTY; This is free software, and you are welcome to redistribute\n" |
300 | + "it under certain conditions.\n" |
301 | + "\n"; |
302 | +} |
303 | + |
304 | +void showUsage() |
305 | +{ |
306 | + std::cout << |
307 | + "Usage:\n" |
308 | + " glmemperf [OPTIONS]\n" |
309 | + "Options:\n" |
310 | + " -h This text\n" |
311 | + " -v Verbose mode\n" |
312 | + " -i TEST Include a specific test (full name or substring)\n" |
313 | + " -e TEST Exclude a specific test (full name or substring)\n" |
314 | + " -t SECS Minimum time to run each test\n" |
315 | + " -b BPP Bits per pixel\n"; |
316 | +} |
317 | + |
318 | +void parseArguments(const std::list<std::string>& args) |
319 | +{ |
320 | + std::list<std::string>::const_iterator i; |
321 | + |
322 | + // Set up defaults |
323 | + options.verbose = false; |
324 | + options.minTime = 1; |
325 | + options.bitsPerPixel = 16; |
326 | + |
327 | + for (i = args.begin(), i++; i != args.end(); ++i) |
328 | + { |
329 | + if (*i == "-h" || *i == "--help") |
330 | + { |
331 | + showUsage(); |
332 | + exit(0); |
333 | + } |
334 | + else if (*i == "-i" && ++i != args.end()) |
335 | + { |
336 | + options.includedTests.push_back(*i); |
337 | + } |
338 | + else if (*i == "-e" && ++i != args.end()) |
339 | + { |
340 | + options.excludedTests.push_back(*i); |
341 | + } |
342 | + else if (*i == "-t" && ++i != args.end()) |
343 | + { |
344 | + options.minTime = atoi((*i).c_str()); |
345 | + } |
346 | + else if (*i == "-b" && ++i != args.end()) |
347 | + { |
348 | + options.bitsPerPixel = atoi((*i).c_str()); |
349 | + } |
350 | + else if (*i == "-v") |
351 | + { |
352 | + options.verbose = true; |
353 | + } |
354 | + else |
355 | + { |
356 | + std::cerr << "Invalid option: " << *i << std::endl; |
357 | + showUsage(); |
358 | + exit(1); |
359 | + } |
360 | + } |
361 | +} |
362 | + |
363 | +void findDataDirectory() |
364 | +{ |
365 | + struct stat st; |
366 | + if (stat("data", &st) == 0) |
367 | + { |
368 | + return; |
369 | + } |
370 | + chdir(PREFIX "/share/glmemperf/"); |
371 | + assert(stat("data", &st) == 0); |
372 | +} |
373 | + |
374 | +#define ADD_TEST(TEST) runTest(*std::auto_ptr<Test>(new TEST)); |
375 | + |
376 | +int main(int argc, char** argv) |
377 | +{ |
378 | + std::list<std::string> args(argv, argv + argc); |
379 | + |
380 | + showIntro(); |
381 | + parseArguments(args); |
382 | + findDataDirectory(); |
383 | + |
384 | + const EGLint configAttrs[] = |
385 | + { |
386 | + EGL_BUFFER_SIZE, options.bitsPerPixel, |
387 | + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, |
388 | + EGL_NONE |
389 | + }; |
390 | + |
391 | + const EGLint configAttrs32[] = |
392 | + { |
393 | + EGL_BUFFER_SIZE, 32, |
394 | + EGL_NONE |
395 | + }; |
396 | + |
397 | + const EGLint contextAttrs[] = |
398 | + { |
399 | + EGL_CONTEXT_CLIENT_VERSION, 2, |
400 | + EGL_NONE |
401 | + }; |
402 | + int winWidth = 800; |
403 | + int winHeight = 480; |
404 | + const float w = winWidth, h = winHeight; |
405 | + EGLConfig config32 = 0; |
406 | + EGLint configCount = 0; |
407 | + |
408 | + bool result = nativeCreateDisplay(&ctx.nativeDisplay); |
409 | + assert(result); |
410 | + |
411 | + getScreenSize(winWidth, winHeight); |
412 | + result = initializeEgl(winWidth, winHeight, configAttrs, contextAttrs); |
413 | + assert(result); |
414 | + |
415 | + eglChooseConfig(ctx.dpy, configAttrs32, &config32, 1, &configCount); |
416 | + |
417 | + if (!configCount) |
418 | + { |
419 | + printf("32bpp config not found\n"); |
420 | + } |
421 | + |
422 | + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
423 | + ASSERT_GL(); |
424 | + |
425 | + // Clear test |
426 | + ADD_TEST(ClearTest()); |
427 | + |
428 | + // Normal blits |
429 | + ADD_TEST(BlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 800, 480, "data/water2_800x480_rgba8888.raw")); |
430 | + ADD_TEST(BlitTest(GL_RGB, GL_UNSIGNED_BYTE, 800, 480, "data/water2_800x480_rgb888.raw")); |
431 | + ADD_TEST(BlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 1024, 512, "data/digital_nature2_1024x512_rgba8888.raw", false, 800.0 / 1024, 480.0 / 512)); |
432 | + ADD_TEST(BlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 800, 480, "data/water2_800x480_rgb565.raw")); |
433 | + ADD_TEST(BlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 1024, 512, "data/digital_nature2_1024x512_rgb565.raw", false, 800.0 / 1024, 480.0 / 512)); |
434 | +#ifdef GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG |
435 | + ADD_TEST(BlitTest(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 0, 1024, 512, "data/abstract3_1024x512_pvrtc4.raw", false, 800.0 / 1024, 480.0 / 512)); |
436 | +#endif |
437 | +#ifdef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG |
438 | + ADD_TEST(BlitTest(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, 0, 1024, 512, "data/abstract3_1024x512_pvrtc2.raw", false, 800.0 / 1024, 480.0 / 512)); |
439 | +#endif |
440 | + ADD_TEST(BlitTest(GL_ETC1_RGB8_OES, 0, 1024, 512, "data/abstract3_1024x512_etc1.raw", false, 800.0 / 1024, 480.0 / 512)); |
441 | + ADD_TEST(PixmapBlitTest(w, h, ctx.config)); |
442 | + ADD_TEST(PixmapBlitTest(w, h, config32)); |
443 | + ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, w, h)); |
444 | + ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 1024, 512, false, w / 1024, h / 512)); |
445 | + ADD_TEST(FBOBlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, w, h)); |
446 | + ADD_TEST(FBOBlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 1024, 512, false, w / 1042, h / 512)); |
447 | + |
448 | + // Rotated blits |
449 | + ADD_TEST(BlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 480, 800, "data/water2_480x800_rgba8888.raw", true)); |
450 | + ADD_TEST(BlitTest(GL_RGB, GL_UNSIGNED_BYTE, 480, 800, "data/water2_480x800_rgb888.raw", true)); |
451 | + ADD_TEST(BlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 512, 1024, "data/digital_nature2_512x1024_rgba8888.raw", true, 480.0 / 512, 800.0 / 1024)); |
452 | + ADD_TEST(BlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 480, 800, "data/water2_480x800_rgb565.raw", true)); |
453 | + ADD_TEST(BlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 512, 1024, "data/digital_nature2_512x1024_rgb565.raw", true, 480.0 / 512, 800.0 / 1024)); |
454 | +#ifdef GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG |
455 | + ADD_TEST(BlitTest(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 0, 512, 1024, "data/abstract3_512x1024_pvrtc4.raw", true, 480.0 / 512, 800.0 / 1024)); |
456 | +#endif |
457 | +#ifdef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG |
458 | + ADD_TEST(BlitTest(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, 0, 512, 1024, "data/abstract3_512x1024_pvrtc2.raw", true, 480.0 / 512, 800.0 / 1024)); |
459 | +#endif |
460 | + ADD_TEST(BlitTest(GL_ETC1_RGB8_OES, 0, 512, 1024, "data/abstract3_512x1024_etc1.raw", true, 480.0 / 512, 800.0 / 1024)); |
461 | + ADD_TEST(PixmapBlitTest(h, w, ctx.config, true)); |
462 | + ADD_TEST(PixmapBlitTest(h, w, config32, true)); |
463 | + ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, w, h, true, h / w, w / h)); |
464 | + ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 1024, 512, true, h / 512, w / 1024)); |
465 | + ADD_TEST(FBOBlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, w, h, true, h / w, w / h)); |
466 | + ADD_TEST(FBOBlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 1024, 512, true, h / 512, w / 1024)); |
467 | + |
468 | + int gridW = 5; |
469 | + int gridH = 3; |
470 | + float w2 = winWidth / gridW; |
471 | + float h2 = winHeight / gridH; |
472 | + |
473 | + glEnable(GL_BLEND); |
474 | + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
475 | + |
476 | + // Small blended blits |
477 | + ADD_TEST(BlitTest(GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 128, 128, "data/xorg_128x128_rgba4444.raw", false, gridW, gridH, 128.0 / w2, 128.0 / h2)); |
478 | + ADD_TEST(BlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 127, 127, "data/xorg_127x127_rgba8888.raw", false, gridW, gridH, 127.0 / w2, 127.0 / h2)); |
479 | + ADD_TEST(BlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 128, 128, "data/xorg_128x128_rgba8888.raw", false, gridW, gridH, 128.0 / w2, 128.0 / h2)); |
480 | + ADD_TEST(BlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 127, 127, "data/xorg_127x127_rgb565.raw", false, gridW, gridH, 127.0 / w2, 127.0 / h2)); |
481 | + ADD_TEST(BlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 128, 128, "data/xorg_128x128_rgb565.raw", false, gridW, gridH, 128.0 / w2, 128.0 / h2)); |
482 | +#ifdef GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG |
483 | + ADD_TEST(BlitTest(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 0, 128, 128, "data/xorg_128x128_pvrtc4.raw", false, gridW, gridH, 128.0 / w2, 128.0 / h2)); |
484 | +#endif |
485 | +#ifdef GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG |
486 | + ADD_TEST(BlitTest(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, 0, 128, 128, "data/xorg_128x128_pvrtc2.raw", false, gridW, gridH, 128.0 / w2, 128.0 / h2)); |
487 | +#endif |
488 | + ADD_TEST(BlitTest(GL_ETC1_RGB8_OES, 0, 128, 128, "data/xorg_128x128_etc1.raw", false, gridW, gridH, 128.0 / w2, 128.0 / h2)); |
489 | + ADD_TEST(ShaderBlitTest("mask", 128, 128, gridW, gridH * 0.5f, 128.0 / w2, 128.0 / h2)); |
490 | + |
491 | + // Rotated small blended blits |
492 | + ADD_TEST(BlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 127, 127, "data/xorg_127x127_rgba8888.raw", true, gridH, gridW, 127.0 / w2, 127.0 / h2)); |
493 | + ADD_TEST(BlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 128, 128, "data/xorg_128x128_rgba8888.raw", true, gridH, gridW, 128.0 / w2, 128.0 / h2)); |
494 | + ADD_TEST(BlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 127, 127, "data/xorg_127x127_rgb565.raw", true, gridH, gridW, 127.0 / w2, 127.0 / h2)); |
495 | + ADD_TEST(BlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 128, 128, "data/xorg_128x128_rgb565.raw", true, gridH, gridW, 128.0 / w2, 128.0 / h2)); |
496 | +#ifdef GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG |
497 | + ADD_TEST(BlitTest(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 0, 128, 128, "data/xorg_128x128_pvrtc4.raw", true, gridH, gridW, 128.0 / w2, 128.0 / h2)); |
498 | +#endif |
499 | +#ifdef GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG |
500 | + ADD_TEST(BlitTest(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, 0, 128, 128, "data/xorg_128x128_pvrtc2.raw", true, gridH, gridW, 128.0 / w2, 128.0 / h2)); |
501 | +#endif |
502 | + ADD_TEST(BlitTest(GL_ETC1_RGB8_OES, 0, 128, 128, "data/xorg_128x128_etc1.raw", true, gridH, gridW, 128.0 / w2, 128.0 / h2)); |
503 | + |
504 | + glDisable(GL_BLEND); |
505 | + |
506 | + // Shader tests |
507 | + ADD_TEST(ShaderBlitTest("const", w, h)); |
508 | + ADD_TEST(ShaderBlitTest("lingrad", w, h)); |
509 | + ADD_TEST(ShaderBlitTest("radgrad", w, h)); |
510 | + ADD_TEST(ShaderBlitTest("palette", w, h)); |
511 | + |
512 | + // CPU interleaving |
513 | + ADD_TEST(CPUInterleavingTest(CPUI_XSHM_IMAGE, 2, 16, winWidth, winHeight)); |
514 | + ADD_TEST(CPUInterleavingTest(CPUI_XSHM_IMAGE, 2, 32, winWidth, winHeight)); |
515 | + ADD_TEST(CPUInterleavingTest(CPUI_TEXTURE_UPLOAD, 2, 16, winWidth, winHeight)); |
516 | + ADD_TEST(CPUInterleavingTest(CPUI_TEXTURE_UPLOAD, 2, 32, winWidth, winHeight)); |
517 | + |
518 | + terminateEgl(); |
519 | +} |
520 | |
521 | === added directory '.pc/exception_instead_of_assert.patch' |
522 | === added file '.pc/exception_instead_of_assert.patch/cpuinterleavingtest.cpp' |
523 | --- .pc/exception_instead_of_assert.patch/cpuinterleavingtest.cpp 1970-01-01 00:00:00 +0000 |
524 | +++ .pc/exception_instead_of_assert.patch/cpuinterleavingtest.cpp 2010-08-04 08:33:44 +0000 |
525 | @@ -0,0 +1,315 @@ |
526 | +/** |
527 | + * OpenGL ES 2.0 memory performance estimator |
528 | + * Copyright (C) 2009 Nokia |
529 | + * |
530 | + * This program is free software; you can redistribute it and/or modify |
531 | + * it under the terms of the GNU General Public License as published by |
532 | + * the Free Software Foundation; either version 2 of the License, or |
533 | + * (at your option) any later version. |
534 | + * |
535 | + * This program is distributed in the hope that it will be useful, |
536 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
537 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
538 | + * GNU General Public License for more details. |
539 | + * |
540 | + * You should have received a copy of the GNU General Public License along |
541 | + * with this program; if not, write to the Free Software Foundation, Inc., |
542 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
543 | + * |
544 | + * \author Sami Kyöstilä <sami.kyostila@nokia.com> |
545 | + * |
546 | + * CPU texture streaming test |
547 | + */ |
548 | +#include "cpuinterleavingtest.h" |
549 | +#include "util.h" |
550 | +#include "native.h" |
551 | +#include <sstream> |
552 | +#include <X11/Xlib.h> |
553 | +#include <X11/Xutil.h> |
554 | +#include <X11/extensions/XShm.h> |
555 | +#include <sys/ipc.h> |
556 | +#include <sys/shm.h> |
557 | +#include <stdio.h> |
558 | + |
559 | +template <typename TYPE> |
560 | +void fillTexture(TYPE* pixels, int width, int height, int stride, int frame) |
561 | +{ |
562 | + TYPE color = (TYPE)0xffffffffu; |
563 | + for (int y = 0; y < height; y++) |
564 | + { |
565 | + for (int x = 0; x < width; x++) |
566 | + { |
567 | + if ((x + y + frame) & 0x10) |
568 | + { |
569 | + pixels[x] = color; |
570 | + } |
571 | + else |
572 | + { |
573 | + pixels[x] = 0; |
574 | + } |
575 | + } |
576 | + pixels += stride / sizeof(TYPE); |
577 | + } |
578 | +} |
579 | + |
580 | +CPUInterleavingTest::CPUInterleavingTest(CPUInterleavingMethod method, |
581 | + int buffers, int bitsPerPixel, |
582 | + int width, int height, |
583 | + float texW, float texH): |
584 | + BlitTest(width, height, false, texW, texH), |
585 | + m_method(method), |
586 | + m_buffers(buffers), |
587 | + m_dataBitsPerPixel(bitsPerPixel), |
588 | + m_readBuffer(buffers - 1), |
589 | + m_writeBuffer(0) |
590 | +{ |
591 | +} |
592 | + |
593 | + |
594 | +void CPUInterleavingTest::prepare() |
595 | +{ |
596 | + int i; |
597 | + bool success; |
598 | + |
599 | + BlitTest::prepare(); |
600 | + |
601 | + glGenTextures(m_buffers, m_textures); |
602 | + for (int i = 0; i < m_buffers; i++) |
603 | + { |
604 | + glBindTexture(GL_TEXTURE_2D, m_textures[i]); |
605 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
606 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
607 | + } |
608 | + |
609 | + ASSERT_GL(); |
610 | + |
611 | + switch (m_method) |
612 | + { |
613 | + case CPUI_TEXTURE_UPLOAD: |
614 | + { |
615 | + m_dataStride = m_width * m_dataBitsPerPixel / 8; |
616 | + for (i = 0; i < m_buffers; i++) |
617 | + { |
618 | + m_textureData[i] = new char[m_height * m_dataStride]; |
619 | + } |
620 | + } |
621 | + break; |
622 | + case CPUI_XSHM_IMAGE: |
623 | + { |
624 | + Status shmSupported = XShmQueryExtension(ctx.nativeDisplay); |
625 | + if (!shmSupported) |
626 | + { |
627 | + fail("X11 shared memory extension not supported"); |
628 | + } |
629 | + |
630 | + m_completionEvent = XShmGetEventBase(ctx.nativeDisplay) + ShmCompletion; |
631 | + |
632 | + const EGLint pixmapConfigAttrs[] = |
633 | + { |
634 | + EGL_BUFFER_SIZE, m_dataBitsPerPixel, |
635 | + EGL_NONE |
636 | + }; |
637 | + EGLint configCount = 0; |
638 | + |
639 | + eglChooseConfig(ctx.dpy, pixmapConfigAttrs, &m_config, 1, &configCount); |
640 | + assert(configCount); |
641 | + |
642 | + for (i = 0; i < m_buffers; i++) |
643 | + { |
644 | + success = nativeCreatePixmap(ctx.nativeDisplay, ctx.dpy, |
645 | + m_config, m_width, m_height, &m_pixmaps[i]); |
646 | + assert(success); |
647 | + |
648 | + XGCValues gcValues; |
649 | + m_gc[i] = XCreateGC(ctx.nativeDisplay, m_pixmaps[i], 0, &gcValues); |
650 | + |
651 | + const EGLint surfAttrs[] = |
652 | + { |
653 | + EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB, |
654 | + EGL_TEXTURE_TARGET, EGL_TEXTURE_2D, |
655 | + EGL_MIPMAP_TEXTURE, EGL_FALSE, |
656 | + EGL_NONE |
657 | + }; |
658 | + |
659 | + m_surfaces[i] = eglCreatePixmapSurface(ctx.dpy, m_config, m_pixmaps[i], surfAttrs); |
660 | + assert(m_surfaces[i] != EGL_NO_SURFACE); |
661 | + |
662 | + glBindTexture(GL_TEXTURE_2D, m_textures[i]); |
663 | + success = eglBindTexImage(ctx.dpy, m_surfaces[i], EGL_BACK_BUFFER); |
664 | + assert(success); |
665 | + |
666 | + XVisualInfo visualInfo; |
667 | + XVisualInfo* visual; |
668 | + int visualCount = 0; |
669 | + visualInfo.depth = m_dataBitsPerPixel; |
670 | + visualInfo.screen = DefaultScreen(ctx.nativeDisplay); |
671 | + visual = XGetVisualInfo(ctx.nativeDisplay, VisualDepthMask | VisualScreenMask, |
672 | + &visualInfo, &visualCount); |
673 | + |
674 | + assert(visualCount > 0); |
675 | + |
676 | + m_ximage[i] = XShmCreateImage(ctx.nativeDisplay, visual->visual, m_dataBitsPerPixel, |
677 | + ZPixmap, NULL, |
678 | + &m_shminfo[i], m_width, m_height); |
679 | + m_shminfo[i].shmid = shmget(IPC_PRIVATE, |
680 | + m_ximage[i]->bytes_per_line * |
681 | + m_ximage[i]->height, IPC_CREAT | 0777); |
682 | + m_shminfo[i].shmaddr = m_ximage[i]->data = (char*)shmat(m_shminfo[i].shmid, 0, 0); |
683 | + assert(m_shminfo[i].shmaddr); |
684 | + m_shminfo[i].readOnly = False; |
685 | + Status status = XShmAttach(ctx.nativeDisplay, &m_shminfo[i]); |
686 | + assert(status); |
687 | + |
688 | + m_textureData[i] = m_ximage[i]->data; |
689 | + m_dataStride = m_ximage[i]->bytes_per_line; |
690 | + m_writeCompleted[i] = true; |
691 | + m_drawableIndex[m_pixmaps[i]] = i; |
692 | + } |
693 | + } |
694 | + break; |
695 | + default: |
696 | + assert(0); |
697 | + return; |
698 | + } |
699 | +} |
700 | + |
701 | +void CPUInterleavingTest::teardown() |
702 | +{ |
703 | + int i; |
704 | + glDeleteTextures(m_buffers, m_textures); |
705 | + |
706 | + switch (m_method) |
707 | + { |
708 | + case CPUI_TEXTURE_UPLOAD: |
709 | + { |
710 | + for (i = 0; i < m_buffers; i++) |
711 | + { |
712 | + delete[] m_textureData[i]; |
713 | + } |
714 | + } |
715 | + break; |
716 | + case CPUI_XSHM_IMAGE: |
717 | + { |
718 | + for (i = 0; i < m_buffers; i++) |
719 | + { |
720 | + XShmDetach(ctx.nativeDisplay, &m_shminfo[i]); |
721 | + XDestroyImage(m_ximage[i]); |
722 | + shmdt(m_shminfo[i].shmaddr); |
723 | + shmctl(m_shminfo[i].shmid, IPC_RMID, 0); |
724 | + |
725 | + eglReleaseTexImage(ctx.dpy, m_surfaces[i], EGL_BACK_BUFFER); |
726 | + eglDestroySurface(ctx.dpy, m_surfaces[i]); |
727 | + nativeDestroyPixmap(ctx.nativeDisplay, m_pixmaps[i]); |
728 | + XFreeGC(ctx.nativeDisplay, m_gc[i]); |
729 | + } |
730 | + } |
731 | + break; |
732 | + default: |
733 | + assert(0); |
734 | + return; |
735 | + } |
736 | + |
737 | + BlitTest::teardown(); |
738 | +} |
739 | + |
740 | +std::string CPUInterleavingTest::name() const |
741 | +{ |
742 | + std::stringstream s; |
743 | + |
744 | + s << "blit_cpu_"; |
745 | + |
746 | + switch (m_method) |
747 | + { |
748 | + case CPUI_TEXTURE_UPLOAD: |
749 | + s << "texupload"; |
750 | + break; |
751 | + case CPUI_XSHM_IMAGE: |
752 | + s << "shmimage"; |
753 | + break; |
754 | + case CPUI_IMG_TEXTURE_STREAMING: |
755 | + s << "texstream"; |
756 | + break; |
757 | + case CPUI_PIXEL_BUFFER_OBJECT: |
758 | + s << "pbo"; |
759 | + break; |
760 | + case CPUI_EGL_LOCK_SURFACE: |
761 | + s << "locksurf"; |
762 | + break; |
763 | + } |
764 | + |
765 | + switch (m_dataBitsPerPixel) |
766 | + { |
767 | + case 16: |
768 | + s << "_16bpp"; |
769 | + break; |
770 | + case 32: |
771 | + s << "_32bpp"; |
772 | + break; |
773 | + } |
774 | + |
775 | + s << "_" << m_buffers << "x" << m_width << "x" << m_height; |
776 | + |
777 | + return s.str(); |
778 | +} |
779 | + |
780 | +void CPUInterleavingTest::operator()(int frame) |
781 | +{ |
782 | + switch (m_dataBitsPerPixel) |
783 | + { |
784 | + case 16: |
785 | + fillTexture(reinterpret_cast<uint16_t*>(m_textureData[m_writeBuffer]), |
786 | + m_width, m_height, m_dataStride, frame); |
787 | + break; |
788 | + case 32: |
789 | + fillTexture(reinterpret_cast<uint32_t*>(m_textureData[m_writeBuffer]), |
790 | + m_width, m_height, m_dataStride, frame); |
791 | + break; |
792 | + } |
793 | + |
794 | + glBindTexture(GL_TEXTURE_2D, m_textures[m_writeBuffer]); |
795 | + |
796 | + switch (m_method) |
797 | + { |
798 | + case CPUI_TEXTURE_UPLOAD: |
799 | + if (m_dataBitsPerPixel == 32) |
800 | + { |
801 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, |
802 | + GL_RGBA, GL_UNSIGNED_BYTE, m_textureData[m_writeBuffer]); |
803 | + } |
804 | + else |
805 | + { |
806 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_width, m_height, 0, |
807 | + GL_RGB, GL_UNSIGNED_SHORT_5_6_5, m_textureData[m_writeBuffer]); |
808 | + } |
809 | + break; |
810 | + case CPUI_XSHM_IMAGE: |
811 | + { |
812 | + // Wait for the completion event for this buffer |
813 | + while (XEventsQueued(ctx.nativeDisplay, QueuedAfterReading) > 0 || |
814 | + !m_writeCompleted[m_writeBuffer]) |
815 | + { |
816 | + XEvent event; |
817 | + XNextEvent(ctx.nativeDisplay, &event); |
818 | + if (event.type == m_completionEvent) |
819 | + { |
820 | + XShmCompletionEvent* e = reinterpret_cast<XShmCompletionEvent*>(&event); |
821 | + int i = m_drawableIndex[e->drawable]; |
822 | + m_writeCompleted[i] = true; |
823 | + } |
824 | + } |
825 | + XShmPutImage(ctx.nativeDisplay, m_pixmaps[m_writeBuffer], m_gc[m_writeBuffer], |
826 | + m_ximage[m_writeBuffer], 0, 0, 0, 0, m_width, m_height, True); |
827 | + m_writeCompleted[m_writeBuffer] = false; |
828 | + } |
829 | + break; |
830 | + default: |
831 | + assert(0); |
832 | + break; |
833 | + } |
834 | + |
835 | + glBindTexture(GL_TEXTURE_2D, m_textures[m_readBuffer]); |
836 | + m_writeBuffer = (m_writeBuffer + 1) % m_buffers; |
837 | + m_readBuffer = (m_readBuffer + 1) % m_buffers; |
838 | + |
839 | + BlitTest::operator()(frame); |
840 | +} |
841 | |
842 | === added file '.pc/exception_instead_of_assert.patch/util.h' |
843 | --- .pc/exception_instead_of_assert.patch/util.h 1970-01-01 00:00:00 +0000 |
844 | +++ .pc/exception_instead_of_assert.patch/util.h 2010-08-04 08:33:44 +0000 |
845 | @@ -0,0 +1,154 @@ |
846 | +/** |
847 | + * OpenGL ES 2.0 memory performance estimator |
848 | + * Copyright (C) 2009 Nokia |
849 | + * |
850 | + * This program is free software; you can redistribute it and/or modify |
851 | + * it under the terms of the GNU General Public License as published by |
852 | + * the Free Software Foundation; either version 2 of the License, or |
853 | + * (at your option) any later version. |
854 | + * |
855 | + * This program is distributed in the hope that it will be useful, |
856 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
857 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
858 | + * GNU General Public License for more details. |
859 | + * |
860 | + * You should have received a copy of the GNU General Public License along |
861 | + * with this program; if not, write to the Free Software Foundation, Inc., |
862 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
863 | + * |
864 | + * \author Sami Kyöstilä <sami.kyostila@nokia.com> |
865 | + * |
866 | + * EGL and OpenGL ES utility functions |
867 | + */ |
868 | +#ifndef UTIL_H |
869 | +#define UTIL_H |
870 | + |
871 | +#include <string> |
872 | +#include <GLES2/gl2.h> |
873 | +#include <EGL/egl.h> |
874 | +#include <assert.h> |
875 | + |
876 | +/** |
877 | + * Verify that GL commands up to this point have not produced any errors. |
878 | + */ |
879 | +#define ASSERT_GL() \ |
880 | + do \ |
881 | + { \ |
882 | + GLint err = glGetError(); \ |
883 | + if (err) \ |
884 | + { \ |
885 | + printf("GL error 0x%x (%d) at %s:%d\n", err, err, __FILE__, __LINE__); \ |
886 | + assert(!err); \ |
887 | + } \ |
888 | + } while (0) |
889 | + |
890 | +/** |
891 | + * Verify that EGL commands up to this point have not produced any errors. |
892 | + */ |
893 | +#define ASSERT_EGL() \ |
894 | + do \ |
895 | + { \ |
896 | + EGLint err = eglGetError(); \ |
897 | + if (err != EGL_SUCCESS) \ |
898 | + { \ |
899 | + printf("EGL error 0x%x (%d) at %s:%d\n", err, err, __FILE__, __LINE__); \ |
900 | + assert(!err); \ |
901 | + } \ |
902 | + } while (0) |
903 | + |
904 | +/** |
905 | + * EGL context objects available to all tests |
906 | + */ |
907 | +struct Context |
908 | +{ |
909 | + EGLNativeDisplayType nativeDisplay; |
910 | + EGLConfig config; |
911 | + EGLNativeWindowType win; |
912 | + EGLDisplay dpy; |
913 | + EGLContext context; |
914 | + EGLSurface surface; |
915 | +}; |
916 | + |
917 | +extern struct Context ctx; |
918 | + |
919 | +/** |
920 | + * Indicate that a frame is complete |
921 | + */ |
922 | +void swapBuffers(); |
923 | + |
924 | +/** |
925 | + * Load a texture from a binary file |
926 | + * |
927 | + * @param target Texture target (usually GL_TEXTURE_2D) |
928 | + * @param level Mipmap level |
929 | + * @param internalFormat Internal texture format |
930 | + * @param width Texture width in pixels |
931 | + * @param height Texture height in pixels |
932 | + * @param type Data type |
933 | + * @param fileName File containing the texture data |
934 | + * |
935 | + * @returns true on success, false on failure |
936 | + */ |
937 | +bool loadRawTexture(GLenum target, int level, GLenum internalFormat, int width, |
938 | + int height, GLenum format, GLenum type, const std::string& fileName); |
939 | + |
940 | +/** |
941 | + * Load a compressed texture from a binary file |
942 | + * |
943 | + * @param target Texture target (usually GL_TEXTURE_2D) |
944 | + * @param internalFormat Internal texture format |
945 | + * @param width Texture width in pixels |
946 | + * @param height Texture height in pixels |
947 | + * @param fileName File containing the texture data |
948 | + * |
949 | + * @returns true on success, false on failure |
950 | + */ |
951 | +bool loadCompressedTexture(GLenum target, int level, GLenum internalFormat, int width, |
952 | + int height, const std::string& fileName); |
953 | + |
954 | +/** |
955 | + * Check whether an EGL extension is supported |
956 | + * |
957 | + * @param name Extension name |
958 | + * |
959 | + * @returns true if extension is supported |
960 | + */ |
961 | +bool isEGLExtensionSupported(const std::string& name); |
962 | + |
963 | +/** |
964 | + * Check whether an OpenGL ES extension is supported |
965 | + * |
966 | + * @param name Extension name |
967 | + * |
968 | + * @returns true if extension is supported |
969 | + */ |
970 | +bool isGLExtensionSupported(const std::string& name); |
971 | + |
972 | +/** |
973 | + * Compile a vertex and fragment shader and create a new program from the |
974 | + * result |
975 | + * |
976 | + * @param vertSrc Vertex program source |
977 | + * @param fragSrc Fragment program source |
978 | + * |
979 | + * @returns new program handle |
980 | + */ |
981 | +GLint createProgram(const std::string& vertSrc, const std::string& fragSrc); |
982 | + |
983 | +/** |
984 | + * Describe a texture format and type combination |
985 | + * |
986 | + * @param format Texture format |
987 | + * @param type Texture type |
988 | + */ |
989 | +std::string textureFormatName(GLenum format, GLenum type); |
990 | + |
991 | +/** |
992 | + * Print EGL config attributes on the terminal |
993 | + * |
994 | + * @param dpy EGL display |
995 | + * @param config EGL config |
996 | + */ |
997 | +void dumpConfig(EGLDisplay dpy, EGLConfig config); |
998 | + |
999 | +#endif // UTIL_H |
1000 | |
1001 | === modified file 'cpuinterleavingtest.cpp' |
1002 | --- cpuinterleavingtest.cpp 2010-06-30 11:17:12 +0000 |
1003 | +++ cpuinterleavingtest.cpp 2010-08-04 08:33:44 +0000 |
1004 | @@ -112,7 +112,8 @@ |
1005 | EGLint configCount = 0; |
1006 | |
1007 | eglChooseConfig(ctx.dpy, pixmapConfigAttrs, &m_config, 1, &configCount); |
1008 | - assert(configCount); |
1009 | + if (configCount == 0) |
1010 | + throw GLException("No EGLConfig found"); |
1011 | |
1012 | for (i = 0; i < m_buffers; i++) |
1013 | { |
1014 | |
1015 | === modified file 'debian/changelog' |
1016 | --- debian/changelog 2010-06-30 11:17:12 +0000 |
1017 | +++ debian/changelog 2010-08-04 08:33:44 +0000 |
1018 | @@ -1,3 +1,15 @@ |
1019 | +glmemperf (0.1-0ubuntu2) maverick; urgency=low |
1020 | + |
1021 | + * Ignore problematic benchmarks instead of aborting (LP: #605429) |
1022 | + - debian/patches/do_not_use_invalid_egl_config.patch: |
1023 | + - Use an EGL config only if it is valid. |
1024 | + - debian/patches/exception_instead_of_assert.patch: |
1025 | + - Throw an exception instead of aborting when a GL call fails. |
1026 | + * debian/patches/*.patch: Add 'Bug' field for patches that have been |
1027 | + forwarded upstream. |
1028 | + |
1029 | + -- Alexandros Frantzis <alexandros.frantzis@linaro.org> Wed, 04 Aug 2010 11:27:21 +0300 |
1030 | + |
1031 | glmemperf (0.1-0ubuntu1) maverick; urgency=low |
1032 | |
1033 | * Initial release to linaro/maverick (LP: #600148) |
1034 | |
1035 | === modified file 'debian/patches/add_missing_includes.patch' |
1036 | --- debian/patches/add_missing_includes.patch 2010-06-30 11:17:12 +0000 |
1037 | +++ debian/patches/add_missing_includes.patch 2010-08-04 08:33:44 +0000 |
1038 | @@ -1,6 +1,7 @@ |
1039 | Description: Add missing includes that prevent compilation. |
1040 | Author: Alexandros Frantzis <alexandros.frantzis@linaro.org> |
1041 | -Last-Update: 2010-06-29 |
1042 | +Bug: https://garage.maemo.org/tracker/index.php?func=detail&aid=6168&group_id=1130&atid=4244 |
1043 | +Last-Update: 2010-08-04 |
1044 | --- a/glmemperf.cpp |
1045 | +++ b/glmemperf.cpp |
1046 | @@ -30,6 +30,7 @@ |
1047 | |
1048 | === added file 'debian/patches/do_not_use_invalid_egl_config.patch' |
1049 | --- debian/patches/do_not_use_invalid_egl_config.patch 1970-01-01 00:00:00 +0000 |
1050 | +++ debian/patches/do_not_use_invalid_egl_config.patch 2010-08-04 08:33:44 +0000 |
1051 | @@ -0,0 +1,26 @@ |
1052 | +Description: Use an EGL config only if it is valid |
1053 | +Author: Alexandros Frantzis <alexandros.frantzis@linaro.org> |
1054 | +Bug: https://garage.maemo.org/tracker/index.php?func=detail&aid=6166&group_id=1130&atid=4244 |
1055 | +Last-Update: 2010-08-04 |
1056 | +--- a/glmemperf.cpp |
1057 | ++++ b/glmemperf.cpp |
1058 | +@@ -423,7 +423,8 @@ |
1059 | + #endif |
1060 | + ADD_TEST(BlitTest(GL_ETC1_RGB8_OES, 0, 1024, 512, "data/abstract3_1024x512_etc1.raw", false, 800.0 / 1024, 480.0 / 512)); |
1061 | + ADD_TEST(PixmapBlitTest(w, h, ctx.config)); |
1062 | +- ADD_TEST(PixmapBlitTest(w, h, config32)); |
1063 | ++ if (config32) |
1064 | ++ ADD_TEST(PixmapBlitTest(w, h, config32)); |
1065 | + ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, w, h)); |
1066 | + ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 1024, 512, false, w / 1024, h / 512)); |
1067 | + ADD_TEST(FBOBlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, w, h)); |
1068 | +@@ -443,7 +444,8 @@ |
1069 | + #endif |
1070 | + ADD_TEST(BlitTest(GL_ETC1_RGB8_OES, 0, 512, 1024, "data/abstract3_512x1024_etc1.raw", true, 480.0 / 512, 800.0 / 1024)); |
1071 | + ADD_TEST(PixmapBlitTest(h, w, ctx.config, true)); |
1072 | +- ADD_TEST(PixmapBlitTest(h, w, config32, true)); |
1073 | ++ if (config32) |
1074 | ++ ADD_TEST(PixmapBlitTest(h, w, config32, true)); |
1075 | + ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, w, h, true, h / w, w / h)); |
1076 | + ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 1024, 512, true, h / 512, w / 1024)); |
1077 | + ADD_TEST(FBOBlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, w, h, true, h / w, w / h)); |
1078 | |
1079 | === added file 'debian/patches/exception_instead_of_assert.patch' |
1080 | --- debian/patches/exception_instead_of_assert.patch 1970-01-01 00:00:00 +0000 |
1081 | +++ debian/patches/exception_instead_of_assert.patch 2010-08-04 08:33:44 +0000 |
1082 | @@ -0,0 +1,59 @@ |
1083 | +Description: Throw an exception instead of aborting the program when a GL call fails |
1084 | +Author: Alexandros Frantzis <alexandros.frantzis@linaro.org> |
1085 | +Bug: https://garage.maemo.org/tracker/index.php?func=detail&aid=6166&group_id=1130&atid=4244 |
1086 | +Last-Update: 2010-08-04 |
1087 | +--- a/cpuinterleavingtest.cpp |
1088 | ++++ b/cpuinterleavingtest.cpp |
1089 | +@@ -112,7 +112,8 @@ |
1090 | + EGLint configCount = 0; |
1091 | + |
1092 | + eglChooseConfig(ctx.dpy, pixmapConfigAttrs, &m_config, 1, &configCount); |
1093 | +- assert(configCount); |
1094 | ++ if (configCount == 0) |
1095 | ++ throw GLException("No EGLConfig found"); |
1096 | + |
1097 | + for (i = 0; i < m_buffers; i++) |
1098 | + { |
1099 | +--- a/util.h |
1100 | ++++ b/util.h |
1101 | +@@ -28,6 +28,16 @@ |
1102 | + #include <EGL/egl.h> |
1103 | + #include <assert.h> |
1104 | + |
1105 | ++class GLException : public std::exception { |
1106 | ++public: |
1107 | ++ GLException(const char *what) : m_what(what) { } |
1108 | ++ ~GLException() throw() { } |
1109 | ++ const char *what() const throw() { return m_what.c_str(); } |
1110 | ++ |
1111 | ++private: |
1112 | ++ std::string m_what; |
1113 | ++}; |
1114 | ++ |
1115 | + /** |
1116 | + * Verify that GL commands up to this point have not produced any errors. |
1117 | + */ |
1118 | +@@ -37,8 +47,9 @@ |
1119 | + GLint err = glGetError(); \ |
1120 | + if (err) \ |
1121 | + { \ |
1122 | +- printf("GL error 0x%x (%d) at %s:%d\n", err, err, __FILE__, __LINE__); \ |
1123 | +- assert(!err); \ |
1124 | ++ char msg[100]; \ |
1125 | ++ snprintf(msg, 100, "GL error 0x%x (%d) at %s:%d", err, err, __FILE__, __LINE__); \ |
1126 | ++ throw GLException(msg); \ |
1127 | + } \ |
1128 | + } while (0) |
1129 | + |
1130 | +@@ -51,8 +62,9 @@ |
1131 | + EGLint err = eglGetError(); \ |
1132 | + if (err != EGL_SUCCESS) \ |
1133 | + { \ |
1134 | +- printf("EGL error 0x%x (%d) at %s:%d\n", err, err, __FILE__, __LINE__); \ |
1135 | +- assert(!err); \ |
1136 | ++ char msg[100]; \ |
1137 | ++ snprintf(msg, 100, "EGL error 0x%x (%d) at %s:%d", err, err, __FILE__, __LINE__); \ |
1138 | ++ throw GLException(msg); \ |
1139 | + } \ |
1140 | + } while (0) |
1141 | + |
1142 | |
1143 | === modified file 'debian/patches/optional_gles2_defines.patch' |
1144 | --- debian/patches/optional_gles2_defines.patch 2010-06-30 11:17:12 +0000 |
1145 | +++ debian/patches/optional_gles2_defines.patch 2010-08-04 08:33:44 +0000 |
1146 | @@ -1,6 +1,7 @@ |
1147 | Description: Don't add certain tests if the relevant GL texture format is missing. |
1148 | Author: Alexandros Frantzis <alexandros.frantzis@linaro.org> |
1149 | -Last-Update: 2010-06-29 |
1150 | +Bug: https://garage.maemo.org/tracker/index.php?func=detail&aid=6169&group_id=1130&atid=4244 |
1151 | +Last-Update: 2010-08-04 |
1152 | --- a/glmemperf.cpp |
1153 | +++ b/glmemperf.cpp |
1154 | @@ -414,8 +414,12 @@ |
1155 | |
1156 | === modified file 'debian/patches/series' |
1157 | --- debian/patches/series 2010-06-30 11:17:12 +0000 |
1158 | +++ debian/patches/series 2010-08-04 08:33:44 +0000 |
1159 | @@ -1,4 +1,6 @@ |
1160 | optional_gles2_defines.patch |
1161 | add_missing_includes.patch |
1162 | +exception_instead_of_assert.patch |
1163 | +do_not_use_invalid_egl_config.patch |
1164 | no_makefile_in_debian_dir.patch |
1165 | autoreconf.patch |
1166 | |
1167 | === modified file 'glmemperf.cpp' |
1168 | --- glmemperf.cpp 2010-06-30 11:17:12 +0000 |
1169 | +++ glmemperf.cpp 2010-08-04 08:33:44 +0000 |
1170 | @@ -423,7 +423,8 @@ |
1171 | #endif |
1172 | ADD_TEST(BlitTest(GL_ETC1_RGB8_OES, 0, 1024, 512, "data/abstract3_1024x512_etc1.raw", false, 800.0 / 1024, 480.0 / 512)); |
1173 | ADD_TEST(PixmapBlitTest(w, h, ctx.config)); |
1174 | - ADD_TEST(PixmapBlitTest(w, h, config32)); |
1175 | + if (config32) |
1176 | + ADD_TEST(PixmapBlitTest(w, h, config32)); |
1177 | ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, w, h)); |
1178 | ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 1024, 512, false, w / 1024, h / 512)); |
1179 | ADD_TEST(FBOBlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, w, h)); |
1180 | @@ -443,7 +444,8 @@ |
1181 | #endif |
1182 | ADD_TEST(BlitTest(GL_ETC1_RGB8_OES, 0, 512, 1024, "data/abstract3_512x1024_etc1.raw", true, 480.0 / 512, 800.0 / 1024)); |
1183 | ADD_TEST(PixmapBlitTest(h, w, ctx.config, true)); |
1184 | - ADD_TEST(PixmapBlitTest(h, w, config32, true)); |
1185 | + if (config32) |
1186 | + ADD_TEST(PixmapBlitTest(h, w, config32, true)); |
1187 | ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, w, h, true, h / w, w / h)); |
1188 | ADD_TEST(FBOBlitTest(GL_RGBA, GL_UNSIGNED_BYTE, 1024, 512, true, h / 512, w / 1024)); |
1189 | ADD_TEST(FBOBlitTest(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, w, h, true, h / w, w / h)); |
1190 | |
1191 | === modified file 'util.h' |
1192 | --- util.h 2010-06-30 11:17:12 +0000 |
1193 | +++ util.h 2010-08-04 08:33:44 +0000 |
1194 | @@ -28,6 +28,16 @@ |
1195 | #include <EGL/egl.h> |
1196 | #include <assert.h> |
1197 | |
1198 | +class GLException : public std::exception { |
1199 | +public: |
1200 | + GLException(const char *what) : m_what(what) { } |
1201 | + ~GLException() throw() { } |
1202 | + const char *what() const throw() { return m_what.c_str(); } |
1203 | + |
1204 | +private: |
1205 | + std::string m_what; |
1206 | +}; |
1207 | + |
1208 | /** |
1209 | * Verify that GL commands up to this point have not produced any errors. |
1210 | */ |
1211 | @@ -37,8 +47,9 @@ |
1212 | GLint err = glGetError(); \ |
1213 | if (err) \ |
1214 | { \ |
1215 | - printf("GL error 0x%x (%d) at %s:%d\n", err, err, __FILE__, __LINE__); \ |
1216 | - assert(!err); \ |
1217 | + char msg[100]; \ |
1218 | + snprintf(msg, 100, "GL error 0x%x (%d) at %s:%d", err, err, __FILE__, __LINE__); \ |
1219 | + throw GLException(msg); \ |
1220 | } \ |
1221 | } while (0) |
1222 | |
1223 | @@ -51,8 +62,9 @@ |
1224 | EGLint err = eglGetError(); \ |
1225 | if (err != EGL_SUCCESS) \ |
1226 | { \ |
1227 | - printf("EGL error 0x%x (%d) at %s:%d\n", err, err, __FILE__, __LINE__); \ |
1228 | - assert(!err); \ |
1229 | + char msg[100]; \ |
1230 | + snprintf(msg, 100, "EGL error 0x%x (%d) at %s:%d", err, err, __FILE__, __LINE__); \ |
1231 | + throw GLException(msg); \ |
1232 | } \ |
1233 | } while (0) |
1234 |
Have these patches been forwarded upstream? If so please update the quilt headers appropriately. If not, please do so :)