1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief EGL EGL_KHR_fence_sync and EGL_KHR_reusable_sync tests
22 *//*--------------------------------------------------------------------*/
24 #include "teglSyncTests.hpp"
26 #include "egluNativeWindow.hpp"
27 #include "egluStrUtil.hpp"
28 #include "egluUtil.hpp"
30 #include "eglwLibrary.hpp"
31 #include "eglwEnums.hpp"
33 #include "tcuTestLog.hpp"
34 #include "tcuCommandLine.hpp"
36 #include "gluDefs.hpp"
38 #include "glwFunctions.hpp"
39 #include "glwEnums.hpp"
62 const char* getSyncTypeName (EGLenum syncType)
66 case EGL_SYNC_FENCE_KHR: return "EGL_SYNC_FENCE_KHR";
67 case EGL_SYNC_REUSABLE_KHR: return "EGL_SYNC_REUSABLE_KHR";
74 class SyncTest : public TestCase
80 EXTENSION_WAIT_SYNC = (0x1 << 0),
81 EXTENSION_FENCE_SYNC = (0x1 << 1),
82 EXTENSION_REUSABLE_SYNC = (0x1 << 2)
84 SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, const char* name, const char* description);
91 const EGLenum m_syncType;
92 const Extension m_extensions;
96 EGLDisplay m_eglDisplay;
97 EGLConfig m_eglConfig;
98 EGLSurface m_eglSurface;
99 eglu::NativeWindow* m_nativeWindow;
100 EGLContext m_eglContext;
104 SyncTest::SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, const char* name, const char* description)
105 : TestCase (eglTestCtx, name, description)
106 , m_syncType (syncType)
107 , m_extensions (extensions)
108 , m_eglDisplay (EGL_NO_DISPLAY)
109 , m_eglSurface (EGL_NO_SURFACE)
110 , m_nativeWindow (DE_NULL)
111 , m_eglContext (EGL_NO_CONTEXT)
112 , m_sync (EGL_NO_SYNC_KHR)
116 SyncTest::~SyncTest (void)
121 void requiredEGLExtensions (const Library& egl, EGLDisplay display, SyncTest::Extension requiredExtensions)
123 SyncTest::Extension foundExtensions = SyncTest::EXTENSION_NONE;
124 std::istringstream extensionStream(egl.queryString(display, EGL_EXTENSIONS));
127 EGLU_CHECK_MSG(egl, "eglQueryString(display, EGL_EXTENSIONS)");
129 while (std::getline(extensionStream, extension, ' '))
131 if (extension == "EGL_KHR_fence_sync")
132 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_FENCE_SYNC);
133 else if (extension == "EGL_KHR_reusable_sync")
134 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_REUSABLE_SYNC);
135 else if (extension == "EGL_KHR_wait_sync")
136 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_WAIT_SYNC);
140 const SyncTest::Extension missingExtensions = (SyncTest::Extension)((foundExtensions & requiredExtensions) ^ requiredExtensions);
142 if ((missingExtensions & SyncTest::EXTENSION_FENCE_SYNC) != 0)
143 TCU_THROW(NotSupportedError, "EGL_KHR_fence_sync not supported");
145 if ((missingExtensions & SyncTest::EXTENSION_REUSABLE_SYNC) != 0)
146 TCU_THROW(NotSupportedError, "EGL_KHR_reusable_sync not supported");
148 if ((missingExtensions & SyncTest::EXTENSION_WAIT_SYNC) != 0)
149 TCU_THROW(NotSupportedError, "EGL_KHR_wait_sync not supported");
153 void requiredGLESExtensions (const glw::Functions& gl)
156 std::istringstream extensionStream((const char*)gl.getString(GL_EXTENSIONS));
159 GLU_CHECK_GLW_MSG(gl, "glGetString(GL_EXTENSIONS)");
161 while (std::getline(extensionStream, extension, ' '))
163 if (extension == "GL_OES_EGL_sync")
168 TCU_THROW(NotSupportedError, "GL_OES_EGL_sync not supported");
171 SyncTest::Extension getSyncTypeExtension (EGLenum syncType)
175 case EGL_SYNC_FENCE_KHR: return SyncTest::EXTENSION_FENCE_SYNC;
176 case EGL_SYNC_REUSABLE_KHR: return SyncTest::EXTENSION_REUSABLE_SYNC;
179 return SyncTest::EXTENSION_NONE;
183 void SyncTest::init (void)
185 const Library& egl = m_eglTestCtx.getLibrary();
186 const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
188 const EGLint displayAttribList[] =
190 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
191 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
196 const EGLint contextAttribList[] =
198 EGL_CONTEXT_CLIENT_VERSION, 2,
202 m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
203 m_eglConfig = eglu::chooseSingleConfig(egl, m_eglDisplay, displayAttribList);
205 m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
208 const Extension syncTypeExtension = getSyncTypeExtension(m_syncType);
209 requiredEGLExtensions(egl, m_eglDisplay, (Extension)(m_extensions | syncTypeExtension));
213 EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
214 m_eglContext = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttribList);
215 EGLU_CHECK_MSG(egl, "Failed to create GLES2 context");
218 m_nativeWindow = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
219 m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_nativeWindow, m_eglDisplay, m_eglConfig, DE_NULL);
221 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext));
223 requiredGLESExtensions(m_gl);
226 void SyncTest::deinit (void)
228 const Library& egl = m_eglTestCtx.getLibrary();
230 if (m_eglDisplay != EGL_NO_DISPLAY)
232 if (m_sync != EGL_NO_SYNC_KHR)
234 EGLU_CHECK_CALL(egl, destroySyncKHR(m_eglDisplay, m_sync));
235 m_sync = EGL_NO_SYNC_KHR;
238 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
240 if (m_eglContext != EGL_NO_CONTEXT)
242 EGLU_CHECK_CALL(egl, destroyContext(m_eglDisplay, m_eglContext));
243 m_eglContext = EGL_NO_CONTEXT;
246 if (m_eglSurface != EGL_NO_SURFACE)
248 EGLU_CHECK_CALL(egl, destroySurface(m_eglDisplay, m_eglSurface));
249 m_eglSurface = EGL_NO_SURFACE;
252 delete m_nativeWindow;
253 m_nativeWindow = DE_NULL;
255 egl.terminate(m_eglDisplay);
256 m_eglDisplay = EGL_NO_DISPLAY;
260 class CreateNullAttribsTest : public SyncTest
263 CreateNullAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_null_attribs", "create_null_attribs") {}
265 IterateResult iterate (void)
267 const Library& egl = m_eglTestCtx.getLibrary();
268 TestLog& log = m_testCtx.getLog();
270 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
271 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
272 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
274 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
279 class CreateEmptyAttribsTest : public SyncTest
282 CreateEmptyAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_empty_attribs", "create_empty_attribs") {}
284 IterateResult iterate (void)
287 const Library& egl = m_eglTestCtx.getLibrary();
288 TestLog& log = m_testCtx.getLog();
289 const EGLint attribList[] =
294 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, attribList);
295 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", { EGL_NONE })" << TestLog::EndMessage;
296 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
298 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
303 class CreateInvalidDisplayTest : public SyncTest
306 CreateInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_display", "create_invalid_display") {}
308 IterateResult iterate (void)
310 const Library& egl = m_eglTestCtx.getLibrary();
311 TestLog& log = m_testCtx.getLog();
313 m_sync = egl.createSyncKHR(EGL_NO_DISPLAY, m_syncType, NULL);
314 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(EGL_NO_DISPLAY, " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
316 EGLint error = egl.getError();
317 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
319 if (error != EGL_BAD_DISPLAY)
321 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
322 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
326 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
328 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
333 class CreateInvalidTypeTest : public SyncTest
336 CreateInvalidTypeTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_type", "create_invalid_type") {}
338 IterateResult iterate (void)
340 const Library& egl = m_eglTestCtx.getLibrary();
341 TestLog& log = m_testCtx.getLog();
343 m_sync = egl.createSyncKHR(m_eglDisplay, EGL_NONE, NULL);
344 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", EGL_NONE, NULL)" << TestLog::EndMessage;
346 EGLint error = egl.getError();
347 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
349 if (error != EGL_BAD_ATTRIBUTE)
351 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
352 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
356 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
358 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
363 class CreateInvalidAttribsTest : public SyncTest
366 CreateInvalidAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_attribs", "create_invalid_attribs") {}
368 IterateResult iterate (void)
370 const Library& egl = m_eglTestCtx.getLibrary();
371 TestLog& log = m_testCtx.getLog();
378 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, attribs);
379 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", { 2, 3, 4, 5, EGL_NONE })" << TestLog::EndMessage;
381 EGLint error = egl.getError();
382 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
384 if (error != EGL_BAD_ATTRIBUTE)
386 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
387 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
391 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
393 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
398 class CreateInvalidContextTest : public SyncTest
401 CreateInvalidContextTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_context", "create_invalid_context") {}
403 IterateResult iterate (void)
405 const Library& egl = m_eglTestCtx.getLibrary();
406 TestLog& log = m_testCtx.getLog();
408 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
409 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
411 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
412 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
414 EGLint error = egl.getError();
415 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
417 if (error != EGL_BAD_MATCH)
419 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_MATCH" << TestLog::EndMessage;
420 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
424 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
426 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
431 class ClientWaitNoTimeoutTest : public SyncTest
434 ClientWaitNoTimeoutTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_no_timeout", "wait_no_timeout") {}
436 IterateResult iterate (void)
438 const Library& egl = m_eglTestCtx.getLibrary();
439 TestLog& log = m_testCtx.getLog();
441 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
442 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
443 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
445 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, 0);
446 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
448 if (m_syncType == EGL_SYNC_FENCE_KHR)
449 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR || status == EGL_TIMEOUT_EXPIRED_KHR);
450 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
451 TCU_CHECK(status == EGL_TIMEOUT_EXPIRED_KHR);
455 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
461 class ClientWaitForeverTest : public SyncTest
464 ClientWaitForeverTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_forever", "wait_forever") {}
466 IterateResult iterate (void)
468 const Library& egl = m_eglTestCtx.getLibrary();
469 TestLog& log = m_testCtx.getLog();
471 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
472 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
473 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
475 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
477 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
478 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
479 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
481 else if (m_syncType == EGL_SYNC_FENCE_KHR)
483 GLU_CHECK_GLW_CALL(m_gl, flush());
484 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
489 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, EGL_FOREVER_KHR);
490 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
492 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
493 EGLU_CHECK_MSG(egl, "eglClientWaitSyncKHR()");
495 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
500 class ClientWaitNoContextTest : public SyncTest
503 ClientWaitNoContextTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_no_context", "wait_no_Context") {}
505 IterateResult iterate (void)
507 const Library& egl = m_eglTestCtx.getLibrary();
508 TestLog& log = m_testCtx.getLog();
510 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
511 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
512 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
515 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
517 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
518 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
519 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
521 else if (m_syncType == EGL_SYNC_FENCE_KHR)
523 GLU_CHECK_GLW_CALL(m_gl, flush());
524 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
529 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
530 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
532 EGLint result = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, EGL_FOREVER_KHR);
533 log << TestLog::Message << result << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
535 TCU_CHECK(result == EGL_CONDITION_SATISFIED_KHR);
537 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
542 class ClientWaitForeverFlushTest : public SyncTest
545 ClientWaitForeverFlushTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_forever_flush", "wait_forever_flush") {}
547 IterateResult iterate (void)
549 const Library& egl = m_eglTestCtx.getLibrary();
550 TestLog& log = m_testCtx.getLog();
552 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
553 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
554 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
556 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
558 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
559 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
560 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
563 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
564 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
566 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
568 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
573 class ClientWaitInvalidDisplayTest : public SyncTest
576 ClientWaitInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_invalid_display", "wait_invalid_display") {}
578 IterateResult iterate (void)
580 const Library& egl = m_eglTestCtx.getLibrary();
581 TestLog& log = m_testCtx.getLog();
583 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
584 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
585 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
587 EGLint status = egl.clientWaitSyncKHR(EGL_NO_DISPLAY, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
588 log << TestLog::Message << status << " = eglClientWaitSyncKHR(EGL_NO_DISPLAY, " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
590 EGLint error = egl.getError();
591 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
593 if (error != EGL_BAD_DISPLAY)
595 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
596 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
600 TCU_CHECK(status == EGL_FALSE);
602 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
607 class ClientWaitInvalidSyncTest : public SyncTest
610 ClientWaitInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_invalid_sync", "wait_invalid_sync") {}
612 IterateResult iterate (void)
614 const Library& egl = m_eglTestCtx.getLibrary();
615 TestLog& log = m_testCtx.getLog();
617 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR, 0, EGL_FOREVER_KHR);
618 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
620 EGLint error = egl.getError();
621 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
623 if (error != EGL_BAD_PARAMETER)
625 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
626 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
630 TCU_CHECK(status == EGL_FALSE);
632 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
637 class GetSyncTypeTest : public SyncTest
640 GetSyncTypeTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_type", "get_type") {}
642 IterateResult iterate (void)
644 const Library& egl = m_eglTestCtx.getLibrary();
645 TestLog& log = m_testCtx.getLog();
647 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
648 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
649 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
652 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_TYPE_KHR, &type));
653 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_TYPE_KHR, {" << type << "})" << TestLog::EndMessage;
655 TCU_CHECK(type == ((EGLint)m_syncType));
657 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
662 class GetSyncStatusTest : public SyncTest
665 GetSyncStatusTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_status", "get_status") {}
667 IterateResult iterate (void)
669 const Library& egl = m_eglTestCtx.getLibrary();
670 TestLog& log = m_testCtx.getLog();
672 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
673 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
674 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
677 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_STATUS_KHR, &status));
678 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_STATUS_KHR, {" << status << "})" << TestLog::EndMessage;
680 if (m_syncType == EGL_SYNC_FENCE_KHR)
681 TCU_CHECK(status == EGL_SIGNALED_KHR || status == EGL_UNSIGNALED_KHR);
682 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
683 TCU_CHECK(status == EGL_UNSIGNALED_KHR);
685 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
690 class GetSyncStatusSignaledTest : public SyncTest
693 GetSyncStatusSignaledTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_status_signaled", "get_status_signaled") {}
695 IterateResult iterate (void)
697 const Library& egl = m_eglTestCtx.getLibrary();
698 TestLog& log = m_testCtx.getLog();
700 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
701 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
702 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
704 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
706 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
707 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
708 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
710 else if (m_syncType == EGL_SYNC_FENCE_KHR)
712 GLU_CHECK_GLW_CALL(m_gl, finish());
713 log << TestLog::Message << "glFinish()" << TestLog::EndMessage;
719 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
720 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
721 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
725 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_STATUS_KHR, &status));
726 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_STATUS_KHR, {" << status << "})" << TestLog::EndMessage;
728 TCU_CHECK(status == EGL_SIGNALED_KHR);
730 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
735 class GetSyncConditionTest : public SyncTest
738 GetSyncConditionTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_condition", "get_condition") {}
740 IterateResult iterate (void)
742 const Library& egl = m_eglTestCtx.getLibrary();
743 TestLog& log = m_testCtx.getLog();
745 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
746 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
747 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
749 EGLint condition = 0;
750 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_CONDITION_KHR, &condition));
751 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
753 TCU_CHECK(condition == EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR);
755 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
760 class GetSyncInvalidDisplayTest : public SyncTest
763 GetSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_display", "get_invalid_display") {}
765 IterateResult iterate (void)
767 const Library& egl = m_eglTestCtx.getLibrary();
768 TestLog& log = m_testCtx.getLog();
770 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
771 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
772 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
774 EGLint condition = 0xF0F0F;
775 EGLBoolean result = egl.getSyncAttribKHR(EGL_NO_DISPLAY, m_sync, EGL_SYNC_CONDITION_KHR, &condition);
776 log << TestLog::Message << result << " = eglGetSyncAttribKHR(EGL_NO_DISPLAY, " << m_sync << ", EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
778 EGLint error = egl.getError();
779 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
781 if (error != EGL_BAD_DISPLAY)
783 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
784 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
788 TCU_CHECK(result == EGL_FALSE);
789 TCU_CHECK(condition == 0xF0F0F);
791 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
796 class GetSyncInvalidSyncTest : public SyncTest
799 GetSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_sync", "get_invalid_sync") {}
801 IterateResult iterate (void)
803 const Library& egl = m_eglTestCtx.getLibrary();
804 TestLog& log = m_testCtx.getLog();
806 EGLint condition = 0xF0F0F;
807 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, EGL_NO_SYNC_KHR, EGL_SYNC_CONDITION_KHR, &condition);
808 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
810 EGLint error = egl.getError();
811 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
813 if (error != EGL_BAD_PARAMETER)
815 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
816 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
820 TCU_CHECK(result == EGL_FALSE);
821 TCU_CHECK(condition == 0xF0F0F);
823 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
828 class GetSyncInvalidAttributeTest : public SyncTest
831 GetSyncInvalidAttributeTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_attribute", "get_invalid_attribute") {}
833 IterateResult iterate (void)
835 const Library& egl = m_eglTestCtx.getLibrary();
836 TestLog& log = m_testCtx.getLog();
838 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
839 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
840 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
842 EGLint condition = 0xF0F0F;
843 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, m_sync, EGL_NONE, &condition);
844 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_NONE, {" << condition << "})" << TestLog::EndMessage;
846 EGLint error = egl.getError();
847 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
849 if (error != EGL_BAD_ATTRIBUTE)
851 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
852 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
856 TCU_CHECK(result == EGL_FALSE);
857 TCU_CHECK(condition == 0xF0F0F);
859 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
864 class GetSyncInvalidValueTest : public SyncTest
867 GetSyncInvalidValueTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_value", "get_invalid_value") {}
869 IterateResult iterate (void)
871 const Library& egl = m_eglTestCtx.getLibrary();
872 TestLog& log = m_testCtx.getLog();
874 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
875 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
876 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
878 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_TYPE_KHR, NULL);
879 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_CONDITION_KHR, NULL)" << TestLog::EndMessage;
881 EGLint error = egl.getError();
882 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
884 if (error != EGL_BAD_PARAMETER)
886 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
887 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
891 TCU_CHECK(result == EGL_FALSE);
893 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
898 class DestroySyncTest : public SyncTest
901 DestroySyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "destroy", "destroy") {}
903 IterateResult iterate (void)
905 const Library& egl = m_eglTestCtx.getLibrary();
906 TestLog& log = m_testCtx.getLog();
908 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
909 log << TestLog::Message << "eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
910 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
912 log << TestLog::Message << "eglDestroySyncKHR(" << m_eglDisplay << ", " << m_sync << ")" << TestLog::EndMessage;
913 EGLU_CHECK_CALL(egl, destroySyncKHR(m_eglDisplay, m_sync));
914 m_sync = EGL_NO_SYNC_KHR;
916 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
921 class DestroySyncInvalidDislayTest : public SyncTest
924 DestroySyncInvalidDislayTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "destroy_invalid_display", "destroy_invalid_display") {}
926 IterateResult iterate (void)
928 const Library& egl = m_eglTestCtx.getLibrary();
929 TestLog& log = m_testCtx.getLog();
931 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
932 log << TestLog::Message << "eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
933 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
935 EGLBoolean result = egl.destroySyncKHR(EGL_NO_DISPLAY, m_sync);
936 log << TestLog::Message << result << " = eglDestroySyncKHR(EGL_NO_DISPLAY, " << m_sync << ")" << TestLog::EndMessage;
938 EGLint error = egl.getError();
939 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
941 if (error != EGL_BAD_DISPLAY)
943 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
944 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
948 TCU_CHECK(result == EGL_FALSE);
950 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
955 class DestroySyncInvalidSyncTest : public SyncTest
958 DestroySyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "destroy_invalid_sync", "destroy_invalid_sync") {}
960 IterateResult iterate (void)
962 const Library& egl = m_eglTestCtx.getLibrary();
963 TestLog& log = m_testCtx.getLog();
965 EGLBoolean result = egl.destroySyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR);
966 log << TestLog::Message << result << " = eglDestroySyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR)" << TestLog::EndMessage;
968 EGLint error = egl.getError();
969 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
971 if (error != EGL_BAD_PARAMETER)
973 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
974 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
978 TCU_CHECK(result == EGL_FALSE);
980 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
985 class WaitSyncTest : public SyncTest
988 WaitSyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server", "wait_server") {}
990 IterateResult iterate (void)
992 const Library& egl = m_eglTestCtx.getLibrary();
993 TestLog& log = m_testCtx.getLog();
995 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
996 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
997 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
999 EGLint status = egl.waitSyncKHR(m_eglDisplay, m_sync, 0);
1000 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
1002 TCU_CHECK(status == EGL_TRUE);
1004 GLU_CHECK_GLW_CALL(m_gl, finish());
1006 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1012 class WaitSyncInvalidDisplayTest : public SyncTest
1015 WaitSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server_invalid_display", "wait_server_invalid_display") {}
1017 IterateResult iterate (void)
1019 const Library& egl = m_eglTestCtx.getLibrary();
1020 TestLog& log = m_testCtx.getLog();
1022 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1023 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1024 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1026 EGLint status = egl.waitSyncKHR(EGL_NO_DISPLAY, m_sync, 0);
1027 log << TestLog::Message << status << " = eglWaitSyncKHR(EGL_NO_DISPLAY, " << m_sync << ", 0)" << TestLog::EndMessage;
1029 EGLint error = egl.getError();
1030 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1032 if (error != EGL_BAD_DISPLAY)
1034 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1035 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1039 TCU_CHECK(status == EGL_FALSE);
1041 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1046 class WaitSyncInvalidSyncTest : public SyncTest
1049 WaitSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server_invalid_sync", "wait_server_invalid_sync") {}
1051 IterateResult iterate (void)
1053 const Library& egl = m_eglTestCtx.getLibrary();
1054 TestLog& log = m_testCtx.getLog();
1056 EGLint status = egl.waitSyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR, 0);
1057 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, 0)" << TestLog::EndMessage;
1059 EGLint error = egl.getError();
1060 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1062 if (error != EGL_BAD_PARAMETER)
1064 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1065 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1069 TCU_CHECK(status == EGL_FALSE);
1071 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1076 class WaitSyncInvalidFlagTest : public SyncTest
1079 WaitSyncInvalidFlagTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server_invalid_flag", "wait_server_invalid_flag") {}
1081 IterateResult iterate (void)
1083 const Library& egl = m_eglTestCtx.getLibrary();
1084 TestLog& log = m_testCtx.getLog();
1086 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1087 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1088 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1090 EGLint status = egl.waitSyncKHR(m_eglDisplay, m_sync, 0xFFFFFFFF);
1091 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0xFFFFFFFF)" << TestLog::EndMessage;
1093 EGLint error = egl.getError();
1094 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1096 if (error != EGL_BAD_PARAMETER)
1098 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1099 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1103 TCU_CHECK(status == EGL_FALSE);
1105 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1112 FenceSyncTests::FenceSyncTests (EglTestContext& eglTestCtx)
1113 : TestCaseGroup (eglTestCtx, "fence_sync", "EGL_KHR_fence_sync extension tests")
1117 void FenceSyncTests::init (void)
1119 // Add valid API test
1121 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
1123 // eglCreateSyncKHR tests
1124 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1125 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1127 // eglClientWaitSyncKHR tests
1128 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1129 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1130 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1131 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1133 // eglGetSyncAttribKHR tests
1134 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1135 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1136 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1137 valid->addChild(new GetSyncConditionTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1139 // eglDestroySyncKHR tests
1140 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1142 // eglWaitSyncKHR tests
1143 valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1148 // Add negative API tests
1150 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
1152 // eglCreateSyncKHR tests
1153 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1154 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1155 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1156 invalid->addChild(new CreateInvalidContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1158 // eglClientWaitSyncKHR tests
1159 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1160 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1162 // eglGetSyncAttribKHR tests
1163 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1164 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1165 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1166 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1168 // eglDestroySyncKHR tests
1169 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1170 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1172 // eglWaitSyncKHR tests
1173 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1174 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1175 invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1181 ReusableSyncTests::ReusableSyncTests (EglTestContext& eglTestCtx)
1182 : TestCaseGroup (eglTestCtx, "reusable_sync", "EGL_KHR_reusable_sync extension tests")
1186 void ReusableSyncTests::init (void)
1188 // Add valid API test
1190 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
1192 // eglCreateSyncKHR tests
1193 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1194 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1196 // eglClientWaitSyncKHR tests
1197 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1198 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1199 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1200 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1202 // eglGetSyncAttribKHR tests
1203 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1204 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1205 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1207 // eglDestroySyncKHR tests
1208 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1210 // eglWaitSyncKHR tests
1211 valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1216 // Add negative API tests
1218 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
1220 // eglCreateSyncKHR tests
1221 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1222 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1223 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1225 // eglClientWaitSyncKHR tests
1226 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1227 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1229 // eglGetSyncAttribKHR tests
1230 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1231 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1232 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1233 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1235 // eglDestroySyncKHR tests
1236 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1237 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1239 // eglWaitSyncKHR tests
1240 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1241 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1242 invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));