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)
114 m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
117 SyncTest::~SyncTest (void)
122 void requiredEGLExtensions (const Library& egl, EGLDisplay display, SyncTest::Extension requiredExtensions)
124 SyncTest::Extension foundExtensions = SyncTest::EXTENSION_NONE;
125 std::istringstream extensionStream(egl.queryString(display, EGL_EXTENSIONS));
128 EGLU_CHECK_MSG(egl, "eglQueryString(display, EGL_EXTENSIONS)");
130 while (std::getline(extensionStream, extension, ' '))
132 if (extension == "EGL_KHR_fence_sync")
133 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_FENCE_SYNC);
134 else if (extension == "EGL_KHR_reusable_sync")
135 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_REUSABLE_SYNC);
136 else if (extension == "EGL_KHR_wait_sync")
137 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_WAIT_SYNC);
141 const SyncTest::Extension missingExtensions = (SyncTest::Extension)((foundExtensions & requiredExtensions) ^ requiredExtensions);
143 if ((missingExtensions & SyncTest::EXTENSION_FENCE_SYNC) != 0)
144 TCU_THROW(NotSupportedError, "EGL_KHR_fence_sync not supported");
146 if ((missingExtensions & SyncTest::EXTENSION_REUSABLE_SYNC) != 0)
147 TCU_THROW(NotSupportedError, "EGL_KHR_reusable_sync not supported");
149 if ((missingExtensions & SyncTest::EXTENSION_WAIT_SYNC) != 0)
150 TCU_THROW(NotSupportedError, "EGL_KHR_wait_sync not supported");
154 void requiredGLESExtensions (const glw::Functions& gl)
157 std::istringstream extensionStream((const char*)gl.getString(GL_EXTENSIONS));
160 GLU_CHECK_GLW_MSG(gl, "glGetString(GL_EXTENSIONS)");
162 while (std::getline(extensionStream, extension, ' '))
164 if (extension == "GL_OES_EGL_sync")
169 TCU_THROW(NotSupportedError, "GL_OES_EGL_sync not supported");
172 SyncTest::Extension getSyncTypeExtension (EGLenum syncType)
176 case EGL_SYNC_FENCE_KHR: return SyncTest::EXTENSION_FENCE_SYNC;
177 case EGL_SYNC_REUSABLE_KHR: return SyncTest::EXTENSION_REUSABLE_SYNC;
180 return SyncTest::EXTENSION_NONE;
184 void SyncTest::init (void)
186 const Library& egl = m_eglTestCtx.getLibrary();
187 const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
189 const EGLint displayAttribList[] =
191 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
192 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
197 const EGLint contextAttribList[] =
199 EGL_CONTEXT_CLIENT_VERSION, 2,
203 m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
204 m_eglConfig = eglu::chooseSingleConfig(egl, m_eglDisplay, displayAttribList);
207 const Extension syncTypeExtension = getSyncTypeExtension(m_syncType);
208 requiredEGLExtensions(egl, m_eglDisplay, (Extension)(m_extensions | syncTypeExtension));
212 EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
213 m_eglContext = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttribList);
214 EGLU_CHECK_MSG(egl, "Failed to create GLES2 context");
217 m_nativeWindow = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
218 m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_nativeWindow, m_eglDisplay, m_eglConfig, DE_NULL);
220 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext));
222 requiredGLESExtensions(m_gl);
225 void SyncTest::deinit (void)
227 const Library& egl = m_eglTestCtx.getLibrary();
229 if (m_eglDisplay != EGL_NO_DISPLAY)
231 if (m_sync != EGL_NO_SYNC_KHR)
233 EGLU_CHECK_CALL(egl, destroySyncKHR(m_eglDisplay, m_sync));
234 m_sync = EGL_NO_SYNC_KHR;
237 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
239 if (m_eglContext != EGL_NO_CONTEXT)
241 EGLU_CHECK_CALL(egl, destroyContext(m_eglDisplay, m_eglContext));
242 m_eglContext = EGL_NO_CONTEXT;
245 if (m_eglSurface != EGL_NO_SURFACE)
247 EGLU_CHECK_CALL(egl, destroySurface(m_eglDisplay, m_eglSurface));
248 m_eglSurface = EGL_NO_SURFACE;
251 delete m_nativeWindow;
252 m_nativeWindow = DE_NULL;
254 egl.terminate(m_eglDisplay);
255 m_eglDisplay = EGL_NO_DISPLAY;
259 class CreateNullAttribsTest : public SyncTest
262 CreateNullAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_null_attribs", "create_null_attribs") {}
264 IterateResult iterate (void)
266 const Library& egl = m_eglTestCtx.getLibrary();
267 TestLog& log = m_testCtx.getLog();
269 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
270 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
271 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
273 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
278 class CreateEmptyAttribsTest : public SyncTest
281 CreateEmptyAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_empty_attribs", "create_empty_attribs") {}
283 IterateResult iterate (void)
286 const Library& egl = m_eglTestCtx.getLibrary();
287 TestLog& log = m_testCtx.getLog();
288 const EGLint attribList[] =
293 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, attribList);
294 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", { EGL_NONE })" << TestLog::EndMessage;
295 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
297 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
302 class CreateInvalidDisplayTest : public SyncTest
305 CreateInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_display", "create_invalid_display") {}
307 IterateResult iterate (void)
309 const Library& egl = m_eglTestCtx.getLibrary();
310 TestLog& log = m_testCtx.getLog();
312 m_sync = egl.createSyncKHR(EGL_NO_DISPLAY, m_syncType, NULL);
313 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(EGL_NO_DISPLAY, " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
315 EGLint error = egl.getError();
316 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
318 if (error != EGL_BAD_DISPLAY)
320 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
321 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
325 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
327 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
332 class CreateInvalidTypeTest : public SyncTest
335 CreateInvalidTypeTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_type", "create_invalid_type") {}
337 IterateResult iterate (void)
339 const Library& egl = m_eglTestCtx.getLibrary();
340 TestLog& log = m_testCtx.getLog();
342 m_sync = egl.createSyncKHR(m_eglDisplay, EGL_NONE, NULL);
343 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", EGL_NONE, NULL)" << TestLog::EndMessage;
345 EGLint error = egl.getError();
346 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
348 if (error != EGL_BAD_ATTRIBUTE)
350 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
351 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
355 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
357 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
362 class CreateInvalidAttribsTest : public SyncTest
365 CreateInvalidAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_attribs", "create_invalid_attribs") {}
367 IterateResult iterate (void)
369 const Library& egl = m_eglTestCtx.getLibrary();
370 TestLog& log = m_testCtx.getLog();
377 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, attribs);
378 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", { 2, 3, 4, 5, EGL_NONE })" << TestLog::EndMessage;
380 EGLint error = egl.getError();
381 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
383 if (error != EGL_BAD_ATTRIBUTE)
385 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
386 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
390 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
392 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
397 class CreateInvalidContextTest : public SyncTest
400 CreateInvalidContextTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_context", "create_invalid_context") {}
402 IterateResult iterate (void)
404 const Library& egl = m_eglTestCtx.getLibrary();
405 TestLog& log = m_testCtx.getLog();
407 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
408 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
410 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
411 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
413 EGLint error = egl.getError();
414 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
416 if (error != EGL_BAD_MATCH)
418 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_MATCH" << TestLog::EndMessage;
419 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
423 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
425 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
430 class ClientWaitNoTimeoutTest : public SyncTest
433 ClientWaitNoTimeoutTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_no_timeout", "wait_no_timeout") {}
435 IterateResult iterate (void)
437 const Library& egl = m_eglTestCtx.getLibrary();
438 TestLog& log = m_testCtx.getLog();
440 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
441 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
442 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
444 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, 0);
445 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
447 if (m_syncType == EGL_SYNC_FENCE_KHR)
448 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR || status == EGL_TIMEOUT_EXPIRED_KHR);
449 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
450 TCU_CHECK(status == EGL_TIMEOUT_EXPIRED_KHR);
454 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
460 class ClientWaitForeverTest : public SyncTest
463 ClientWaitForeverTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_forever", "wait_forever") {}
465 IterateResult iterate (void)
467 const Library& egl = m_eglTestCtx.getLibrary();
468 TestLog& log = m_testCtx.getLog();
470 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
471 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
472 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
474 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
476 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
477 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
478 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
480 else if (m_syncType == EGL_SYNC_FENCE_KHR)
482 GLU_CHECK_GLW_CALL(m_gl, flush());
483 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
488 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, EGL_FOREVER_KHR);
489 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
491 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
492 EGLU_CHECK_MSG(egl, "eglClientWaitSyncKHR()");
494 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
499 class ClientWaitNoContextTest : public SyncTest
502 ClientWaitNoContextTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_no_context", "wait_no_Context") {}
504 IterateResult iterate (void)
506 const Library& egl = m_eglTestCtx.getLibrary();
507 TestLog& log = m_testCtx.getLog();
509 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
510 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
511 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
514 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
516 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
517 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
518 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
520 else if (m_syncType == EGL_SYNC_FENCE_KHR)
522 GLU_CHECK_GLW_CALL(m_gl, flush());
523 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
528 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
529 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
531 EGLint result = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, EGL_FOREVER_KHR);
532 log << TestLog::Message << result << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
534 TCU_CHECK(result == EGL_CONDITION_SATISFIED_KHR);
536 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
541 class ClientWaitForeverFlushTest : public SyncTest
544 ClientWaitForeverFlushTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_forever_flush", "wait_forever_flush") {}
546 IterateResult iterate (void)
548 const Library& egl = m_eglTestCtx.getLibrary();
549 TestLog& log = m_testCtx.getLog();
551 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
552 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
553 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
555 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
557 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
558 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
559 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
562 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
563 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
565 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
567 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
572 class ClientWaitInvalidDisplayTest : public SyncTest
575 ClientWaitInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_invalid_display", "wait_invalid_display") {}
577 IterateResult iterate (void)
579 const Library& egl = m_eglTestCtx.getLibrary();
580 TestLog& log = m_testCtx.getLog();
582 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
583 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
584 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
586 EGLint status = egl.clientWaitSyncKHR(EGL_NO_DISPLAY, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
587 log << TestLog::Message << status << " = eglClientWaitSyncKHR(EGL_NO_DISPLAY, " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
589 EGLint error = egl.getError();
590 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
592 if (error != EGL_BAD_DISPLAY)
594 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
595 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
599 TCU_CHECK(status == EGL_FALSE);
601 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
606 class ClientWaitInvalidSyncTest : public SyncTest
609 ClientWaitInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_invalid_sync", "wait_invalid_sync") {}
611 IterateResult iterate (void)
613 const Library& egl = m_eglTestCtx.getLibrary();
614 TestLog& log = m_testCtx.getLog();
616 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR, 0, EGL_FOREVER_KHR);
617 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
619 EGLint error = egl.getError();
620 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
622 if (error != EGL_BAD_PARAMETER)
624 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
625 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
629 TCU_CHECK(status == EGL_FALSE);
631 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
636 class ClientWaitInvalidFlagTest : public SyncTest
639 ClientWaitInvalidFlagTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_invalid_flag", "wait_invalid_flag") {}
641 IterateResult iterate (void)
643 const Library& egl = m_eglTestCtx.getLibrary();
644 TestLog& log = m_testCtx.getLog();
646 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
647 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
648 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
650 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0xFFFFFFFF, EGL_FOREVER_KHR);
651 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0xFFFFFFFF, EGL_FOREVER_KHR)" << TestLog::EndMessage;
653 EGLint error = egl.getError();
654 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
656 if (error != EGL_BAD_PARAMETER)
658 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
659 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
663 TCU_CHECK(status == EGL_FALSE);
665 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
670 class GetSyncTypeTest : public SyncTest
673 GetSyncTypeTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_type", "get_type") {}
675 IterateResult iterate (void)
677 const Library& egl = m_eglTestCtx.getLibrary();
678 TestLog& log = m_testCtx.getLog();
680 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
681 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
682 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
685 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_TYPE_KHR, &type));
686 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_TYPE_KHR, {" << type << "})" << TestLog::EndMessage;
688 TCU_CHECK(type == ((EGLint)m_syncType));
690 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
695 class GetSyncStatusTest : public SyncTest
698 GetSyncStatusTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_status", "get_status") {}
700 IterateResult iterate (void)
702 const Library& egl = m_eglTestCtx.getLibrary();
703 TestLog& log = m_testCtx.getLog();
705 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
706 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
707 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
710 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_STATUS_KHR, &status));
711 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_STATUS_KHR, {" << status << "})" << TestLog::EndMessage;
713 if (m_syncType == EGL_SYNC_FENCE_KHR)
714 TCU_CHECK(status == EGL_SIGNALED_KHR || status == EGL_UNSIGNALED_KHR);
715 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
716 TCU_CHECK(status == EGL_UNSIGNALED_KHR);
718 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
723 class GetSyncStatusSignaledTest : public SyncTest
726 GetSyncStatusSignaledTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_status_signaled", "get_status_signaled") {}
728 IterateResult iterate (void)
730 const Library& egl = m_eglTestCtx.getLibrary();
731 TestLog& log = m_testCtx.getLog();
733 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
734 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
735 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
737 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
739 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
740 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
741 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
743 else if (m_syncType == EGL_SYNC_FENCE_KHR)
745 GLU_CHECK_GLW_CALL(m_gl, finish());
746 log << TestLog::Message << "glFinish()" << TestLog::EndMessage;
752 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
753 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
754 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
758 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_STATUS_KHR, &status));
759 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_STATUS_KHR, {" << status << "})" << TestLog::EndMessage;
761 TCU_CHECK(status == EGL_SIGNALED_KHR);
763 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
768 class GetSyncConditionTest : public SyncTest
771 GetSyncConditionTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_condition", "get_condition") {}
773 IterateResult iterate (void)
775 const Library& egl = m_eglTestCtx.getLibrary();
776 TestLog& log = m_testCtx.getLog();
778 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
779 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
780 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
782 EGLint condition = 0;
783 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_CONDITION_KHR, &condition));
784 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
786 TCU_CHECK(condition == EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR);
788 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
793 class GetSyncInvalidDisplayTest : public SyncTest
796 GetSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_display", "get_invalid_display") {}
798 IterateResult iterate (void)
800 const Library& egl = m_eglTestCtx.getLibrary();
801 TestLog& log = m_testCtx.getLog();
803 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
804 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
805 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
807 EGLint condition = 0xF0F0F;
808 EGLBoolean result = egl.getSyncAttribKHR(EGL_NO_DISPLAY, m_sync, EGL_SYNC_CONDITION_KHR, &condition);
809 log << TestLog::Message << result << " = eglGetSyncAttribKHR(EGL_NO_DISPLAY, " << m_sync << ", EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
811 EGLint error = egl.getError();
812 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
814 if (error != EGL_BAD_DISPLAY)
816 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
817 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
821 TCU_CHECK(result == EGL_FALSE);
822 TCU_CHECK(condition == 0xF0F0F);
824 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
829 class GetSyncInvalidSyncTest : public SyncTest
832 GetSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_sync", "get_invalid_sync") {}
834 IterateResult iterate (void)
836 const Library& egl = m_eglTestCtx.getLibrary();
837 TestLog& log = m_testCtx.getLog();
839 EGLint condition = 0xF0F0F;
840 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, EGL_NO_SYNC_KHR, EGL_SYNC_CONDITION_KHR, &condition);
841 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
843 EGLint error = egl.getError();
844 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
846 if (error != EGL_BAD_PARAMETER)
848 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
849 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
853 TCU_CHECK(result == EGL_FALSE);
854 TCU_CHECK(condition == 0xF0F0F);
856 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
861 class GetSyncInvalidAttributeTest : public SyncTest
864 GetSyncInvalidAttributeTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_attribute", "get_invalid_attribute") {}
866 IterateResult iterate (void)
868 const Library& egl = m_eglTestCtx.getLibrary();
869 TestLog& log = m_testCtx.getLog();
871 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
872 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
873 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
875 EGLint condition = 0xF0F0F;
876 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, m_sync, EGL_NONE, &condition);
877 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_NONE, {" << condition << "})" << TestLog::EndMessage;
879 EGLint error = egl.getError();
880 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
882 if (error != EGL_BAD_ATTRIBUTE)
884 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
885 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
889 TCU_CHECK(result == EGL_FALSE);
890 TCU_CHECK(condition == 0xF0F0F);
892 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
897 class GetSyncInvalidValueTest : public SyncTest
900 GetSyncInvalidValueTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_value", "get_invalid_value") {}
902 IterateResult iterate (void)
904 const Library& egl = m_eglTestCtx.getLibrary();
905 TestLog& log = m_testCtx.getLog();
907 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
908 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
909 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
911 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_TYPE_KHR, NULL);
912 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_CONDITION_KHR, NULL)" << TestLog::EndMessage;
914 EGLint error = egl.getError();
915 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
917 if (error != EGL_BAD_PARAMETER)
919 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
920 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
924 TCU_CHECK(result == EGL_FALSE);
926 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
931 class DestroySyncTest : public SyncTest
934 DestroySyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "destroy", "destroy") {}
936 IterateResult iterate (void)
938 const Library& egl = m_eglTestCtx.getLibrary();
939 TestLog& log = m_testCtx.getLog();
941 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
942 log << TestLog::Message << "eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
943 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
945 log << TestLog::Message << "eglDestroySyncKHR(" << m_eglDisplay << ", " << m_sync << ")" << TestLog::EndMessage;
946 EGLU_CHECK_CALL(egl, destroySyncKHR(m_eglDisplay, m_sync));
947 m_sync = EGL_NO_SYNC_KHR;
949 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
954 class DestroySyncInvalidDislayTest : public SyncTest
957 DestroySyncInvalidDislayTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "destroy_invalid_display", "destroy_invalid_display") {}
959 IterateResult iterate (void)
961 const Library& egl = m_eglTestCtx.getLibrary();
962 TestLog& log = m_testCtx.getLog();
964 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
965 log << TestLog::Message << "eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
966 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
968 EGLBoolean result = egl.destroySyncKHR(EGL_NO_DISPLAY, m_sync);
969 log << TestLog::Message << result << " = eglDestroySyncKHR(EGL_NO_DISPLAY, " << m_sync << ")" << TestLog::EndMessage;
971 EGLint error = egl.getError();
972 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
974 if (error != EGL_BAD_DISPLAY)
976 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
977 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
981 TCU_CHECK(result == EGL_FALSE);
983 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
988 class DestroySyncInvalidSyncTest : public SyncTest
991 DestroySyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "destroy_invalid_sync", "destroy_invalid_sync") {}
993 IterateResult iterate (void)
995 const Library& egl = m_eglTestCtx.getLibrary();
996 TestLog& log = m_testCtx.getLog();
998 EGLBoolean result = egl.destroySyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR);
999 log << TestLog::Message << result << " = eglDestroySyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR)" << TestLog::EndMessage;
1001 EGLint error = egl.getError();
1002 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1004 if (error != EGL_BAD_PARAMETER)
1006 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1007 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1011 TCU_CHECK(result == EGL_FALSE);
1013 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1018 class WaitSyncTest : public SyncTest
1021 WaitSyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server", "wait_server") {}
1023 IterateResult iterate (void)
1025 const Library& egl = m_eglTestCtx.getLibrary();
1026 TestLog& log = m_testCtx.getLog();
1028 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1029 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1030 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1032 EGLint status = egl.waitSyncKHR(m_eglDisplay, m_sync, 0);
1033 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
1035 TCU_CHECK(status == EGL_TRUE);
1037 GLU_CHECK_GLW_CALL(m_gl, finish());
1039 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1045 class WaitSyncInvalidDisplayTest : public SyncTest
1048 WaitSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server_invalid_display", "wait_server_invalid_display") {}
1050 IterateResult iterate (void)
1052 const Library& egl = m_eglTestCtx.getLibrary();
1053 TestLog& log = m_testCtx.getLog();
1055 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1056 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1057 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1059 EGLint status = egl.waitSyncKHR(EGL_NO_DISPLAY, m_sync, 0);
1060 log << TestLog::Message << status << " = eglWaitSyncKHR(EGL_NO_DISPLAY, " << m_sync << ", 0)" << TestLog::EndMessage;
1062 EGLint error = egl.getError();
1063 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1065 if (error != EGL_BAD_DISPLAY)
1067 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1068 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1072 TCU_CHECK(status == EGL_FALSE);
1074 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1079 class WaitSyncInvalidSyncTest : public SyncTest
1082 WaitSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server_invalid_sync", "wait_server_invalid_sync") {}
1084 IterateResult iterate (void)
1086 const Library& egl = m_eglTestCtx.getLibrary();
1087 TestLog& log = m_testCtx.getLog();
1089 EGLint status = egl.waitSyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR, 0);
1090 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, 0)" << TestLog::EndMessage;
1092 EGLint error = egl.getError();
1093 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1095 if (error != EGL_BAD_PARAMETER)
1097 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1098 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1102 TCU_CHECK(status == EGL_FALSE);
1104 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1109 class WaitSyncInvalidFlagTest : public SyncTest
1112 WaitSyncInvalidFlagTest (EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server_invalid_flag", "wait_server_invalid_flag") {}
1114 IterateResult iterate (void)
1116 const Library& egl = m_eglTestCtx.getLibrary();
1117 TestLog& log = m_testCtx.getLog();
1119 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1120 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1121 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1123 EGLint status = egl.waitSyncKHR(m_eglDisplay, m_sync, 0xFFFFFFFF);
1124 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0xFFFFFFFF)" << TestLog::EndMessage;
1126 EGLint error = egl.getError();
1127 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1129 if (error != EGL_BAD_PARAMETER)
1131 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1132 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1136 TCU_CHECK(status == EGL_FALSE);
1138 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1145 FenceSyncTests::FenceSyncTests (EglTestContext& eglTestCtx)
1146 : TestCaseGroup (eglTestCtx, "fence_sync", "EGL_KHR_fence_sync extension tests")
1150 void FenceSyncTests::init (void)
1152 // Add valid API test
1154 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
1156 // eglCreateSyncKHR tests
1157 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1158 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1160 // eglClientWaitSyncKHR tests
1161 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1162 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1163 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1164 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1166 // eglGetSyncAttribKHR tests
1167 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1168 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1169 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1170 valid->addChild(new GetSyncConditionTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1172 // eglDestroySyncKHR tests
1173 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1175 // eglWaitSyncKHR tests
1176 valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1181 // Add negative API tests
1183 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
1185 // eglCreateSyncKHR tests
1186 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1187 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1188 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1189 invalid->addChild(new CreateInvalidContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1191 // eglClientWaitSyncKHR tests
1192 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1193 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1194 invalid->addChild(new ClientWaitInvalidFlagTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1196 // eglGetSyncAttribKHR tests
1197 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1198 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1199 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1200 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1202 // eglDestroySyncKHR tests
1203 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1204 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1206 // eglWaitSyncKHR tests
1207 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1208 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1209 invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1215 ReusableSyncTests::ReusableSyncTests (EglTestContext& eglTestCtx)
1216 : TestCaseGroup (eglTestCtx, "reusable_sync", "EGL_KHR_reusable_sync extension tests")
1220 void ReusableSyncTests::init (void)
1222 // Add valid API test
1224 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
1226 // eglCreateSyncKHR tests
1227 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1228 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1230 // eglClientWaitSyncKHR tests
1231 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1232 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1233 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1234 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1236 // eglGetSyncAttribKHR tests
1237 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1238 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1239 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1241 // eglDestroySyncKHR tests
1242 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1244 // eglWaitSyncKHR tests
1245 valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1250 // Add negative API tests
1252 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
1254 // eglCreateSyncKHR tests
1255 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1256 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1257 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1259 // eglClientWaitSyncKHR tests
1260 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1261 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1262 invalid->addChild(new ClientWaitInvalidFlagTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1264 // eglGetSyncAttribKHR tests
1265 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1266 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1267 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1268 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1270 // eglDestroySyncKHR tests
1271 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1272 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1274 // eglWaitSyncKHR tests
1275 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1276 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1277 invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));