1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief EGL EGL_KHR_fence_sync and EGL_KHR_reusable_sync tests
22 *//*--------------------------------------------------------------------*/
24 #include "teglSyncTests.hpp"
26 #include "egluNativeWindow.hpp"
27 #include "egluStrUtil.hpp"
28 #include "egluUtil.hpp"
30 #include "eglwLibrary.hpp"
31 #include "eglwEnums.hpp"
33 #include "tcuTestLog.hpp"
34 #include "tcuCommandLine.hpp"
36 #include "gluDefs.hpp"
38 #include "glwFunctions.hpp"
39 #include "glwEnums.hpp"
62 const char* getSyncTypeName (EGLenum syncType)
66 case EGL_SYNC_FENCE_KHR: return "EGL_SYNC_FENCE_KHR";
67 case EGL_SYNC_REUSABLE_KHR: return "EGL_SYNC_REUSABLE_KHR";
74 class SyncTest : public TestCase
80 EXTENSION_WAIT_SYNC = (0x1 << 0),
81 EXTENSION_FENCE_SYNC = (0x1 << 1),
82 EXTENSION_REUSABLE_SYNC = (0x1 << 2)
84 SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, bool useCurrentContext, const char* name, const char* description);
91 const EGLenum m_syncType;
92 const Extension m_extensions;
93 const bool m_useCurrentContext;
97 EGLDisplay m_eglDisplay;
98 EGLConfig m_eglConfig;
99 EGLSurface m_eglSurface;
100 eglu::NativeWindow* m_nativeWindow;
101 EGLContext m_eglContext;
105 SyncTest::SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, bool useCurrentContext, const char* name, const char* description)
106 : TestCase (eglTestCtx, name, description)
107 , m_syncType (syncType)
108 , m_extensions (extensions)
109 , m_useCurrentContext (useCurrentContext)
110 , m_eglDisplay (EGL_NO_DISPLAY)
111 , m_eglSurface (EGL_NO_SURFACE)
112 , m_nativeWindow (DE_NULL)
113 , m_eglContext (EGL_NO_CONTEXT)
114 , m_sync (EGL_NO_SYNC_KHR)
118 SyncTest::~SyncTest (void)
123 void requiredEGLExtensions (const Library& egl, EGLDisplay display, SyncTest::Extension requiredExtensions)
125 SyncTest::Extension foundExtensions = SyncTest::EXTENSION_NONE;
126 std::istringstream extensionStream(egl.queryString(display, EGL_EXTENSIONS));
129 EGLU_CHECK_MSG(egl, "eglQueryString(display, EGL_EXTENSIONS)");
131 while (std::getline(extensionStream, extension, ' '))
133 if (extension == "EGL_KHR_fence_sync")
134 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_FENCE_SYNC);
135 else if (extension == "EGL_KHR_reusable_sync")
136 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_REUSABLE_SYNC);
137 else if (extension == "EGL_KHR_wait_sync")
138 foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_WAIT_SYNC);
142 const SyncTest::Extension missingExtensions = (SyncTest::Extension)((foundExtensions & requiredExtensions) ^ requiredExtensions);
144 if ((missingExtensions & SyncTest::EXTENSION_FENCE_SYNC) != 0)
145 TCU_THROW(NotSupportedError, "EGL_KHR_fence_sync not supported");
147 if ((missingExtensions & SyncTest::EXTENSION_REUSABLE_SYNC) != 0)
148 TCU_THROW(NotSupportedError, "EGL_KHR_reusable_sync not supported");
150 if ((missingExtensions & SyncTest::EXTENSION_WAIT_SYNC) != 0)
151 TCU_THROW(NotSupportedError, "EGL_KHR_wait_sync not supported");
155 void requiredGLESExtensions (const glw::Functions& gl)
158 std::istringstream extensionStream((const char*)gl.getString(GL_EXTENSIONS));
161 GLU_CHECK_GLW_MSG(gl, "glGetString(GL_EXTENSIONS)");
163 while (std::getline(extensionStream, extension, ' '))
165 if (extension == "GL_OES_EGL_sync")
170 TCU_THROW(NotSupportedError, "GL_OES_EGL_sync not supported");
173 SyncTest::Extension getSyncTypeExtension (EGLenum syncType)
177 case EGL_SYNC_FENCE_KHR: return SyncTest::EXTENSION_FENCE_SYNC;
178 case EGL_SYNC_REUSABLE_KHR: return SyncTest::EXTENSION_REUSABLE_SYNC;
181 return SyncTest::EXTENSION_NONE;
185 void SyncTest::init (void)
187 const Library& egl = m_eglTestCtx.getLibrary();
188 const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
190 const EGLint displayAttribList[] =
192 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
193 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
198 const EGLint contextAttribList[] =
200 EGL_CONTEXT_CLIENT_VERSION, 2,
204 m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
205 m_eglConfig = eglu::chooseSingleConfig(egl, m_eglDisplay, displayAttribList);
207 m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
210 const Extension syncTypeExtension = getSyncTypeExtension(m_syncType);
211 requiredEGLExtensions(egl, m_eglDisplay, (Extension)(m_extensions | syncTypeExtension));
214 if (m_useCurrentContext)
217 EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
218 m_eglContext = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttribList);
219 EGLU_CHECK_MSG(egl, "Failed to create GLES2 context");
222 m_nativeWindow = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
223 m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_nativeWindow, m_eglDisplay, m_eglConfig, DE_NULL);
225 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext));
227 requiredGLESExtensions(m_gl);
231 void SyncTest::deinit (void)
233 const Library& egl = m_eglTestCtx.getLibrary();
235 if (m_eglDisplay != EGL_NO_DISPLAY)
237 if (m_sync != EGL_NO_SYNC_KHR)
239 EGLU_CHECK_CALL(egl, destroySyncKHR(m_eglDisplay, m_sync));
240 m_sync = EGL_NO_SYNC_KHR;
243 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
245 if (m_eglContext != EGL_NO_CONTEXT)
247 EGLU_CHECK_CALL(egl, destroyContext(m_eglDisplay, m_eglContext));
248 m_eglContext = EGL_NO_CONTEXT;
251 if (m_eglSurface != EGL_NO_SURFACE)
253 EGLU_CHECK_CALL(egl, destroySurface(m_eglDisplay, m_eglSurface));
254 m_eglSurface = EGL_NO_SURFACE;
257 delete m_nativeWindow;
258 m_nativeWindow = DE_NULL;
260 egl.terminate(m_eglDisplay);
261 m_eglDisplay = EGL_NO_DISPLAY;
265 class CreateNullAttribsTest : public SyncTest
268 CreateNullAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
269 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_null_attribs", "create_null_attribs")
273 IterateResult iterate (void)
275 const Library& egl = m_eglTestCtx.getLibrary();
276 TestLog& log = m_testCtx.getLog();
278 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
279 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
280 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
282 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
287 class CreateEmptyAttribsTest : public SyncTest
290 CreateEmptyAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
291 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_empty_attribs", "create_empty_attribs")
295 IterateResult iterate (void)
298 const Library& egl = m_eglTestCtx.getLibrary();
299 TestLog& log = m_testCtx.getLog();
300 const EGLint attribList[] =
305 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, attribList);
306 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", { EGL_NONE })" << TestLog::EndMessage;
307 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
309 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
314 class CreateInvalidDisplayTest : public SyncTest
317 CreateInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
318 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_display", "create_invalid_display")
322 IterateResult iterate (void)
324 const Library& egl = m_eglTestCtx.getLibrary();
325 TestLog& log = m_testCtx.getLog();
327 m_sync = egl.createSyncKHR(EGL_NO_DISPLAY, m_syncType, NULL);
328 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(EGL_NO_DISPLAY, " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
330 EGLint error = egl.getError();
331 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
333 if (error != EGL_BAD_DISPLAY)
335 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
336 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
340 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
342 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
347 class CreateInvalidTypeTest : public SyncTest
350 CreateInvalidTypeTest (EglTestContext& eglTestCtx, EGLenum syncType)
351 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_type", "create_invalid_type")
355 IterateResult iterate (void)
357 const Library& egl = m_eglTestCtx.getLibrary();
358 TestLog& log = m_testCtx.getLog();
360 m_sync = egl.createSyncKHR(m_eglDisplay, EGL_NONE, NULL);
361 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", EGL_NONE, NULL)" << TestLog::EndMessage;
363 EGLint error = egl.getError();
364 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
366 if (error != EGL_BAD_ATTRIBUTE)
368 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
369 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
373 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
375 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
380 class CreateInvalidAttribsTest : public SyncTest
383 CreateInvalidAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
384 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_attribs", "create_invalid_attribs")
388 IterateResult iterate (void)
390 const Library& egl = m_eglTestCtx.getLibrary();
391 TestLog& log = m_testCtx.getLog();
398 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, attribs);
399 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", { 2, 3, 4, 5, EGL_NONE })" << TestLog::EndMessage;
401 EGLint error = egl.getError();
402 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
404 if (error != EGL_BAD_ATTRIBUTE)
406 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
407 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
411 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
413 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
418 class CreateInvalidContextTest : public SyncTest
421 CreateInvalidContextTest (EglTestContext& eglTestCtx, EGLenum syncType)
422 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_context", "create_invalid_context")
426 IterateResult iterate (void)
428 const Library& egl = m_eglTestCtx.getLibrary();
429 TestLog& log = m_testCtx.getLog();
431 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
432 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
434 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
435 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
437 EGLint error = egl.getError();
438 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
440 if (error != EGL_BAD_MATCH)
442 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_MATCH" << TestLog::EndMessage;
443 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
447 TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
449 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
454 class ClientWaitNoTimeoutTest : public SyncTest
457 ClientWaitNoTimeoutTest (EglTestContext& eglTestCtx, EGLenum syncType)
458 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_no_timeout", "wait_no_timeout")
462 IterateResult iterate (void)
464 const Library& egl = m_eglTestCtx.getLibrary();
465 TestLog& log = m_testCtx.getLog();
467 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
468 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
469 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
471 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, 0);
472 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
474 if (m_syncType == EGL_SYNC_FENCE_KHR)
475 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR || status == EGL_TIMEOUT_EXPIRED_KHR);
476 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
477 TCU_CHECK(status == EGL_TIMEOUT_EXPIRED_KHR);
481 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
487 class ClientWaitForeverTest : public SyncTest
490 ClientWaitForeverTest (EglTestContext& eglTestCtx, EGLenum syncType)
491 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_forever", "wait_forever")
495 IterateResult iterate (void)
497 const Library& egl = m_eglTestCtx.getLibrary();
498 TestLog& log = m_testCtx.getLog();
500 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
501 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
502 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
504 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
506 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
507 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
508 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
510 else if (m_syncType == EGL_SYNC_FENCE_KHR)
512 GLU_CHECK_GLW_CALL(m_gl, flush());
513 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
518 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, EGL_FOREVER_KHR);
519 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
521 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
522 EGLU_CHECK_MSG(egl, "eglClientWaitSyncKHR()");
524 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
529 class ClientWaitNoContextTest : public SyncTest
532 ClientWaitNoContextTest (EglTestContext& eglTestCtx, EGLenum syncType)
533 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_no_context", "wait_no_Context")
537 IterateResult iterate (void)
539 const Library& egl = m_eglTestCtx.getLibrary();
540 TestLog& log = m_testCtx.getLog();
542 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
543 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
544 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
547 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
549 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
550 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
551 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
553 else if (m_syncType == EGL_SYNC_FENCE_KHR)
555 GLU_CHECK_GLW_CALL(m_gl, flush());
556 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
561 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
562 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
564 EGLint result = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, 0, EGL_FOREVER_KHR);
565 log << TestLog::Message << result << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
567 TCU_CHECK(result == EGL_CONDITION_SATISFIED_KHR);
569 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
574 class ClientWaitForeverFlushTest : public SyncTest
577 ClientWaitForeverFlushTest (EglTestContext& eglTestCtx, EGLenum syncType)
578 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_forever_flush", "wait_forever_flush")
582 IterateResult iterate (void)
584 const Library& egl = m_eglTestCtx.getLibrary();
585 TestLog& log = m_testCtx.getLog();
587 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
588 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
589 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
591 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
593 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
594 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
595 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
598 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
599 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
601 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
603 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
608 class ClientWaitInvalidDisplayTest : public SyncTest
611 ClientWaitInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
612 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_invalid_display", "wait_invalid_display")
616 IterateResult iterate (void)
618 const Library& egl = m_eglTestCtx.getLibrary();
619 TestLog& log = m_testCtx.getLog();
621 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
622 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
623 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
625 EGLint status = egl.clientWaitSyncKHR(EGL_NO_DISPLAY, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
626 log << TestLog::Message << status << " = eglClientWaitSyncKHR(EGL_NO_DISPLAY, " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
628 EGLint error = egl.getError();
629 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
631 if (error != EGL_BAD_DISPLAY)
633 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
634 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
638 TCU_CHECK(status == EGL_FALSE);
640 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
645 class ClientWaitInvalidSyncTest : public SyncTest
648 ClientWaitInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
649 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_invalid_sync", "wait_invalid_sync")
653 IterateResult iterate (void)
655 const Library& egl = m_eglTestCtx.getLibrary();
656 TestLog& log = m_testCtx.getLog();
658 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR, 0, EGL_FOREVER_KHR);
659 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
661 EGLint error = egl.getError();
662 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
664 if (error != EGL_BAD_PARAMETER)
666 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
667 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
671 TCU_CHECK(status == EGL_FALSE);
673 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
678 class GetSyncTypeTest : public SyncTest
681 GetSyncTypeTest (EglTestContext& eglTestCtx, EGLenum syncType)
682 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_type", "get_type")
686 IterateResult iterate (void)
688 const Library& egl = m_eglTestCtx.getLibrary();
689 TestLog& log = m_testCtx.getLog();
691 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
692 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
693 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
696 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_TYPE_KHR, &type));
697 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_TYPE_KHR, {" << type << "})" << TestLog::EndMessage;
699 TCU_CHECK(type == ((EGLint)m_syncType));
701 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
706 class GetSyncStatusTest : public SyncTest
709 GetSyncStatusTest (EglTestContext& eglTestCtx, EGLenum syncType)
710 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_status", "get_status")
714 IterateResult iterate (void)
716 const Library& egl = m_eglTestCtx.getLibrary();
717 TestLog& log = m_testCtx.getLog();
719 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
720 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
721 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
724 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_STATUS_KHR, &status));
725 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_STATUS_KHR, {" << status << "})" << TestLog::EndMessage;
727 if (m_syncType == EGL_SYNC_FENCE_KHR)
728 TCU_CHECK(status == EGL_SIGNALED_KHR || status == EGL_UNSIGNALED_KHR);
729 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
730 TCU_CHECK(status == EGL_UNSIGNALED_KHR);
732 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
737 class GetSyncStatusSignaledTest : public SyncTest
740 GetSyncStatusSignaledTest (EglTestContext& eglTestCtx, EGLenum syncType)
741 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_status_signaled", "get_status_signaled")
745 IterateResult iterate (void)
747 const Library& egl = m_eglTestCtx.getLibrary();
748 TestLog& log = m_testCtx.getLog();
750 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
751 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
752 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
754 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
756 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
757 log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
758 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
760 else if (m_syncType == EGL_SYNC_FENCE_KHR)
762 GLU_CHECK_GLW_CALL(m_gl, finish());
763 log << TestLog::Message << "glFinish()" << TestLog::EndMessage;
769 EGLint status = egl.clientWaitSyncKHR(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
770 log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
771 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
775 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_STATUS_KHR, &status));
776 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_STATUS_KHR, {" << status << "})" << TestLog::EndMessage;
778 TCU_CHECK(status == EGL_SIGNALED_KHR);
780 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
785 class GetSyncConditionTest : public SyncTest
788 GetSyncConditionTest (EglTestContext& eglTestCtx, EGLenum syncType)
789 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_condition", "get_condition")
793 IterateResult iterate (void)
795 const Library& egl = m_eglTestCtx.getLibrary();
796 TestLog& log = m_testCtx.getLog();
798 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
799 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
800 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
802 EGLint condition = 0;
803 EGLU_CHECK_CALL(egl, getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_CONDITION_KHR, &condition));
804 log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
806 TCU_CHECK(condition == EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR);
808 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
813 class GetSyncInvalidDisplayTest : public SyncTest
816 GetSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
817 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_display", "get_invalid_display")
821 IterateResult iterate (void)
823 const Library& egl = m_eglTestCtx.getLibrary();
824 TestLog& log = m_testCtx.getLog();
826 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
827 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
828 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
830 EGLint condition = 0xF0F0F;
831 EGLBoolean result = egl.getSyncAttribKHR(EGL_NO_DISPLAY, m_sync, EGL_SYNC_CONDITION_KHR, &condition);
832 log << TestLog::Message << result << " = eglGetSyncAttribKHR(EGL_NO_DISPLAY, " << m_sync << ", EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
834 EGLint error = egl.getError();
835 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
837 if (error != EGL_BAD_DISPLAY)
839 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
840 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
844 TCU_CHECK(result == EGL_FALSE);
845 TCU_CHECK(condition == 0xF0F0F);
847 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
852 class GetSyncInvalidSyncTest : public SyncTest
855 GetSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)\
856 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_invalid_sync", "get_invalid_sync")
860 IterateResult iterate (void)
862 const Library& egl = m_eglTestCtx.getLibrary();
863 TestLog& log = m_testCtx.getLog();
865 EGLint condition = 0xF0F0F;
866 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, EGL_NO_SYNC_KHR, EGL_SYNC_CONDITION_KHR, &condition);
867 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
869 EGLint error = egl.getError();
870 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
872 if (error != EGL_BAD_PARAMETER)
874 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
875 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
879 TCU_CHECK(result == EGL_FALSE);
880 TCU_CHECK(condition == 0xF0F0F);
882 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
887 class GetSyncInvalidAttributeTest : public SyncTest
890 GetSyncInvalidAttributeTest (EglTestContext& eglTestCtx, EGLenum syncType)
891 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_attribute", "get_invalid_attribute")
895 IterateResult iterate (void)
897 const Library& egl = m_eglTestCtx.getLibrary();
898 TestLog& log = m_testCtx.getLog();
900 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
901 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
902 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
904 EGLint condition = 0xF0F0F;
905 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, m_sync, EGL_NONE, &condition);
906 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_NONE, {" << condition << "})" << TestLog::EndMessage;
908 EGLint error = egl.getError();
909 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
911 if (error != EGL_BAD_ATTRIBUTE)
913 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
914 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
918 TCU_CHECK(result == EGL_FALSE);
919 TCU_CHECK(condition == 0xF0F0F);
921 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
926 class GetSyncInvalidValueTest : public SyncTest
929 GetSyncInvalidValueTest (EglTestContext& eglTestCtx, EGLenum syncType)
930 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_value", "get_invalid_value")
934 IterateResult iterate (void)
936 const Library& egl = m_eglTestCtx.getLibrary();
937 TestLog& log = m_testCtx.getLog();
939 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
940 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
941 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
943 EGLBoolean result = egl.getSyncAttribKHR(m_eglDisplay, m_sync, EGL_SYNC_TYPE_KHR, NULL);
944 log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_CONDITION_KHR, NULL)" << TestLog::EndMessage;
946 EGLint error = egl.getError();
947 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
949 if (error != EGL_BAD_PARAMETER)
951 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
952 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
956 TCU_CHECK(result == EGL_FALSE);
958 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
963 class DestroySyncTest : public SyncTest
966 DestroySyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
967 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy", "destroy")
971 IterateResult iterate (void)
973 const Library& egl = m_eglTestCtx.getLibrary();
974 TestLog& log = m_testCtx.getLog();
976 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
977 log << TestLog::Message << "eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
978 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
980 log << TestLog::Message << "eglDestroySyncKHR(" << m_eglDisplay << ", " << m_sync << ")" << TestLog::EndMessage;
981 EGLU_CHECK_CALL(egl, destroySyncKHR(m_eglDisplay, m_sync));
982 m_sync = EGL_NO_SYNC_KHR;
984 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
989 class DestroySyncInvalidDislayTest : public SyncTest
992 DestroySyncInvalidDislayTest (EglTestContext& eglTestCtx, EGLenum syncType)
993 : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy_invalid_display", "destroy_invalid_display")
997 IterateResult iterate (void)
999 const Library& egl = m_eglTestCtx.getLibrary();
1000 TestLog& log = m_testCtx.getLog();
1002 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1003 log << TestLog::Message << "eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1004 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1006 EGLBoolean result = egl.destroySyncKHR(EGL_NO_DISPLAY, m_sync);
1007 log << TestLog::Message << result << " = eglDestroySyncKHR(EGL_NO_DISPLAY, " << m_sync << ")" << 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) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1015 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1019 TCU_CHECK(result == EGL_FALSE);
1021 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1026 class DestroySyncInvalidSyncTest : public SyncTest
1029 DestroySyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1030 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy_invalid_sync", "destroy_invalid_sync")
1034 IterateResult iterate (void)
1036 const Library& egl = m_eglTestCtx.getLibrary();
1037 TestLog& log = m_testCtx.getLog();
1039 EGLBoolean result = egl.destroySyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR);
1040 log << TestLog::Message << result << " = eglDestroySyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR)" << TestLog::EndMessage;
1042 EGLint error = egl.getError();
1043 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1045 if (error != EGL_BAD_PARAMETER)
1047 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1048 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1052 TCU_CHECK(result == EGL_FALSE);
1054 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1059 class WaitSyncTest : public SyncTest
1062 WaitSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1063 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server", "wait_server")
1067 IterateResult iterate (void)
1069 const Library& egl = m_eglTestCtx.getLibrary();
1070 TestLog& log = m_testCtx.getLog();
1072 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1073 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1074 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1076 EGLint status = egl.waitSyncKHR(m_eglDisplay, m_sync, 0);
1077 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
1079 TCU_CHECK(status == EGL_TRUE);
1081 GLU_CHECK_GLW_CALL(m_gl, finish());
1083 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1089 class WaitSyncInvalidDisplayTest : public SyncTest
1092 WaitSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
1093 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_display", "wait_server_invalid_display")
1097 IterateResult iterate (void)
1099 const Library& egl = m_eglTestCtx.getLibrary();
1100 TestLog& log = m_testCtx.getLog();
1102 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1103 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1104 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1106 EGLint status = egl.waitSyncKHR(EGL_NO_DISPLAY, m_sync, 0);
1107 log << TestLog::Message << status << " = eglWaitSyncKHR(EGL_NO_DISPLAY, " << m_sync << ", 0)" << TestLog::EndMessage;
1109 EGLint error = egl.getError();
1110 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1112 if (error != EGL_BAD_DISPLAY)
1114 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1115 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1119 TCU_CHECK(status == EGL_FALSE);
1121 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1126 class WaitSyncInvalidSyncTest : public SyncTest
1129 WaitSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1130 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_sync", "wait_server_invalid_sync")
1134 IterateResult iterate (void)
1136 const Library& egl = m_eglTestCtx.getLibrary();
1137 TestLog& log = m_testCtx.getLog();
1139 EGLint status = egl.waitSyncKHR(m_eglDisplay, EGL_NO_SYNC_KHR, 0);
1140 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, 0)" << TestLog::EndMessage;
1142 EGLint error = egl.getError();
1143 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1145 if (error != EGL_BAD_PARAMETER)
1147 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1148 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1152 TCU_CHECK(status == EGL_FALSE);
1154 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1159 class WaitSyncInvalidFlagTest : public SyncTest
1162 WaitSyncInvalidFlagTest (EglTestContext& eglTestCtx, EGLenum syncType)
1163 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_flag", "wait_server_invalid_flag")
1167 IterateResult iterate (void)
1169 const Library& egl = m_eglTestCtx.getLibrary();
1170 TestLog& log = m_testCtx.getLog();
1172 m_sync = egl.createSyncKHR(m_eglDisplay, m_syncType, NULL);
1173 log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
1174 EGLU_CHECK_MSG(egl, "eglCreateSyncKHR()");
1176 EGLint status = egl.waitSyncKHR(m_eglDisplay, m_sync, 0xFFFFFFFF);
1177 log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0xFFFFFFFF)" << TestLog::EndMessage;
1179 EGLint error = egl.getError();
1180 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1182 if (error != EGL_BAD_PARAMETER)
1184 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1185 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1189 TCU_CHECK(status == EGL_FALSE);
1191 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1198 FenceSyncTests::FenceSyncTests (EglTestContext& eglTestCtx)
1199 : TestCaseGroup (eglTestCtx, "fence_sync", "EGL_KHR_fence_sync extension tests")
1203 void FenceSyncTests::init (void)
1205 // Add valid API test
1207 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
1209 // eglCreateSyncKHR tests
1210 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1211 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1213 // eglClientWaitSyncKHR tests
1214 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1215 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1216 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1217 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1219 // eglGetSyncAttribKHR tests
1220 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1221 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1222 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1223 valid->addChild(new GetSyncConditionTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1225 // eglDestroySyncKHR tests
1226 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1228 // eglWaitSyncKHR tests
1229 valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1234 // Add negative API tests
1236 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
1238 // eglCreateSyncKHR tests
1239 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1240 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1241 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1242 invalid->addChild(new CreateInvalidContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1244 // eglClientWaitSyncKHR tests
1245 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1246 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1248 // eglGetSyncAttribKHR tests
1249 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1250 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1251 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1252 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1254 // eglDestroySyncKHR tests
1255 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1256 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1258 // eglWaitSyncKHR tests
1259 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1260 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1261 invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
1267 ReusableSyncTests::ReusableSyncTests (EglTestContext& eglTestCtx)
1268 : TestCaseGroup (eglTestCtx, "reusable_sync", "EGL_KHR_reusable_sync extension tests")
1272 void ReusableSyncTests::init (void)
1274 // Add valid API test
1276 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
1278 // eglCreateSyncKHR tests
1279 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1280 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1282 // eglClientWaitSyncKHR tests
1283 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1284 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1285 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1286 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1288 // eglGetSyncAttribKHR tests
1289 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1290 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1291 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1293 // eglDestroySyncKHR tests
1294 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1296 // eglWaitSyncKHR tests
1297 valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1302 // Add negative API tests
1304 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
1306 // eglCreateSyncKHR tests
1307 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1308 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1309 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1311 // eglClientWaitSyncKHR tests
1312 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1313 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1315 // eglGetSyncAttribKHR tests
1316 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1317 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1318 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1319 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1321 // eglDestroySyncKHR tests
1322 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1323 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1325 // eglWaitSyncKHR tests
1326 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1327 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
1328 invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));