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"
64 const char* getSyncTypeName (EGLenum syncType)
68 case EGL_SYNC_FENCE_KHR: return "EGL_SYNC_FENCE_KHR";
69 case EGL_SYNC_REUSABLE_KHR: return "EGL_SYNC_REUSABLE_KHR";
76 class SyncTest : public TestCase
82 EXTENSION_WAIT_SYNC = (0x1 << 0),
83 EXTENSION_FENCE_SYNC = (0x1 << 1),
84 EXTENSION_REUSABLE_SYNC = (0x1 << 2)
86 SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, bool useCurrentContext, const char* name, const char* description);
93 const EGLenum m_syncType;
94 const Extension m_extensions;
95 const bool m_useCurrentContext;
99 EGLDisplay m_eglDisplay;
100 EGLConfig m_eglConfig;
101 EGLSurface m_eglSurface;
102 eglu::NativeWindow* m_nativeWindow;
103 EGLContext m_eglContext;
107 SyncTest::SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, bool useCurrentContext, const char* name, const char* description)
108 : TestCase (eglTestCtx, name, description)
109 , m_syncType (syncType)
110 , m_extensions (extensions)
111 , m_useCurrentContext (useCurrentContext)
112 , m_eglDisplay (EGL_NO_DISPLAY)
113 , m_eglSurface (EGL_NO_SURFACE)
114 , m_nativeWindow (DE_NULL)
115 , m_eglContext (EGL_NO_CONTEXT)
116 , m_sync (EGL_NO_SYNC_KHR)
120 SyncTest::~SyncTest (void)
125 void requiredEGLExtensions (const Library& egl, EGLDisplay display, SyncTest::Extension requiredExtensions)
127 SyncTest::Extension foundExtensions = SyncTest::EXTENSION_NONE;
128 std::istringstream extensionStream(egl.queryString(display, EGL_EXTENSIONS));
131 EGLU_CHECK_MSG(egl, "eglQueryString(display, EGL_EXTENSIONS)");
133 while (std::getline(extensionStream, extension, ' '))
135 if (extension == "EGL_KHR_fence_sync")
136 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_FENCE_SYNC);
137 else if (extension == "EGL_KHR_reusable_sync")
138 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_REUSABLE_SYNC);
139 else if (extension == "EGL_KHR_wait_sync")
140 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_WAIT_SYNC);
144 const SyncTest::Extension missingExtensions = (SyncTest::Extension)((foundExtensions & requiredExtensions) ^ requiredExtensions);
146 if ((missingExtensions & SyncTest::EXTENSION_FENCE_SYNC) != 0)
147 TCU_THROW(NotSupportedError, "EGL_KHR_fence_sync not supported");
149 if ((missingExtensions & SyncTest::EXTENSION_REUSABLE_SYNC) != 0)
150 TCU_THROW(NotSupportedError, "EGL_KHR_reusable_sync not supported");
152 if ((missingExtensions & SyncTest::EXTENSION_WAIT_SYNC) != 0)
153 TCU_THROW(NotSupportedError, "EGL_KHR_wait_sync not supported");
157 void requiredGLESExtensions (const glw::Functions& gl)
160 std::istringstream extensionStream((const char*)gl.getString(GL_EXTENSIONS));
163 GLU_CHECK_GLW_MSG(gl, "glGetString(GL_EXTENSIONS)");
165 while (std::getline(extensionStream, extension, ' '))
167 if (extension == "GL_OES_EGL_sync")
172 TCU_THROW(NotSupportedError, "GL_OES_EGL_sync not supported");
175 SyncTest::Extension getSyncTypeExtension (EGLenum syncType)
179 case EGL_SYNC_FENCE_KHR: return SyncTest::EXTENSION_FENCE_SYNC;
180 case EGL_SYNC_REUSABLE_KHR: return SyncTest::EXTENSION_REUSABLE_SYNC;
183 return SyncTest::EXTENSION_NONE;
187 void SyncTest::init (void)
189 const Library& egl = m_eglTestCtx.getLibrary();
190 const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
192 const EGLint displayAttribList[] =
194 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
195 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
200 const EGLint contextAttribList[] =
202 EGL_CONTEXT_CLIENT_VERSION, 2,
206 m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
207 m_eglConfig = eglu::chooseSingleConfig(egl, m_eglDisplay, displayAttribList);
209 m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
212 const Extension syncTypeExtension = getSyncTypeExtension(m_syncType);
213 requiredEGLExtensions(egl, m_eglDisplay, (Extension)(m_extensions | syncTypeExtension));
216 if (m_useCurrentContext)
219 EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
220 m_eglContext = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttribList);
221 EGLU_CHECK_MSG(egl, "Failed to create GLES2 context");
224 m_nativeWindow = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
225 m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_nativeWindow, m_eglDisplay, m_eglConfig, DE_NULL);
227 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext));
229 requiredGLESExtensions(m_gl);
233 void SyncTest::deinit (void)
235 const Library& egl = m_eglTestCtx.getLibrary();
237 if (m_eglDisplay != EGL_NO_DISPLAY)
239 if (m_sync != EGL_NO_SYNC_KHR)
241 EGLU_CHECK_CALL(egl, destroySyncKHR(m_eglDisplay, m_sync));
242 m_sync = EGL_NO_SYNC_KHR;
245 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
247 if (m_eglContext != EGL_NO_CONTEXT)
249 EGLU_CHECK_CALL(egl, destroyContext(m_eglDisplay, m_eglContext));
250 m_eglContext = EGL_NO_CONTEXT;
253 if (m_eglSurface != EGL_NO_SURFACE)
255 EGLU_CHECK_CALL(egl, destroySurface(m_eglDisplay, m_eglSurface));
256 m_eglSurface = EGL_NO_SURFACE;
259 delete m_nativeWindow;
260 m_nativeWindow = DE_NULL;
262 egl.terminate(m_eglDisplay);
263 m_eglDisplay = EGL_NO_DISPLAY;
267 class CreateNullAttribsTest : public SyncTest
270 CreateNullAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
271 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_null_attribs", "create_null_attribs")
275 IterateResult iterate (void)
277 const Library& egl = m_eglTestCtx.getLibrary();
278 TestLog& log = m_testCtx.getLog();
280 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
281 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
282 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
284 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
289 class CreateEmptyAttribsTest : public SyncTest
292 CreateEmptyAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
293 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_empty_attribs", "create_empty_attribs")
297 IterateResult iterate (void)
300 const Library& egl = m_eglTestCtx.getLibrary();
301 TestLog& log = m_testCtx.getLog();
302 const EGLint attribList[] =
307 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, attribList);
308 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", { EGL_NONE })" << TestLog::EndMessage;
309 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
311 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
316 class CreateInvalidDisplayTest : public SyncTest
319 CreateInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
320 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_display", "create_invalid_display")
324 IterateResult iterate (void)
326 const Library& egl = m_eglTestCtx.getLibrary();
327 TestLog& log = m_testCtx.getLog();
329 m_sync = egl.createSyncKHR(EGL_NO_DISPLAY, m_syncType, NULL);
330 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(EGL_NO_DISPLAY, " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
332 EGLint error = egl.getError();
333 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
335 if (error != EGL_BAD_DISPLAY)
337 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
338 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
342 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
344 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
349 class CreateInvalidTypeTest : public SyncTest
352 CreateInvalidTypeTest (EglTestContext& eglTestCtx, EGLenum syncType)
353 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_type", "create_invalid_type")
357 IterateResult iterate (void)
359 const Library& egl = m_eglTestCtx.getLibrary();
360 TestLog& log = m_testCtx.getLog();
362 m_sync = egl.createSyncKHR(m_eglDisplay, EGL_NONE, NULL);
363 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", EGL_NONE, NULL)" << TestLog::EndMessage;
365 EGLint error = egl.getError();
366 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
368 if (error != EGL_BAD_ATTRIBUTE)
370 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
371 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
375 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
377 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
382 class CreateInvalidAttribsTest : public SyncTest
385 CreateInvalidAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
386 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_attribs", "create_invalid_attribs")
390 IterateResult iterate (void)
392 const Library& egl = m_eglTestCtx.getLibrary();
393 TestLog& log = m_testCtx.getLog();
400 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, attribs);
401 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", { 2, 3, 4, 5, EGL_NONE })" << TestLog::EndMessage;
403 EGLint error = egl.getError();
404 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
406 if (error != EGL_BAD_ATTRIBUTE)
408 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
409 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
413 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
415 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
420 class CreateInvalidContextTest : public SyncTest
423 CreateInvalidContextTest (EglTestContext& eglTestCtx, EGLenum syncType)
424 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_context", "create_invalid_context")
428 IterateResult iterate (void)
430 const Library& egl = m_eglTestCtx.getLibrary();
431 TestLog& log = m_testCtx.getLog();
433 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
434 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
436 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
437 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
439 EGLint error = egl.getError();
440 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
442 if (error != EGL_BAD_MATCH)
444 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_MATCH" << TestLog::EndMessage;
445 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
449 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
451 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
456 class ClientWaitNoTimeoutTest : public SyncTest
459 ClientWaitNoTimeoutTest (EglTestContext& eglTestCtx, EGLenum syncType)
460 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_no_timeout", "wait_no_timeout")
464 IterateResult iterate (void)
466 const deUint64 timeoutUs = 100;
467 const Library& egl = m_eglTestCtx.getLibrary();
468 TestLog& log = m_testCtx.getLog();
469 deUint64 beginTimeUs;
472 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
473 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
474 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
476 beginTimeUs = deGetMicroseconds();
477 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, 0);
478 endTimeUs = deGetMicroseconds();
480 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
482 if (m_syncType == EGL_SYNC_FENCE_KHR)
483 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR || status == EGL_TIMEOUT_EXPIRED_KHR);
484 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
485 TCU_CHECK(status == EGL_TIMEOUT_EXPIRED_KHR);
489 log << TestLog::Message << "eglClientWaitSyncKHR() took " << (endTimeUs - beginTimeUs) << "us to finish." << TestLog::EndMessage;
491 if (endTimeUs - beginTimeUs > timeoutUs)
493 log << TestLog::Message << "Call without timeout should finish in less than: " << timeoutUs << "us." << TestLog::EndMessage;
494 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "eglClientWaitSyncKHR(timeout=0) didn't finish fast enough");
498 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
504 class ClientWaitForeverTest : public SyncTest
507 ClientWaitForeverTest (EglTestContext& eglTestCtx, EGLenum syncType)
508 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_forever", "wait_forever")
512 IterateResult iterate (void)
514 const Library& egl = m_eglTestCtx.getLibrary();
515 TestLog& log = m_testCtx.getLog();
517 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
518 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
519 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
521 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
523 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
524 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
525 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
527 else if (m_syncType == EGL_SYNC_FENCE_KHR)
529 GLU_CHECK_GLW_CALL(m_gl, flush());
530 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
535 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, EGL_FOREVER_KHR);
536 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
538 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
539 EGLU_CHECK_MSG(egl, "eglClientWaitSyncKHR()");
541 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
546 class ClientWaitNoContextTest : public SyncTest
549 ClientWaitNoContextTest (EglTestContext& eglTestCtx, EGLenum syncType)
550 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_no_context", "wait_no_Context")
554 IterateResult iterate (void)
556 const Library& egl = m_eglTestCtx.getLibrary();
557 TestLog& log = m_testCtx.getLog();
559 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
560 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
561 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
564 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
566 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
567 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
568 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
570 else if (m_syncType == EGL_SYNC_FENCE_KHR)
572 GLU_CHECK_GLW_CALL(m_gl, flush());
573 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
578 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
579 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
581 EGLint result = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, EGL_FOREVER_KHR);
582 log << TestLog::Message << result << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
584 TCU_CHECK(result == EGL_CONDITION_SATISFIED_KHR);
586 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
591 class ClientWaitForeverFlushTest : public SyncTest
594 ClientWaitForeverFlushTest (EglTestContext& eglTestCtx, EGLenum syncType)
595 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_forever_flush", "wait_forever_flush")
599 IterateResult iterate (void)
601 const Library& egl = m_eglTestCtx.getLibrary();
602 TestLog& log = m_testCtx.getLog();
604 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
605 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
606 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
608 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
610 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
611 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
612 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
615 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
616 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
618 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
620 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
625 class ClientWaitInvalidDisplayTest : public SyncTest
628 ClientWaitInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
629 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_invalid_display", "wait_invalid_display")
633 IterateResult iterate (void)
635 const Library& egl = m_eglTestCtx.getLibrary();
636 TestLog& log = m_testCtx.getLog();
638 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
639 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
640 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
642 EGLint status = egl.clientWaitSyncKHR(EGL_NO_DISPLAY, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
643 log << TestLog::Message << status << " = eglClientWaitSyncKHR(EGL_NO_DISPLAY, " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
645 EGLint error = egl.getError();
646 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
648 if (error != EGL_BAD_DISPLAY)
650 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
651 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
655 TCU_CHECK(status == EGL_FALSE);
657 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
662 class ClientWaitInvalidSyncTest : public SyncTest
665 ClientWaitInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
666 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_invalid_sync", "wait_invalid_sync")
670 IterateResult iterate (void)
672 const Library& egl = m_eglTestCtx.getLibrary();
673 TestLog& log = m_testCtx.getLog();
675 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR, 0, EGL_FOREVER_KHR);
676 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
678 EGLint error = egl.getError();
679 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
681 if (error != EGL_BAD_PARAMETER)
683 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
684 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
688 TCU_CHECK(status == EGL_FALSE);
690 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
695 class GetSyncTypeTest : public SyncTest
698 GetSyncTypeTest (EglTestContext& eglTestCtx, EGLenum syncType)
699 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_type", "get_type")
703 IterateResult iterate (void)
705 const Library& egl = m_eglTestCtx.getLibrary();
706 TestLog& log = m_testCtx.getLog();
708 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
709 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
710 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
713 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_TYPE_KHR, &type));
714 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_TYPE_KHR, {" << type << "})" << TestLog::EndMessage;
716 TCU_CHECK(type == ((EGLint)m_syncType));
718 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
723 class GetSyncStatusTest : public SyncTest
726 GetSyncStatusTest (EglTestContext& eglTestCtx, EGLenum syncType)
727 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_status", "get_status")
731 IterateResult iterate (void)
733 const Library& egl = m_eglTestCtx.getLibrary();
734 TestLog& log = m_testCtx.getLog();
736 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
737 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
738 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
741 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_STATUS_KHR, &status));
742 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_STATUS_KHR, {" << status << "})" << TestLog::EndMessage;
744 if (m_syncType == EGL_SYNC_FENCE_KHR)
745 TCU_CHECK(status == EGL_SIGNALED_KHR || status == EGL_UNSIGNALED_KHR);
746 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
747 TCU_CHECK(status == EGL_UNSIGNALED_KHR);
749 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
754 class GetSyncStatusSignaledTest : public SyncTest
757 GetSyncStatusSignaledTest (EglTestContext& eglTestCtx, EGLenum syncType)
758 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_status_signaled", "get_status_signaled")
762 IterateResult iterate (void)
764 const Library& egl = m_eglTestCtx.getLibrary();
765 TestLog& log = m_testCtx.getLog();
767 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
768 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
769 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
771 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
773 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
774 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
775 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
777 else if (m_syncType == EGL_SYNC_FENCE_KHR)
779 GLU_CHECK_GLW_CALL(m_gl, finish());
780 log << TestLog::Message << "glFinish()" << TestLog::EndMessage;
786 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
787 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
788 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
792 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_STATUS_KHR, &status));
793 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_STATUS_KHR, {" << status << "})" << TestLog::EndMessage;
795 TCU_CHECK(status == EGL_SIGNALED_KHR);
797 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
802 class GetSyncConditionTest : public SyncTest
805 GetSyncConditionTest (EglTestContext& eglTestCtx, EGLenum syncType)
806 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_condition", "get_condition")
810 IterateResult iterate (void)
812 const Library& egl = m_eglTestCtx.getLibrary();
813 TestLog& log = m_testCtx.getLog();
815 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
816 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
817 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
819 EGLint condition = 0;
820 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_CONDITION_KHR, &condition));
821 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
823 TCU_CHECK(condition == EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR);
825 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
830 class GetSyncInvalidDisplayTest : public SyncTest
833 GetSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
834 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_display", "get_invalid_display")
838 IterateResult iterate (void)
840 const Library& egl = m_eglTestCtx.getLibrary();
841 TestLog& log = m_testCtx.getLog();
843 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
844 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
845 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
847 EGLint condition = 0xF0F0F;
848 EGLBoolean result = egl.getSyncAttribKHR(EGL_NO_DISPLAY, m_sync, EGL_SYNC_CONDITION_KHR, &condition);
849 log << TestLog::Message << result << " = eglGetSyncAttribKHR(EGL_NO_DISPLAY, " << m_sync << ", EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
851 EGLint error = egl.getError();
852 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
854 if (error != EGL_BAD_DISPLAY)
856 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
857 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
861 TCU_CHECK(result == EGL_FALSE);
862 TCU_CHECK(condition == 0xF0F0F);
864 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
869 class GetSyncInvalidSyncTest : public SyncTest
872 GetSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)\
873 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_invalid_sync", "get_invalid_sync")
877 IterateResult iterate (void)
879 const Library& egl = m_eglTestCtx.getLibrary();
880 TestLog& log = m_testCtx.getLog();
882 EGLint condition = 0xF0F0F;
883 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, EGL_NO_SYNC_KHR, EGL_SYNC_CONDITION_KHR, &condition);
884 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
886 EGLint error = egl.getError();
887 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
889 if (error != EGL_BAD_PARAMETER)
891 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
892 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
896 TCU_CHECK(result == EGL_FALSE);
897 TCU_CHECK(condition == 0xF0F0F);
899 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
904 class GetSyncInvalidAttributeTest : public SyncTest
907 GetSyncInvalidAttributeTest (EglTestContext& eglTestCtx, EGLenum syncType)
908 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_attribute", "get_invalid_attribute")
912 IterateResult iterate (void)
914 const Library& egl = m_eglTestCtx.getLibrary();
915 TestLog& log = m_testCtx.getLog();
917 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
918 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
919 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
921 EGLint condition = 0xF0F0F;
922 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, m_sync, EGL_NONE, &condition);
923 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_NONE, {" << condition << "})" << TestLog::EndMessage;
925 EGLint error = egl.getError();
926 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
928 if (error != EGL_BAD_ATTRIBUTE)
930 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
931 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
935 TCU_CHECK(result == EGL_FALSE);
936 TCU_CHECK(condition == 0xF0F0F);
938 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
943 class GetSyncInvalidValueTest : public SyncTest
946 GetSyncInvalidValueTest (EglTestContext& eglTestCtx, EGLenum syncType)
947 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_value", "get_invalid_value")
951 IterateResult iterate (void)
953 const Library& egl = m_eglTestCtx.getLibrary();
954 TestLog& log = m_testCtx.getLog();
956 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
957 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
958 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
960 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_TYPE_KHR, NULL);
961 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_CONDITION_KHR, NULL)" << TestLog::EndMessage;
963 EGLint error = egl.getError();
964 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
966 if (error != EGL_BAD_PARAMETER)
968 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
969 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
973 TCU_CHECK(result == EGL_FALSE);
975 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
980 class DestroySyncTest : public SyncTest
983 DestroySyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
984 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy", "destroy")
988 IterateResult iterate (void)
990 const Library& egl = m_eglTestCtx.getLibrary();
991 TestLog& log = m_testCtx.getLog();
993 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
994 log << TestLog::Message << "eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
995 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
997 log << TestLog::Message << "eglDestroySyncKHR(" << m_eglDisplay << ", " << m_sync << ")" << TestLog::EndMessage;
998 EGLU_CHECK_CALL(egl, destroySyncKHR(m_eglDisplay, m_sync));
999 m_sync = EGL_NO_SYNC_KHR;
1001 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1006 class DestroySyncInvalidDislayTest : public SyncTest
1009 DestroySyncInvalidDislayTest (EglTestContext& eglTestCtx, EGLenum syncType)
1010 : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy_invalid_display", "destroy_invalid_display")
1014 IterateResult iterate (void)
1016 const Library& egl = m_eglTestCtx.getLibrary();
1017 TestLog& log = m_testCtx.getLog();
1019 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1020 log << TestLog::Message << "eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1021 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1023 EGLBoolean result = egl.destroySyncKHR(EGL_NO_DISPLAY, m_sync);
1024 log << TestLog::Message << result << " = eglDestroySyncKHR(EGL_NO_DISPLAY, " << m_sync << ")" << TestLog::EndMessage;
1026 EGLint error = egl.getError();
1027 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1029 if (error != EGL_BAD_DISPLAY)
1031 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1032 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1036 TCU_CHECK(result == EGL_FALSE);
1038 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1043 class DestroySyncInvalidSyncTest : public SyncTest
1046 DestroySyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1047 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy_invalid_sync", "destroy_invalid_sync")
1051 IterateResult iterate (void)
1053 const Library& egl = m_eglTestCtx.getLibrary();
1054 TestLog& log = m_testCtx.getLog();
1056 EGLBoolean result = egl.destroySyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR);
1057 log << TestLog::Message << result << " = eglDestroySyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR)" << TestLog::EndMessage;
1059 EGLint error = egl.getError();
1060 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1062 if (error != EGL_BAD_PARAMETER)
1064 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1065 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1069 TCU_CHECK(result == EGL_FALSE);
1071 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1076 class WaitSyncTest : public SyncTest
1079 WaitSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1080 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server", "wait_server")
1084 IterateResult iterate (void)
1086 const Library& egl = m_eglTestCtx.getLibrary();
1087 TestLog& log = m_testCtx.getLog();
1089 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1090 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1091 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1093 EGLint status = egl.waitSyncKHR(m_eglDisplay, m_sync, 0);
1094 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
1096 TCU_CHECK(status == EGL_TRUE);
1098 GLU_CHECK_GLW_CALL(m_gl, finish());
1100 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1106 class WaitSyncInvalidDisplayTest : public SyncTest
1109 WaitSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
1110 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_display", "wait_server_invalid_display")
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(EGL_NO_DISPLAY, m_sync, 0);
1124 log << TestLog::Message << status << " = eglWaitSyncKHR(EGL_NO_DISPLAY, " << m_sync << ", 0)" << TestLog::EndMessage;
1126 EGLint error = egl.getError();
1127 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1129 if (error != EGL_BAD_DISPLAY)
1131 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << 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");
1143 class WaitSyncInvalidSyncTest : public SyncTest
1146 WaitSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1147 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_sync", "wait_server_invalid_sync")
1151 IterateResult iterate (void)
1153 const Library& egl = m_eglTestCtx.getLibrary();
1154 TestLog& log = m_testCtx.getLog();
1156 EGLint status = egl.waitSyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR, 0);
1157 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, 0)" << TestLog::EndMessage;
1159 EGLint error = egl.getError();
1160 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1162 if (error != EGL_BAD_PARAMETER)
1164 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1165 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1169 TCU_CHECK(status == EGL_FALSE);
1171 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1176 class WaitSyncInvalidFlagTest : public SyncTest
1179 WaitSyncInvalidFlagTest (EglTestContext& eglTestCtx, EGLenum syncType)
1180 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_flag", "wait_server_invalid_flag")
1184 IterateResult iterate (void)
1186 const Library& egl = m_eglTestCtx.getLibrary();
1187 TestLog& log = m_testCtx.getLog();
1189 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1190 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1191 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1193 EGLint status = egl.waitSyncKHR(m_eglDisplay, m_sync, 0xFFFFFFFF);
1194 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0xFFFFFFFF)" << TestLog::EndMessage;
1196 EGLint error = egl.getError();
1197 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1199 if (error != EGL_BAD_PARAMETER)
1201 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1202 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1206 TCU_CHECK(status == EGL_FALSE);
1208 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1215 FenceSyncTests::FenceSyncTests (EglTestContext& eglTestCtx)
1216 : TestCaseGroup (eglTestCtx, "fence_sync", "EGL_KHR_fence_sync extension tests")
1220 void FenceSyncTests::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_FENCE_KHR));
1228 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1230 // eglClientWaitSyncKHR tests
1231 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1232 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1233 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1234 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1236 // eglGetSyncAttribKHR tests
1237 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1238 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1239 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1240 valid->addChild(new GetSyncConditionTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1242 // eglDestroySyncKHR tests
1243 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1245 // eglWaitSyncKHR tests
1246 valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1251 // Add negative API tests
1253 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
1255 // eglCreateSyncKHR tests
1256 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1257 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1258 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1259 invalid->addChild(new CreateInvalidContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1261 // eglClientWaitSyncKHR tests
1262 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1263 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1265 // eglGetSyncAttribKHR tests
1266 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1267 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1268 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1269 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1271 // eglDestroySyncKHR tests
1272 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1273 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1275 // eglWaitSyncKHR tests
1276 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1277 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1278 invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1284 ReusableSyncTests::ReusableSyncTests (EglTestContext& eglTestCtx)
1285 : TestCaseGroup (eglTestCtx, "reusable_sync", "EGL_KHR_reusable_sync extension tests")
1289 void ReusableSyncTests::init (void)
1291 // Add valid API test
1293 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
1295 // eglCreateSyncKHR tests
1296 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1297 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1299 // eglClientWaitSyncKHR tests
1300 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1301 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1302 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1303 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1305 // eglGetSyncAttribKHR tests
1306 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1307 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1308 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1310 // eglDestroySyncKHR tests
1311 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1313 // eglWaitSyncKHR tests
1314 valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1319 // Add negative API tests
1321 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
1323 // eglCreateSyncKHR tests
1324 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1325 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1326 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1328 // eglClientWaitSyncKHR tests
1329 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1330 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1332 // eglGetSyncAttribKHR tests
1333 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1334 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1335 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1336 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1338 // eglDestroySyncKHR tests
1339 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1340 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1342 // eglWaitSyncKHR tests
1343 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1344 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1345 invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));