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 "deStringUtil.hpp"
28 #include "egluNativeWindow.hpp"
29 #include "egluStrUtil.hpp"
30 #include "egluUtil.hpp"
32 #include "eglwLibrary.hpp"
33 #include "eglwEnums.hpp"
35 #include "tcuTestLog.hpp"
36 #include "tcuCommandLine.hpp"
38 #include "gluDefs.hpp"
40 #include "glwFunctions.hpp"
41 #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
77 typedef EGLSync (Library::*createSync)(EGLDisplay, EGLenum, const EGLAttrib *) const ;
78 typedef EGLSyncKHR (Library::*createSyncKHR)(EGLDisplay, EGLenum, const EGLint *) const ;
79 typedef EGLint (Library::*clientWaitSync)(EGLDisplay, EGLSync, EGLint, EGLTime) const ;
80 typedef EGLint (Library::*clientWaitSyncKHR)(EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR) const ;
81 typedef EGLBoolean (Library::*getSyncAttrib)(EGLDisplay, EGLSync, EGLint, EGLAttrib *) const ;
82 typedef EGLBoolean (Library::*getSyncAttribKHR)(EGLDisplay, EGLSyncKHR, EGLint, EGLint *) const ;
83 typedef EGLBoolean (Library::*destroySync)(EGLDisplay, EGLSync) const ;
84 typedef EGLBoolean (Library::*destroySyncKHR)(EGLDisplay, EGLSyncKHR) const ;
85 typedef EGLBoolean (Library::*waitSync)(EGLDisplay, EGLSync, EGLint) const ;
86 typedef EGLint (Library::*waitSyncKHR)(EGLDisplay, EGLSyncKHR, EGLint) const ;
90 FUNC_NAME_CREATE_SYNC,
91 FUNC_NAME_CLIENT_WAIT_SYNC,
92 FUNC_NAME_GET_SYNC_ATTRIB,
93 FUNC_NAME_DESTROY_SYNC,
101 EXTENSION_WAIT_SYNC = (0x1 << 0),
102 EXTENSION_FENCE_SYNC = (0x1 << 1),
103 EXTENSION_REUSABLE_SYNC = (0x1 << 2)
105 SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, bool useCurrentContext, const char* name, const char* description);
106 virtual ~SyncTest (void);
110 bool hasRequiredEGLVersion(int requiredMajor, int requiredMinor);
111 bool hasEGLFenceSyncExtension(void);
112 bool hasEGLWaitSyncExtension(void);
113 EGLDisplay getEglDisplay() {return m_eglDisplay;}
116 const EGLenum m_syncType;
117 const bool m_useCurrentContext;
121 Extension m_extensions;
122 EGLDisplay m_eglDisplay;
123 EGLConfig m_eglConfig;
124 EGLSurface m_eglSurface;
125 eglu::NativeWindow* m_nativeWindow;
126 EGLContext m_eglContext;
128 string m_funcNames[FUNC_NAME_NUM_NAMES];
129 string m_funcNamesKHR[FUNC_NAME_NUM_NAMES];
132 SyncTest::SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, bool useCurrentContext, const char* name, const char* description)
133 : TestCase (eglTestCtx, name, description)
134 , m_syncType (syncType)
135 , m_useCurrentContext (useCurrentContext)
136 , m_extensions (extensions)
137 , m_eglDisplay (EGL_NO_DISPLAY)
138 , m_eglConfig (((eglw::EGLConfig)0)) // EGL_NO_CONFIG
139 , m_eglSurface (EGL_NO_SURFACE)
140 , m_nativeWindow (DE_NULL)
141 , m_eglContext (EGL_NO_CONTEXT)
142 , m_sync (EGL_NO_SYNC_KHR)
144 m_funcNames[FUNC_NAME_CREATE_SYNC] = "eglCreateSync";
145 m_funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] = "eglClientWaitSync";
146 m_funcNames[FUNC_NAME_GET_SYNC_ATTRIB] = "eglGetSyncAttrib";
147 m_funcNames[FUNC_NAME_DESTROY_SYNC] = "eglDestroySync";
148 m_funcNames[FUNC_NAME_WAIT_SYNC] = "eglWaitSync";
150 m_funcNamesKHR[FUNC_NAME_CREATE_SYNC] = "eglCreateSyncKHR";
151 m_funcNamesKHR[FUNC_NAME_CLIENT_WAIT_SYNC] = "eglClientWaitSyncKHR";
152 m_funcNamesKHR[FUNC_NAME_GET_SYNC_ATTRIB] = "eglGetSyncAttribKHR";
153 m_funcNamesKHR[FUNC_NAME_DESTROY_SYNC] = "eglDestroySyncKHR";
154 m_funcNamesKHR[FUNC_NAME_WAIT_SYNC] = "eglWaitSyncKHR";
157 SyncTest::~SyncTest (void)
162 bool SyncTest::hasRequiredEGLVersion (int requiredMajor, int requiredMinor)
164 const Library& egl = m_eglTestCtx.getLibrary();
165 TestLog& log = m_testCtx.getLog();
166 eglu::Version version = eglu::getVersion(egl, m_eglDisplay);
168 if (version < eglu::Version(requiredMajor, requiredMinor))
170 log << TestLog::Message << "Required EGL version is not supported. "
171 "Has: " << version.getMajor() << "." << version.getMinor()
172 << ", Required: " << requiredMajor << "." << requiredMinor << TestLog::EndMessage;
179 bool SyncTest::hasEGLFenceSyncExtension (void)
181 TestLog& log = m_testCtx.getLog();
183 if (!eglu::hasExtension(m_eglTestCtx.getLibrary(), m_eglDisplay, "EGL_KHR_fence_sync"))
185 log << TestLog::Message << "EGL_KHR_fence_sync not supported" << TestLog::EndMessage;
192 bool SyncTest::hasEGLWaitSyncExtension (void)
194 TestLog& log = m_testCtx.getLog();
196 if (!eglu::hasExtension(m_eglTestCtx.getLibrary(), m_eglDisplay, "EGL_KHR_wait_sync"))
198 log << TestLog::Message << "EGL_KHR_wait_sync not supported" << TestLog::EndMessage;
205 void requiredGLESExtensions (const glw::Functions& gl)
208 std::istringstream extensionStream((const char*)gl.getString(GL_EXTENSIONS));
211 GLU_CHECK_GLW_MSG(gl, "glGetString(GL_EXTENSIONS)");
213 while (std::getline(extensionStream, extension, ' '))
215 if (extension == "GL_OES_EGL_sync")
220 TCU_THROW(NotSupportedError, "GL_OES_EGL_sync not supported");
223 SyncTest::Extension getSyncTypeExtension (EGLenum syncType)
227 case EGL_SYNC_FENCE_KHR: return SyncTest::EXTENSION_FENCE_SYNC;
228 case EGL_SYNC_REUSABLE_KHR: return SyncTest::EXTENSION_REUSABLE_SYNC;
231 return SyncTest::EXTENSION_NONE;
235 void SyncTest::init (void)
237 const Library& egl = m_eglTestCtx.getLibrary();
238 const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
240 const EGLint displayAttribList[] =
242 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
243 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
248 const EGLint contextAttribList[] =
250 EGL_CONTEXT_CLIENT_VERSION, 2,
254 m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
255 m_eglConfig = eglu::chooseSingleConfig(egl, m_eglDisplay, displayAttribList);
257 m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
259 m_extensions = (Extension)(m_extensions | getSyncTypeExtension(m_syncType));
261 if (m_useCurrentContext)
264 EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
265 m_eglContext = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttribList);
266 EGLU_CHECK_MSG(egl, "Failed to create GLES2 context");
269 m_nativeWindow = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
270 m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_nativeWindow, m_eglDisplay, m_eglConfig, DE_NULL);
272 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext));
274 requiredGLESExtensions(m_gl);
277 // Verify EXTENSION_REUSABLE_SYNC is supported before running the tests
278 if (m_syncType == EGL_SYNC_REUSABLE_KHR) {
279 if (!eglu::hasExtension(m_eglTestCtx.getLibrary(), m_eglDisplay, "EGL_KHR_reusable_sync"))
281 TCU_THROW(NotSupportedError, "EGL_KHR_reusable_sync not supported");
286 void SyncTest::deinit (void)
288 const Library& egl = m_eglTestCtx.getLibrary();
290 if (m_eglDisplay != EGL_NO_DISPLAY)
292 if (m_sync != EGL_NO_SYNC_KHR)
294 EGLU_CHECK_CALL(egl, destroySyncKHR(m_eglDisplay, m_sync));
295 m_sync = EGL_NO_SYNC_KHR;
298 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
300 if (m_eglContext != EGL_NO_CONTEXT)
302 EGLU_CHECK_CALL(egl, destroyContext(m_eglDisplay, m_eglContext));
303 m_eglContext = EGL_NO_CONTEXT;
306 if (m_eglSurface != EGL_NO_SURFACE)
308 EGLU_CHECK_CALL(egl, destroySurface(m_eglDisplay, m_eglSurface));
309 m_eglSurface = EGL_NO_SURFACE;
312 delete m_nativeWindow;
313 m_nativeWindow = DE_NULL;
315 egl.terminate(m_eglDisplay);
316 m_eglDisplay = EGL_NO_DISPLAY;
320 class CreateNullAttribsTest : public SyncTest
323 CreateNullAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
324 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_null_attribs", "create_null_attribs")
328 template <typename createSyncFuncType>
329 void test(string funcNames[FUNC_NAME_NUM_NAMES],
330 createSyncFuncType createSyncFunc)
332 // Reset before each test
336 const Library& egl = m_eglTestCtx.getLibrary();
337 TestLog& log = m_testCtx.getLog();
338 string msgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
340 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
341 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] << "(" <<
342 m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
344 EGLU_CHECK_MSG(egl, msgChk.c_str());
347 IterateResult iterate(void)
349 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
351 if (hasRequiredEGLVersion(1, 5))
353 test<createSync>(m_funcNames, &Library::createSync);
355 if (hasEGLFenceSyncExtension())
357 test<createSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR);
359 else if (!hasRequiredEGLVersion(1, 5))
361 TCU_THROW(NotSupportedError, "Required extensions not supported");
368 class CreateEmptyAttribsTest : public SyncTest
371 CreateEmptyAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
372 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_empty_attribs", "create_empty_attribs")
376 template <typename createSyncFuncType, typename attribType>
377 void test(string funcNames[FUNC_NAME_NUM_NAMES],
378 createSyncFuncType createSyncFunc)
380 // Reset before each test
384 const Library& egl = m_eglTestCtx.getLibrary();
385 TestLog& log = m_testCtx.getLog();
386 string msgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
387 const attribType attribList[] =
392 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, attribList);
393 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
394 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) <<
395 ", { EGL_NONE })" << TestLog::EndMessage;
396 EGLU_CHECK_MSG(egl, msgChk.c_str());
399 IterateResult iterate (void)
401 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
403 if (hasRequiredEGLVersion(1, 5))
405 test<createSync, EGLAttrib>(m_funcNames, &Library::createSync);
407 if (hasEGLFenceSyncExtension())
409 test<createSyncKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR);
411 else if (!hasRequiredEGLVersion(1, 5))
413 TCU_THROW(NotSupportedError, "Required extensions not supported");
420 class CreateInvalidDisplayTest : public SyncTest
423 CreateInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
424 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_display", "create_invalid_display")
428 template <typename createSyncFuncType, typename syncType>
429 void test(string funcNames[FUNC_NAME_NUM_NAMES],
430 createSyncFuncType createSyncFunc, syncType eglNoSync)
432 // Reset before each test
436 const Library& egl = m_eglTestCtx.getLibrary();
437 TestLog& log = m_testCtx.getLog();
439 m_sync = (egl.*createSyncFunc)(EGL_NO_DISPLAY, m_syncType, NULL);
440 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
441 "(EGL_NO_DISPLAY, " << getSyncTypeName(m_syncType) << ", NULL)" <<
444 EGLint error = egl.getError();
445 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
447 if (error != EGL_BAD_DISPLAY)
449 log << TestLog::Message << "Unexpected error '" <<
450 eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" <<
452 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
456 TCU_CHECK(m_sync == eglNoSync);
459 IterateResult iterate (void)
461 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
463 if (hasRequiredEGLVersion(1, 5))
465 test<createSync, EGLSync>(m_funcNames, &Library::createSync, EGL_NO_SYNC);
467 if (hasEGLFenceSyncExtension())
469 test<createSyncKHR, EGLSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR, EGL_NO_SYNC_KHR);
471 else if (!hasRequiredEGLVersion(1, 5))
473 TCU_THROW(NotSupportedError, "Required extensions not supported");
480 class CreateInvalidTypeTest : public SyncTest
483 CreateInvalidTypeTest (EglTestContext& eglTestCtx, EGLenum syncType)
484 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_type", "create_invalid_type")
488 template <typename createSyncFuncType>
489 void test(string funcNames[FUNC_NAME_NUM_NAMES],
490 createSyncFuncType createSyncFunc, EGLSyncKHR eglNoSync,
491 EGLint syncError, string syncErrorName)
493 // Reset before each test
497 const Library& egl = m_eglTestCtx.getLibrary();
498 TestLog& log = m_testCtx.getLog();
500 m_sync = (egl.*createSyncFunc)(m_eglDisplay, EGL_NONE, NULL);
501 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] << "(" <<
502 m_eglDisplay << ", EGL_NONE, NULL)" << TestLog::EndMessage;
504 EGLint error = egl.getError();
505 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
507 if (error != syncError)
509 log << TestLog::Message << "Unexpected error '" <<
510 eglu::getErrorStr(error) << "' expected " << syncErrorName << " " <<
512 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
516 TCU_CHECK(m_sync == eglNoSync);
519 IterateResult iterate (void)
521 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
523 if (hasRequiredEGLVersion(1, 5))
525 test<createSync>(m_funcNames, &Library::createSync, EGL_NO_SYNC,
526 EGL_BAD_PARAMETER, "EGL_BAD_PARAMETER");
528 if (hasEGLFenceSyncExtension())
530 test<createSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR, EGL_NO_SYNC_KHR,
531 EGL_BAD_ATTRIBUTE, "EGL_BAD_ATTRIBUTE");
533 else if (!hasRequiredEGLVersion(1, 5))
535 TCU_THROW(NotSupportedError, "Required extensions not supported");
542 class CreateInvalidAttribsTest : public SyncTest
545 CreateInvalidAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
546 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_attribs", "create_invalid_attribs")
550 template <typename createSyncFuncType, typename attribType>
551 void test(string funcNames[FUNC_NAME_NUM_NAMES],
552 createSyncFuncType createSyncFunc, EGLSyncKHR eglNoSync)
554 // Reset before each test
558 const Library& egl = m_eglTestCtx.getLibrary();
559 TestLog& log = m_testCtx.getLog();
561 attribType attribs[] = {
566 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, attribs);
567 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
568 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) <<
569 ", { 2, 3, 4, 5, EGL_NONE })" << TestLog::EndMessage;
571 EGLint error = egl.getError();
572 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
574 if (error != EGL_BAD_ATTRIBUTE)
576 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
577 "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
578 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
582 TCU_CHECK(m_sync == eglNoSync);
585 IterateResult iterate (void)
587 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
589 if (hasRequiredEGLVersion(1, 5))
591 test<createSync, EGLAttrib>(m_funcNames, &Library::createSync, EGL_NO_SYNC);
593 if (hasEGLFenceSyncExtension())
595 test<createSyncKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR, EGL_NO_SYNC_KHR);
597 else if (!hasRequiredEGLVersion(1, 5))
599 TCU_THROW(NotSupportedError, "Required extensions not supported");
606 class CreateInvalidContextTest : public SyncTest
609 CreateInvalidContextTest (EglTestContext& eglTestCtx, EGLenum syncType)
610 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_context", "create_invalid_context")
614 template <typename createSyncFuncType>
615 void test(string funcNames[FUNC_NAME_NUM_NAMES],
616 createSyncFuncType createSyncFunc, EGLSyncKHR eglNoSync)
618 // Reset before each test
622 const Library& egl = m_eglTestCtx.getLibrary();
623 TestLog& log = m_testCtx.getLog();
625 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay <<
626 ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
627 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE,
628 EGL_NO_SURFACE, EGL_NO_CONTEXT));
630 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
631 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
632 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
635 EGLint error = egl.getError();
636 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
638 if (error != EGL_BAD_MATCH)
640 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
641 "' expected EGL_BAD_MATCH" << TestLog::EndMessage;
642 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
646 TCU_CHECK(m_sync == eglNoSync);
649 IterateResult iterate (void)
651 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
653 if (hasRequiredEGLVersion(1, 5))
655 test<createSync>(m_funcNames, &Library::createSync, EGL_NO_SYNC);
657 if (hasEGLFenceSyncExtension())
659 test<createSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR, EGL_NO_SYNC_KHR);
661 else if (!hasRequiredEGLVersion(1, 5))
663 TCU_THROW(NotSupportedError, "Required extensions not supported");
670 class ClientWaitNoTimeoutTest : public SyncTest
673 ClientWaitNoTimeoutTest (EglTestContext& eglTestCtx, EGLenum syncType)
674 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_no_timeout", "wait_no_timeout")
678 template <typename createSyncFuncType, typename clientWaitSyncFuncType>
679 void test(string funcNames[FUNC_NAME_NUM_NAMES],
680 createSyncFuncType createSyncFunc,
681 clientWaitSyncFuncType clientWaitSyncFunc)
683 // Reset before each test
687 const Library& egl = m_eglTestCtx.getLibrary();
688 TestLog& log = m_testCtx.getLog();
689 string msgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
691 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
692 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
693 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
695 EGLU_CHECK_MSG(egl, msgChk.c_str());
697 EGLint status = (egl.*clientWaitSyncFunc)(m_eglDisplay, m_sync, 0, 0);
698 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
699 "(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
701 if (m_syncType == EGL_SYNC_FENCE_KHR)
702 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR || status == EGL_TIMEOUT_EXPIRED_KHR);
703 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
704 TCU_CHECK(status == EGL_TIMEOUT_EXPIRED_KHR);
709 IterateResult iterate (void)
711 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
713 if (hasRequiredEGLVersion(1, 5))
715 test<createSync, clientWaitSync>(m_funcNames, &Library::createSync,
716 &Library::clientWaitSync);
718 if (hasEGLFenceSyncExtension())
720 test<createSyncKHR, clientWaitSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR,
721 &Library::clientWaitSyncKHR);
723 else if (!hasRequiredEGLVersion(1, 5))
725 TCU_THROW(NotSupportedError, "Required extensions not supported");
733 class ClientWaitForeverTest : public SyncTest
736 ClientWaitForeverTest (EglTestContext& eglTestCtx, EGLenum syncType)
737 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_forever", "wait_forever")
741 template <typename createSyncFuncType, typename clientWaitSyncFuncType>
742 void test(string funcNames[FUNC_NAME_NUM_NAMES],
743 createSyncFuncType createSyncFunc,
744 clientWaitSyncFuncType clientWaitSyncFunc,
745 EGLTime eglTime, const string &eglTimeName,
746 EGLint condSatisfied)
748 // Reset before each test
752 const Library& egl = m_eglTestCtx.getLibrary();
753 TestLog& log = m_testCtx.getLog();
754 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
755 string clientWaitSyncMsgChk = funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] + "()";
757 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
758 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
759 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
761 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
763 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
765 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
766 log << TestLog::Message << ret << " = eglSignalSyncKHR(" <<
767 m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" <<
769 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
771 else if (m_syncType == EGL_SYNC_FENCE_KHR)
773 GLU_CHECK_GLW_CALL(m_gl, flush());
774 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
779 EGLint status = (egl.*clientWaitSyncFunc)(m_eglDisplay, m_sync, 0, eglTime);
780 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
781 "(" << m_eglDisplay << ", " << m_sync << ", 0, " << eglTimeName << ")" <<
784 TCU_CHECK(status == condSatisfied);
785 EGLU_CHECK_MSG(egl, clientWaitSyncMsgChk.c_str());
788 IterateResult iterate (void)
790 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
792 if (hasRequiredEGLVersion(1, 5))
794 test<createSync, clientWaitSync>(m_funcNames, &Library::createSync,
795 &Library::clientWaitSync,
796 EGL_FOREVER, "EGL_FOREVER",
797 EGL_CONDITION_SATISFIED);
799 if (hasEGLFenceSyncExtension())
801 test<createSyncKHR, clientWaitSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR,
802 &Library::clientWaitSyncKHR,
803 EGL_FOREVER_KHR, "EGL_FOREVER_KHR",
804 EGL_CONDITION_SATISFIED_KHR);
806 else if (!hasRequiredEGLVersion(1, 5))
808 TCU_THROW(NotSupportedError, "Required extensions not supported");
815 class ClientWaitNoContextTest : public SyncTest
818 ClientWaitNoContextTest (EglTestContext& eglTestCtx, EGLenum syncType)
819 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_no_context", "wait_no_Context")
823 template <typename createSyncFuncType, typename clientWaitSyncFuncType>
824 void test(string funcNames[FUNC_NAME_NUM_NAMES],
825 createSyncFuncType createSyncFunc,
826 clientWaitSyncFuncType clientWaitSyncFunc,
827 EGLint condSatisfied, EGLTime eglTime, const string &eglTimeName)
829 // Reset before each test
833 const Library& egl = m_eglTestCtx.getLibrary();
834 TestLog& log = m_testCtx.getLog();
835 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
837 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
838 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
839 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
841 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
844 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
846 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
847 log << TestLog::Message << ret << " = eglSignalSyncKHR(" <<
848 m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" <<
850 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
852 else if (m_syncType == EGL_SYNC_FENCE_KHR)
854 GLU_CHECK_GLW_CALL(m_gl, flush());
855 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
860 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay <<
861 ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
862 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE,
863 EGL_NO_SURFACE, EGL_NO_CONTEXT));
865 EGLint result = (egl.*clientWaitSyncFunc)(m_eglDisplay, m_sync, 0, eglTime);
866 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
867 "(" << m_eglDisplay << ", " << m_sync << ", 0, " << eglTimeName << ")" <<
870 TCU_CHECK(result == condSatisfied);
873 IterateResult iterate (void)
875 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
877 if (hasRequiredEGLVersion(1, 5))
879 test<createSync, clientWaitSync>(m_funcNames, &Library::createSync,
880 &Library::clientWaitSync,
881 EGL_CONDITION_SATISFIED, EGL_FOREVER, "EGL_FOREVER");
883 if (hasEGLFenceSyncExtension())
885 test<createSyncKHR, clientWaitSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR,
886 &Library::clientWaitSyncKHR,
887 EGL_CONDITION_SATISFIED_KHR, EGL_FOREVER_KHR, "EGL_FOREVER_KHR");
889 else if (!hasRequiredEGLVersion(1, 5))
891 TCU_THROW(NotSupportedError, "Required extensions not supported");
898 class ClientWaitForeverFlushTest : public SyncTest
901 ClientWaitForeverFlushTest (EglTestContext& eglTestCtx, EGLenum syncType)
902 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_forever_flush", "wait_forever_flush")
906 template <typename createSyncFuncType, typename clientWaitSyncFuncType>
907 void test(string funcNames[FUNC_NAME_NUM_NAMES],
908 createSyncFuncType createSyncFunc,
909 clientWaitSyncFuncType clientWaitSyncFunc,
910 EGLint flags, const string &flagsName,
911 EGLTime eglTime, const string &eglTimeName,
912 EGLint condSatisfied)
914 // Reset before each test
918 const Library& egl = m_eglTestCtx.getLibrary();
919 TestLog& log = m_testCtx.getLog();
920 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
922 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
923 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
924 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
926 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
928 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
930 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
931 log << TestLog::Message << ret << " = eglSignalSyncKHR(" <<
932 m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" <<
934 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
937 EGLint status = (egl.*clientWaitSyncFunc)(m_eglDisplay, m_sync, flags, eglTime);
938 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
939 "(" << m_eglDisplay << ", " << m_sync << ", " << flagsName << ", " <<
940 eglTimeName << ")" << TestLog::EndMessage;
942 TCU_CHECK(status == condSatisfied);
946 IterateResult iterate (void)
948 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
950 if (hasRequiredEGLVersion(1, 5))
952 test<createSync, clientWaitSync>(m_funcNames, &Library::createSync,
953 &Library::clientWaitSync,
954 EGL_SYNC_FLUSH_COMMANDS_BIT, "EGL_SYNC_FLUSH_COMMANDS_BIT",
955 EGL_FOREVER, "EGL_FOREVER",
956 EGL_CONDITION_SATISFIED);
958 if (hasEGLFenceSyncExtension())
960 test<createSyncKHR, clientWaitSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR,
961 &Library::clientWaitSyncKHR,
962 EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, "EGL_SYNC_FLUSH_COMMANDS_BIT_KHR",
963 EGL_FOREVER_KHR, "EGL_FOREVER_KHR",
964 EGL_CONDITION_SATISFIED_KHR);
966 else if (!hasRequiredEGLVersion(1, 5))
968 TCU_THROW(NotSupportedError, "Required extensions not supported");
975 class ClientWaitInvalidDisplayTest : public SyncTest
978 ClientWaitInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
979 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_invalid_display", "wait_invalid_display")
983 template <typename createSyncFuncType, typename clientWaitSyncFuncType>
984 void test(string funcNames[FUNC_NAME_NUM_NAMES],
985 createSyncFuncType createSyncFunc,
986 clientWaitSyncFuncType clientWaitSyncFunc,
987 EGLint flags, const string &flagsName,
988 EGLTime eglTime, const string &eglTimeName)
990 // Reset before each test
994 const Library& egl = m_eglTestCtx.getLibrary();
995 TestLog& log = m_testCtx.getLog();
996 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
998 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
999 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] << "(" <<
1000 m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1001 TestLog::EndMessage;
1002 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1004 EGLint status = (egl.*clientWaitSyncFunc)(EGL_NO_DISPLAY, m_sync, flags, eglTime);
1005 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
1006 "(EGL_NO_DISPLAY, " << m_sync << ", " << flagsName << ", " <<
1007 eglTimeName << ")" << TestLog::EndMessage;
1009 EGLint error = egl.getError();
1010 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1012 if (error != EGL_BAD_DISPLAY)
1014 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1015 "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1016 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1020 TCU_CHECK(status == EGL_FALSE);
1023 IterateResult iterate (void)
1025 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1027 if (hasRequiredEGLVersion(1, 5))
1029 test<createSync, clientWaitSync>(m_funcNames, &Library::createSync,
1030 &Library::clientWaitSync,
1031 EGL_SYNC_FLUSH_COMMANDS_BIT, "EGL_SYNC_FLUSH_COMMANDS_BIT",
1032 EGL_FOREVER, "EGL_FOREVER");
1034 if (hasEGLFenceSyncExtension())
1036 test<createSyncKHR, clientWaitSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR,
1037 &Library::clientWaitSyncKHR,
1038 EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, "EGL_SYNC_FLUSH_COMMANDS_BIT_KHR",
1039 EGL_FOREVER_KHR, "EGL_FOREVER_KHR");
1041 else if (!hasRequiredEGLVersion(1, 5))
1043 TCU_THROW(NotSupportedError, "Required extensions not supported");
1050 class ClientWaitInvalidSyncTest : public SyncTest
1053 ClientWaitInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1054 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_invalid_sync", "wait_invalid_sync")
1058 template <typename clientWaitSyncFuncType>
1059 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1060 clientWaitSyncFuncType clientWaitSyncFunc,
1061 EGLSync sync, const string &syncName,
1062 EGLTime eglTime, const string &eglTimeName)
1064 // Reset before each test
1068 const Library& egl = m_eglTestCtx.getLibrary();
1069 TestLog& log = m_testCtx.getLog();
1071 EGLint status = (egl.*clientWaitSyncFunc)(m_eglDisplay, sync, 0, eglTime);
1072 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
1073 "(" << m_eglDisplay << ", " << syncName << ", 0, " << eglTimeName << ")" <<
1074 TestLog::EndMessage;
1076 EGLint error = egl.getError();
1077 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1079 if (error != EGL_BAD_PARAMETER)
1081 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1082 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1083 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1087 TCU_CHECK(status == EGL_FALSE);
1090 IterateResult iterate (void)
1092 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1094 if (hasRequiredEGLVersion(1, 5))
1096 test<clientWaitSync>(m_funcNames, &Library::clientWaitSync,
1097 EGL_NO_SYNC, "EGL_NO_SYNC",
1098 EGL_FOREVER, "EGL_FOREVER");
1100 if (hasEGLFenceSyncExtension())
1102 test<clientWaitSyncKHR>(m_funcNamesKHR, &Library::clientWaitSyncKHR,
1103 EGL_NO_SYNC_KHR, "EGL_NO_SYNC_KHR",
1104 EGL_FOREVER_KHR, "EGL_FOREVER_KHR");
1106 else if (!hasRequiredEGLVersion(1, 5))
1108 TCU_THROW(NotSupportedError, "Required extensions not supported");
1115 class GetSyncTypeTest : public SyncTest
1118 GetSyncTypeTest (EglTestContext& eglTestCtx, EGLenum syncType)
1119 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_type", "get_type")
1123 template <typename createSyncFuncType, typename getSyncAttribFuncType, typename getSyncAttribValueType>
1124 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1125 createSyncFuncType createSyncFunc,
1126 getSyncAttribFuncType getSyncAttribFunc,
1127 EGLint attribute, const string &attributeName)
1129 // Reset before each test
1133 const Library& egl = m_eglTestCtx.getLibrary();
1134 TestLog& log = m_testCtx.getLog();
1135 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1137 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1138 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1139 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1140 TestLog::EndMessage;
1141 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1143 getSyncAttribValueType type = 0;
1144 EGLU_CHECK_CALL_FPTR(egl, (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync,
1146 log << TestLog::Message << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] << "(" << m_eglDisplay <<
1147 ", " << m_sync << ", " << attributeName << ", {" << type << "})" <<
1148 TestLog::EndMessage;
1150 TCU_CHECK(type == ((getSyncAttribValueType)m_syncType));
1153 IterateResult iterate (void)
1155 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1157 if (hasRequiredEGLVersion(1, 5))
1159 test<createSync, getSyncAttrib, EGLAttrib>(m_funcNames, &Library::createSync,
1160 &Library::getSyncAttrib,
1161 EGL_SYNC_TYPE, "EGL_SYNC_TYPE");
1163 if (hasEGLFenceSyncExtension())
1165 test<createSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR,
1166 &Library::getSyncAttribKHR,
1167 EGL_SYNC_TYPE_KHR, "EGL_SYNC_TYPE_KHR");
1169 else if (!hasRequiredEGLVersion(1, 5))
1171 TCU_THROW(NotSupportedError, "Required extensions not supported");
1178 class GetSyncStatusTest : public SyncTest
1181 GetSyncStatusTest (EglTestContext& eglTestCtx, EGLenum syncType)
1182 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_status", "get_status")
1186 template <typename createSyncFuncType, typename getSyncAttribFuncType, typename getSyncAttribValueType>
1187 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1188 createSyncFuncType createSyncFunc,
1189 getSyncAttribFuncType getSyncAttribFunc,
1190 EGLint attribute, const string &attributeName)
1192 // Reset before each test
1196 const Library& egl = m_eglTestCtx.getLibrary();
1197 TestLog& log = m_testCtx.getLog();
1198 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1200 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1201 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1202 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1203 TestLog::EndMessage;
1204 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1206 getSyncAttribValueType status = 0;
1207 EGLU_CHECK_CALL_FPTR(egl, (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync, attribute, &status));
1208 log << TestLog::Message << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] << "(" <<
1209 m_eglDisplay << ", " << m_sync << ", " << attributeName << ", {" <<
1210 status << "})" << TestLog::EndMessage;
1212 if (m_syncType == EGL_SYNC_FENCE_KHR)
1213 TCU_CHECK(status == EGL_SIGNALED_KHR || status == EGL_UNSIGNALED_KHR);
1214 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
1215 TCU_CHECK(status == EGL_UNSIGNALED_KHR);
1218 IterateResult iterate (void)
1220 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1222 if (hasRequiredEGLVersion(1, 5))
1224 test<createSync, getSyncAttrib, EGLAttrib>(m_funcNames, &Library::createSync,
1225 &Library::getSyncAttrib,
1226 EGL_SYNC_STATUS, "EGL_SYNC_STATUS");
1228 if (hasEGLFenceSyncExtension())
1230 test<createSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR,
1231 &Library::getSyncAttribKHR,
1232 EGL_SYNC_STATUS_KHR, "EGL_SYNC_STATUS_KHR");
1234 else if (!hasRequiredEGLVersion(1, 5))
1236 TCU_THROW(NotSupportedError, "Required extensions not supported");
1243 class GetSyncStatusSignaledTest : public SyncTest
1246 GetSyncStatusSignaledTest (EglTestContext& eglTestCtx, EGLenum syncType)
1247 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_status_signaled", "get_status_signaled")
1251 template <typename createSyncFuncType,
1252 typename clientWaitSyncFuncType,
1253 typename getSyncAttribFuncType,
1254 typename getSyncAttribValueType>
1255 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1256 createSyncFuncType createSyncFunc,
1257 clientWaitSyncFuncType clientWaitSyncFunc,
1258 EGLint flags, const string &flagsName,
1259 EGLTime eglTime, const string &eglTimeName,
1260 EGLint condSatisfied,
1261 getSyncAttribFuncType getSyncAttribFunc,
1262 EGLint attribute, const string &attributeName,
1263 getSyncAttribValueType statusVal)
1265 // Reset before each test
1269 const Library& egl = m_eglTestCtx.getLibrary();
1270 TestLog& log = m_testCtx.getLog();
1271 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1273 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1274 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1275 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1276 TestLog::EndMessage;
1277 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1279 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
1281 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
1282 log << TestLog::Message << ret << " = eglSignalSyncKHR(" <<
1283 m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" <<
1284 TestLog::EndMessage;
1285 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
1287 else if (m_syncType == EGL_SYNC_FENCE_KHR)
1289 GLU_CHECK_GLW_CALL(m_gl, finish());
1290 log << TestLog::Message << "glFinish()" << TestLog::EndMessage;
1293 DE_ASSERT(DE_FALSE);
1296 EGLint status = (egl.*clientWaitSyncFunc)(m_eglDisplay, m_sync, flags, eglTime);
1297 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] << "(" <<
1298 m_eglDisplay << ", " << m_sync << ", " << flagsName << ", " <<
1299 eglTimeName << ")" << TestLog::EndMessage;
1300 TCU_CHECK(status == condSatisfied);
1303 getSyncAttribValueType status = 0;
1304 EGLU_CHECK_CALL_FPTR(egl, (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync, attribute, &status));
1305 log << TestLog::Message << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] << "(" <<
1306 m_eglDisplay << ", " << m_sync << ", " << attributeName << ", {" <<
1307 status << "})" << TestLog::EndMessage;
1309 TCU_CHECK(status == statusVal);
1312 IterateResult iterate (void)
1314 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1316 if (hasRequiredEGLVersion(1, 5))
1318 test<createSync, clientWaitSync, getSyncAttrib, EGLAttrib>(m_funcNames,
1319 &Library::createSync,
1320 &Library::clientWaitSync,
1321 EGL_SYNC_FLUSH_COMMANDS_BIT, "EGL_SYNC_FLUSH_COMMANDS_BIT",
1322 EGL_FOREVER, "EGL_FOREVER",
1323 EGL_CONDITION_SATISFIED,
1324 &Library::getSyncAttrib,
1325 EGL_SYNC_STATUS, "EGL_SYNC_STATUS",
1328 if (hasEGLFenceSyncExtension())
1330 test<createSyncKHR, clientWaitSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR,
1331 &Library::createSyncKHR,
1332 &Library::clientWaitSyncKHR,
1333 EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, "EGL_SYNC_FLUSH_COMMANDS_BIT_KHR",
1334 EGL_FOREVER_KHR, "EGL_FOREVER_KHR",
1335 EGL_CONDITION_SATISFIED_KHR,
1336 &Library::getSyncAttribKHR,
1337 EGL_SYNC_STATUS_KHR, "EGL_SYNC_STATUS_KHR",
1340 else if (!hasRequiredEGLVersion(1, 5))
1342 TCU_THROW(NotSupportedError, "Required extensions not supported");
1349 class GetSyncConditionTest : public SyncTest
1352 GetSyncConditionTest (EglTestContext& eglTestCtx, EGLenum syncType)
1353 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_condition", "get_condition")
1357 template <typename createSyncFuncType,
1358 typename getSyncAttribFuncType,
1359 typename getSyncAttribValueType>
1360 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1361 createSyncFuncType createSyncFunc,
1362 getSyncAttribFuncType getSyncAttribFunc,
1363 EGLint attribute, const string &attributeName,
1364 getSyncAttribValueType statusVal)
1366 // Reset before each test
1370 const Library& egl = m_eglTestCtx.getLibrary();
1371 TestLog& log = m_testCtx.getLog();
1372 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1374 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1375 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1376 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1377 TestLog::EndMessage;
1378 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1380 getSyncAttribValueType condition = 0;
1381 EGLU_CHECK_CALL_FPTR(egl, (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync,
1382 attribute, &condition));
1383 log << TestLog::Message << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] << "(" <<
1384 m_eglDisplay << ", " << m_sync << ", " << attributeName << ", {" <<
1385 condition << "})" << TestLog::EndMessage;
1387 TCU_CHECK(condition == statusVal);
1390 IterateResult iterate (void)
1392 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1394 if (hasRequiredEGLVersion(1, 5))
1396 test<createSync, getSyncAttrib, EGLAttrib>(m_funcNames, &Library::createSync,
1397 &Library::getSyncAttrib,
1398 EGL_SYNC_CONDITION, "EGL_SYNC_CONDITION",
1399 EGL_SYNC_PRIOR_COMMANDS_COMPLETE);
1401 if (hasEGLFenceSyncExtension())
1403 test<createSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR,
1404 &Library::getSyncAttribKHR,
1405 EGL_SYNC_CONDITION_KHR, "EGL_SYNC_CONDITION_KHR",
1406 EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR);
1408 else if (!hasRequiredEGLVersion(1, 5))
1410 TCU_THROW(NotSupportedError, "Required extensions not supported");
1417 class GetSyncInvalidDisplayTest : public SyncTest
1420 GetSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
1421 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_display", "get_invalid_display")
1425 template <typename createSyncFuncType,
1426 typename getSyncAttribFuncType,
1427 typename getSyncAttribValueType>
1428 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1429 createSyncFuncType createSyncFunc,
1430 getSyncAttribFuncType getSyncAttribFunc,
1431 EGLint attribute, const string &attributeName)
1433 // Reset before each test
1437 const Library& egl = m_eglTestCtx.getLibrary();
1438 TestLog& log = m_testCtx.getLog();
1439 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1441 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1442 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1443 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1444 TestLog::EndMessage;
1445 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1447 getSyncAttribValueType condition = 0xF0F0F;
1448 EGLBoolean result = (egl.*getSyncAttribFunc)(EGL_NO_DISPLAY, m_sync, attribute, &condition);
1449 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] <<
1450 "(EGL_NO_DISPLAY, " << m_sync << ", " << attributeName << ", {" <<
1451 condition << "})" << TestLog::EndMessage;
1453 EGLint error = egl.getError();
1454 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1456 if (error != EGL_BAD_DISPLAY)
1458 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1459 "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1460 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1464 TCU_CHECK(result == EGL_FALSE);
1465 TCU_CHECK(condition == 0xF0F0F);
1468 IterateResult iterate (void)
1470 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1472 if (hasRequiredEGLVersion(1, 5))
1474 test<createSync, getSyncAttrib, EGLAttrib>(m_funcNames, &Library::createSync,
1475 &Library::getSyncAttrib,
1476 EGL_SYNC_CONDITION, "EGL_SYNC_CONDITION");
1478 if (hasEGLFenceSyncExtension())
1480 test<createSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR,
1481 &Library::getSyncAttribKHR,
1482 EGL_SYNC_CONDITION_KHR, "EGL_SYNC_CONDITION_KHR");
1484 else if (!hasRequiredEGLVersion(1, 5))
1486 TCU_THROW(NotSupportedError, "Required extensions not supported");
1493 class GetSyncInvalidSyncTest : public SyncTest
1496 GetSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)\
1497 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_invalid_sync", "get_invalid_sync")
1501 template <typename getSyncAttribFuncType,
1502 typename getSyncSyncValueType,
1503 typename getSyncAttribValueType>
1504 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1505 getSyncAttribFuncType getSyncAttribFunc,
1506 getSyncSyncValueType syncValue, const string &syncName,
1507 EGLint attribute, const string &attributeName)
1509 // Reset before each test
1513 const Library& egl = m_eglTestCtx.getLibrary();
1514 TestLog& log = m_testCtx.getLog();
1516 getSyncAttribValueType condition = 0xF0F0F;
1517 EGLBoolean result = (egl.*getSyncAttribFunc)(m_eglDisplay, syncValue,
1518 attribute, &condition);
1519 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] <<
1520 "(" << m_eglDisplay << ", " << syncName << ", " << attributeName << ", {" <<
1521 condition << "})" << TestLog::EndMessage;
1523 EGLint error = egl.getError();
1524 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1526 if (error != EGL_BAD_PARAMETER)
1528 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1529 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1530 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1534 TCU_CHECK(result == EGL_FALSE);
1535 TCU_CHECK(condition == 0xF0F0F);
1538 IterateResult iterate (void)
1540 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1542 if (hasRequiredEGLVersion(1, 5))
1544 test<getSyncAttrib, EGLSync, EGLAttrib>(m_funcNames, &Library::getSyncAttrib,
1545 EGL_NO_SYNC, "EGL_NO_SYNC",
1546 EGL_SYNC_CONDITION, "EGL_SYNC_CONDITION");
1548 if (hasEGLFenceSyncExtension())
1550 test<getSyncAttribKHR, EGLSyncKHR, EGLint>(m_funcNamesKHR, &Library::getSyncAttribKHR,
1551 EGL_NO_SYNC_KHR, "EGL_NO_SYNC_KHR",
1552 EGL_SYNC_CONDITION_KHR, "EGL_SYNC_CONDITION_KHR");
1554 else if (!hasRequiredEGLVersion(1, 5))
1556 TCU_THROW(NotSupportedError, "Required extensions not supported");
1563 class GetSyncInvalidAttributeTest : public SyncTest
1566 GetSyncInvalidAttributeTest (EglTestContext& eglTestCtx, EGLenum syncType)
1567 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_attribute", "get_invalid_attribute")
1571 template <typename createSyncFuncType,
1572 typename getSyncAttribFuncType,
1573 typename getSyncAttribValueType>
1574 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1575 createSyncFuncType createSyncFunc,
1576 getSyncAttribFuncType getSyncAttribFunc)
1578 // Reset before each test
1582 const Library& egl = m_eglTestCtx.getLibrary();
1583 TestLog& log = m_testCtx.getLog();
1584 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1586 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1587 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1588 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1589 TestLog::EndMessage;
1590 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1592 getSyncAttribValueType condition = 0xF0F0F;
1593 EGLBoolean result = (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync, EGL_NONE, &condition);
1594 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] <<
1595 "(" << m_eglDisplay << ", " << m_sync << ", EGL_NONE, {" << condition << "})" <<
1596 TestLog::EndMessage;
1598 EGLint error = egl.getError();
1599 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1601 if (error != EGL_BAD_ATTRIBUTE)
1603 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1604 "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
1605 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1609 TCU_CHECK(result == EGL_FALSE);
1610 TCU_CHECK(condition == 0xF0F0F);
1613 IterateResult iterate (void)
1615 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1617 if (hasRequiredEGLVersion(1, 5))
1619 test<createSync, getSyncAttrib, EGLAttrib>(m_funcNames,
1620 &Library::createSync,
1621 &Library::getSyncAttrib);
1623 if (hasEGLFenceSyncExtension())
1625 test<createSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR,
1626 &Library::createSyncKHR,
1627 &Library::getSyncAttribKHR);
1629 else if (!hasRequiredEGLVersion(1, 5))
1631 TCU_THROW(NotSupportedError, "Required extensions not supported");
1638 class GetSyncInvalidValueTest : public SyncTest
1641 GetSyncInvalidValueTest (EglTestContext& eglTestCtx, EGLenum syncType)
1642 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_value", "get_invalid_value")
1646 template <typename createSyncFuncType,
1647 typename getSyncAttribFuncType, typename valueType>
1648 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1649 createSyncFuncType createSyncFunc,
1650 getSyncAttribFuncType getSyncAttribFunc,
1651 EGLint attribute, const string &attributeName,
1654 // Reset before each test
1658 const Library& egl = m_eglTestCtx.getLibrary();
1659 TestLog& log = m_testCtx.getLog();
1660 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1662 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1663 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1664 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1665 TestLog::EndMessage;
1666 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1668 EGLBoolean result = (egl.*getSyncAttribFunc)(m_eglDisplay, NULL, attribute, &value);
1669 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] <<
1670 "(" << m_eglDisplay << ", " << 0x0 << ", " << attributeName << ", " << &value << ")" <<
1671 TestLog::EndMessage;
1673 EGLint error = egl.getError();
1674 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1676 if (error != EGL_BAD_PARAMETER)
1678 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1679 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1680 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1684 TCU_CHECK(result == EGL_FALSE);
1687 IterateResult iterate (void)
1689 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1691 if (hasRequiredEGLVersion(1, 5))
1693 EGLAttrib value = 0;
1694 test<createSync, getSyncAttrib>(m_funcNames, &Library::createSync,
1695 &Library::getSyncAttrib,
1696 EGL_SYNC_TYPE, "EGL_SYNC_TYPE", value);
1698 if (hasEGLFenceSyncExtension())
1701 test<createSyncKHR, getSyncAttribKHR>(m_funcNamesKHR, &Library::createSyncKHR,
1702 &Library::getSyncAttribKHR,
1703 EGL_SYNC_TYPE_KHR, "EGL_SYNC_TYPE_KHR", value);
1705 else if (!hasRequiredEGLVersion(1, 5))
1707 TCU_THROW(NotSupportedError, "Required extensions not supported");
1714 class DestroySyncTest : public SyncTest
1717 DestroySyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1718 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy", "destroy")
1722 template <typename createSyncFuncType,
1723 typename destroySyncFuncType,
1724 typename getSyncSyncValueType>
1725 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1726 createSyncFuncType createSyncFunc,
1727 destroySyncFuncType destroySyncFunc,
1728 getSyncSyncValueType syncValue)
1730 // Reset before each test
1734 const Library& egl = m_eglTestCtx.getLibrary();
1735 TestLog& log = m_testCtx.getLog();
1736 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1738 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1739 log << TestLog::Message << funcNames[FUNC_NAME_CREATE_SYNC] << "(" <<
1740 m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1741 TestLog::EndMessage;
1742 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1744 log << TestLog::Message << funcNames[FUNC_NAME_DESTROY_SYNC] << "(" <<
1745 m_eglDisplay << ", " << m_sync << ")" << TestLog::EndMessage;
1746 EGLU_CHECK_CALL_FPTR(egl, (egl.*destroySyncFunc)(m_eglDisplay, m_sync));
1750 IterateResult iterate (void)
1752 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1754 if (hasRequiredEGLVersion(1, 5))
1756 test<createSync, destroySync, EGLSync>(m_funcNames,
1757 &Library::createSync,
1758 &Library::destroySync,
1761 if (hasEGLFenceSyncExtension())
1763 test<createSyncKHR, destroySyncKHR, EGLSyncKHR>(m_funcNamesKHR,
1764 &Library::createSyncKHR,
1765 &Library::destroySyncKHR,
1768 else if (!hasRequiredEGLVersion(1, 5))
1770 TCU_THROW(NotSupportedError, "Required extensions not supported");
1777 class DestroySyncInvalidDislayTest : public SyncTest
1780 DestroySyncInvalidDislayTest (EglTestContext& eglTestCtx, EGLenum syncType)
1781 : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy_invalid_display", "destroy_invalid_display")
1785 template <typename createSyncFuncType, typename destroySyncFuncType>
1786 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1787 createSyncFuncType createSyncFunc,
1788 destroySyncFuncType destroySyncFunc)
1790 // Reset before each test
1794 const Library& egl = m_eglTestCtx.getLibrary();
1795 TestLog& log = m_testCtx.getLog();
1796 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1798 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1799 log << TestLog::Message << funcNames[FUNC_NAME_CREATE_SYNC] << "(" <<
1800 m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1801 TestLog::EndMessage;
1802 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1804 EGLBoolean result = (egl.*destroySyncFunc)(EGL_NO_DISPLAY, m_sync);
1805 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_DESTROY_SYNC] <<
1806 "(EGL_NO_DISPLAY, " << m_sync << ")" << TestLog::EndMessage;
1808 EGLint error = egl.getError();
1809 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1811 if (error != EGL_BAD_DISPLAY)
1813 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1814 "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1815 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1819 TCU_CHECK(result == EGL_FALSE);
1822 IterateResult iterate (void)
1824 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1826 if (hasRequiredEGLVersion(1, 5))
1828 test<createSync, destroySync>(m_funcNames,
1829 &Library::createSync,
1830 &Library::destroySync);
1832 if (hasEGLFenceSyncExtension())
1834 test<createSyncKHR, destroySyncKHR>(m_funcNamesKHR,
1835 &Library::createSyncKHR,
1836 &Library::destroySyncKHR);
1838 else if (!hasRequiredEGLVersion(1, 5))
1840 TCU_THROW(NotSupportedError, "Required extensions not supported");
1847 class DestroySyncInvalidSyncTest : public SyncTest
1850 DestroySyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1851 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy_invalid_sync", "destroy_invalid_sync")
1855 template <typename destroySyncFuncType, typename getSyncSyncValueType>
1856 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1857 destroySyncFuncType destroySyncFunc,
1858 getSyncSyncValueType syncValue)
1860 // Reset before each test
1864 const Library& egl = m_eglTestCtx.getLibrary();
1865 TestLog& log = m_testCtx.getLog();
1867 EGLBoolean result = (egl.*destroySyncFunc)(m_eglDisplay, syncValue);
1868 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_DESTROY_SYNC] <<
1869 "(" << m_eglDisplay << ", " << syncValue << ")" << TestLog::EndMessage;
1871 EGLint error = egl.getError();
1872 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1874 if (error != EGL_BAD_PARAMETER)
1876 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1877 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1878 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1882 TCU_CHECK(result == EGL_FALSE);
1885 IterateResult iterate (void)
1887 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1889 if (hasRequiredEGLVersion(1, 5))
1891 test<destroySync, EGLSync>(m_funcNames,
1892 &Library::destroySync,
1895 if (hasEGLFenceSyncExtension())
1897 test<destroySyncKHR, EGLSyncKHR>(m_funcNamesKHR,
1898 &Library::destroySyncKHR,
1901 else if (!hasRequiredEGLVersion(1, 5))
1903 TCU_THROW(NotSupportedError, "Required extensions not supported");
1910 class WaitSyncTest : public SyncTest
1913 WaitSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1914 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server", "wait_server")
1918 template <typename createSyncFuncType,
1919 typename waitSyncFuncType,
1920 typename waitSyncStatusType>
1921 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1922 createSyncFuncType createSyncFunc,
1923 waitSyncFuncType waitSyncFunc)
1925 // Reset before each test
1929 const Library& egl = m_eglTestCtx.getLibrary();
1930 TestLog& log = m_testCtx.getLog();
1931 string msgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1933 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1934 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1935 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1936 TestLog::EndMessage;
1937 EGLU_CHECK_MSG(egl, msgChk.c_str());
1939 waitSyncStatusType status = (egl.*waitSyncFunc)(m_eglDisplay, m_sync, 0);
1940 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_WAIT_SYNC] << "(" <<
1941 m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
1943 TCU_CHECK(status == EGL_TRUE);
1945 GLU_CHECK_GLW_CALL(m_gl, finish());
1949 IterateResult iterate (void)
1951 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1953 if (hasRequiredEGLVersion(1, 5))
1955 test<createSync, waitSync, EGLBoolean>(m_funcNames,
1956 &Library::createSync,
1957 &Library::waitSync);
1959 if (hasEGLWaitSyncExtension())
1961 test<createSyncKHR, waitSyncKHR, EGLint>(m_funcNamesKHR,
1962 &Library::createSyncKHR,
1963 &Library::waitSyncKHR);
1965 else if (!hasRequiredEGLVersion(1, 5))
1967 TCU_THROW(NotSupportedError, "Required extensions not supported");
1975 class WaitSyncInvalidDisplayTest : public SyncTest
1978 WaitSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
1979 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_display", "wait_server_invalid_display")
1983 template <typename createSyncFuncType,
1984 typename waitSyncFuncType,
1985 typename waitSyncStatusType>
1986 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1987 createSyncFuncType createSyncFunc,
1988 waitSyncFuncType waitSyncFunc)
1990 // Reset before each test
1994 const Library& egl = m_eglTestCtx.getLibrary();
1995 TestLog& log = m_testCtx.getLog();
1996 string msgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1998 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1999 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
2000 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
2001 TestLog::EndMessage;
2002 EGLU_CHECK_MSG(egl, msgChk.c_str());
2004 waitSyncStatusType status = (egl.*waitSyncFunc)(EGL_NO_DISPLAY, m_sync, 0);
2005 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_WAIT_SYNC] <<
2006 "(EGL_NO_DISPLAY, " << m_sync << ", 0)" << TestLog::EndMessage;
2008 EGLint error = egl.getError();
2009 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
2011 if (error != EGL_BAD_DISPLAY)
2013 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
2014 "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
2015 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
2019 TCU_CHECK(status == EGL_FALSE);
2022 IterateResult iterate (void)
2024 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
2026 if (hasRequiredEGLVersion(1, 5))
2028 test<createSync, waitSync, EGLBoolean>(m_funcNames,
2029 &Library::createSync,
2030 &Library::waitSync);
2032 if (hasEGLWaitSyncExtension())
2034 test<createSyncKHR, waitSyncKHR, EGLint>(m_funcNamesKHR,
2035 &Library::createSyncKHR,
2036 &Library::waitSyncKHR);
2038 else if (!hasRequiredEGLVersion(1, 5))
2040 TCU_THROW(NotSupportedError, "Required extensions not supported");
2047 class WaitSyncInvalidSyncTest : public SyncTest
2050 WaitSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
2051 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_sync", "wait_server_invalid_sync")
2055 template <typename waitSyncFuncType, typename waitSyncSyncType>
2056 void test(string funcNames[FUNC_NAME_NUM_NAMES],
2057 waitSyncFuncType waitSyncFunc,
2058 waitSyncSyncType syncValue)
2060 // Reset before each test
2064 const Library& egl = m_eglTestCtx.getLibrary();
2065 TestLog& log = m_testCtx.getLog();
2067 EGLint status = (egl.*waitSyncFunc)(m_eglDisplay, syncValue, 0);
2068 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_WAIT_SYNC] <<
2069 "(" << m_eglDisplay << ", " << syncValue << ", 0)" << TestLog::EndMessage;
2071 EGLint error = egl.getError();
2072 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
2074 if (error != EGL_BAD_PARAMETER)
2076 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
2077 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
2078 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
2082 TCU_CHECK(status == EGL_FALSE);
2085 IterateResult iterate (void)
2087 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
2089 if (hasRequiredEGLVersion(1, 5))
2091 test<waitSync, EGLSync>(m_funcNames,
2095 if (hasEGLWaitSyncExtension())
2097 test<waitSyncKHR, EGLSyncKHR>(m_funcNamesKHR,
2098 &Library::waitSyncKHR,
2101 else if (!hasRequiredEGLVersion(1, 5))
2103 TCU_THROW(NotSupportedError, "Required extensions not supported");
2110 class WaitSyncInvalidFlagTest : public SyncTest
2113 WaitSyncInvalidFlagTest (EglTestContext& eglTestCtx, EGLenum syncType)
2114 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_flag", "wait_server_invalid_flag")
2118 template <typename createSyncFuncType, typename waitSyncFuncType>
2119 void test(string funcNames[FUNC_NAME_NUM_NAMES],
2120 createSyncFuncType createSyncFunc,
2121 waitSyncFuncType waitSyncFunc)
2123 // Reset before each test
2127 const Library& egl = m_eglTestCtx.getLibrary();
2128 TestLog& log = m_testCtx.getLog();
2129 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
2131 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
2132 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
2133 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
2134 TestLog::EndMessage;
2135 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
2137 EGLint status = (egl.*waitSyncFunc)(m_eglDisplay, m_sync, 0xFFFFFFFF);
2138 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_WAIT_SYNC] <<
2139 "(" << m_eglDisplay << ", " << m_sync << ", 0xFFFFFFFF)" << TestLog::EndMessage;
2141 EGLint error = egl.getError();
2142 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
2144 if (error != EGL_BAD_PARAMETER)
2146 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
2147 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
2148 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
2152 TCU_CHECK(status == EGL_FALSE);
2155 IterateResult iterate (void)
2157 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
2159 if (hasRequiredEGLVersion(1, 5))
2161 test<createSync, waitSync>(m_funcNames,
2162 &Library::createSync,
2163 &Library::waitSync);
2165 if (hasEGLWaitSyncExtension())
2167 test<createSyncKHR, waitSyncKHR>(m_funcNamesKHR,
2168 &Library::createSyncKHR,
2169 &Library::waitSyncKHR);
2171 else if (!hasRequiredEGLVersion(1, 5))
2173 TCU_THROW(NotSupportedError, "Required extensions not supported");
2180 FenceSyncTests::FenceSyncTests (EglTestContext& eglTestCtx)
2181 : TestCaseGroup (eglTestCtx, "fence_sync", "EGL_KHR_fence_sync extension tests")
2185 void FenceSyncTests::init (void)
2187 // Add valid API test
2189 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
2191 // eglCreateSyncKHR tests
2192 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2193 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2195 // eglClientWaitSyncKHR tests
2196 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2197 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2198 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2199 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2201 // eglGetSyncAttribKHR tests
2202 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2203 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2204 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2205 valid->addChild(new GetSyncConditionTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2207 // eglDestroySyncKHR tests
2208 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2210 // eglWaitSyncKHR tests
2211 valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2216 // Add negative API tests
2218 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
2220 // eglCreateSyncKHR tests
2221 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2222 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2223 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2224 invalid->addChild(new CreateInvalidContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2226 // eglClientWaitSyncKHR tests
2227 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2228 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2230 // eglGetSyncAttribKHR tests
2231 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2232 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2233 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2234 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2236 // eglDestroySyncKHR tests
2237 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2238 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2240 // eglWaitSyncKHR tests
2241 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2242 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2243 invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2249 ReusableSyncTests::ReusableSyncTests (EglTestContext& eglTestCtx)
2250 : TestCaseGroup (eglTestCtx, "reusable_sync", "EGL_KHR_reusable_sync extension tests")
2254 void ReusableSyncTests::init (void)
2256 // Add valid API test
2258 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
2260 // eglCreateSyncKHR tests
2261 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2262 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2264 // eglClientWaitSyncKHR tests
2265 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2266 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2267 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2268 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2270 // eglGetSyncAttribKHR tests
2271 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2272 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2273 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2275 // eglDestroySyncKHR tests
2276 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2281 // Add negative API tests
2283 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
2285 // eglCreateSyncKHR tests
2286 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2287 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2288 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2290 // eglClientWaitSyncKHR tests
2291 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2292 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2294 // eglGetSyncAttribKHR tests
2295 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2296 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2297 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2298 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2300 // eglDestroySyncKHR tests
2301 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2302 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2304 // eglWaitSyncKHR tests
2305 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2306 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));