Home | History | Annotate | Download | only in egl
      1 /*-------------------------------------------------------------------------
      2  * drawElements Quality Program EGL Module
      3  * ---------------------------------------
      4  *
      5  * Copyright 2014 The Android Open Source Project
      6  *
      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
     10  *
     11  *      http://www.apache.org/licenses/LICENSE-2.0
     12  *
     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.
     18  *
     19  *//*!
     20  * \file
     21  * \brief EGL EGL_KHR_fence_sync and EGL_KHR_reusable_sync tests
     22  *//*--------------------------------------------------------------------*/
     23 
     24 #include "teglSyncTests.hpp"
     25 
     26 #include "egluNativeWindow.hpp"
     27 #include "egluStrUtil.hpp"
     28 #include "egluUtil.hpp"
     29 
     30 #include "tcuTestLog.hpp"
     31 #include "tcuCommandLine.hpp"
     32 
     33 #include "gluDefs.hpp"
     34 
     35 #include <EGL/eglext.h>
     36 #include <GLES2/gl2.h>
     37 
     38 #ifndef EGL_KHR_wait_sync
     39 #define EGL_KHR_wait_sync 1
     40 typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
     41 #ifdef EGL_EGLEXT_PROTOTYPES
     42 EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
     43 #endif
     44 #endif /* EGL_KHR_wait_sync */
     45 
     46 #include <vector>
     47 #include <string>
     48 #include <sstream>
     49 #include <set>
     50 
     51 using std::vector;
     52 using std::string;
     53 using std::set;
     54 
     55 using tcu::TestLog;
     56 
     57 namespace deqp
     58 {
     59 namespace egl
     60 {
     61 namespace
     62 {
     63 
     64 const char* getSyncTypeName (EGLenum syncType)
     65 {
     66 	switch (syncType)
     67 	{
     68 		case EGL_SYNC_FENCE_KHR:	return "EGL_SYNC_FENCE_KHR";
     69 		case EGL_SYNC_REUSABLE_KHR:	return "EGL_SYNC_REUSABLE_KHR";
     70 		default:
     71 			DE_ASSERT(DE_FALSE);
     72 			return "<Unknown>";
     73 	}
     74 }
     75 
     76 class SyncTest : public TestCase
     77 {
     78 public:
     79 	enum Extension
     80 	{
     81 		EXTENSION_NONE				= 0,
     82 		EXTENSION_WAIT_SYNC			= (0x1 << 0),
     83 		EXTENSION_FENCE_SYNC		= (0x1 << 1),
     84 		EXTENSION_REUSABLE_SYNC		= (0x1 << 2)
     85 	};
     86 									SyncTest	(EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, const char* name, const char* description);
     87 									~SyncTest	(void);
     88 
     89 	void							init		(void);
     90 	void							deinit		(void);
     91 
     92 protected:
     93 	const EGLenum					m_syncType;
     94 	const Extension					m_extensions;
     95 
     96 	EGLDisplay						m_eglDisplay;
     97 	EGLConfig						m_eglConfig;
     98 	EGLSurface						m_eglSurface;
     99 	eglu::NativeWindow*				m_nativeWindow;
    100 	EGLContext						m_eglContext;
    101 	EGLSyncKHR						m_sync;
    102 
    103 	struct
    104 	{
    105 		PFNEGLCREATESYNCKHRPROC		createSync;
    106 		PFNEGLDESTROYSYNCKHRPROC	destroySync;
    107 		PFNEGLCLIENTWAITSYNCKHRPROC	clientWaitSync;
    108 		PFNEGLGETSYNCATTRIBKHRPROC	getSyncAttrib;
    109 
    110 		PFNEGLWAITSYNCKHRPROC		waitSync;
    111 		PFNEGLSIGNALSYNCKHRPROC		signalSync;
    112 	} m_ext;
    113 };
    114 
    115 SyncTest::SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, const char* name, const char* description)
    116 	: TestCase			(eglTestCtx, name, description)
    117 	, m_syncType		(syncType)
    118 	, m_extensions		(extensions)
    119 	, m_eglDisplay		(EGL_NO_DISPLAY)
    120 	, m_eglSurface		(EGL_NO_SURFACE)
    121 	, m_nativeWindow	(DE_NULL)
    122 	, m_eglContext		(EGL_NO_CONTEXT)
    123 	, m_sync			(EGL_NO_SYNC_KHR)
    124 {
    125 	m_ext.createSync		= DE_NULL;
    126 	m_ext.destroySync		= DE_NULL;
    127 	m_ext.clientWaitSync	= DE_NULL;
    128 	m_ext.getSyncAttrib		= DE_NULL;
    129 	m_ext.waitSync			= DE_NULL;
    130 }
    131 
    132 SyncTest::~SyncTest (void)
    133 {
    134 	SyncTest::deinit();
    135 }
    136 
    137 void requiredEGLExtensions (EGLDisplay display, SyncTest::Extension requiredExtensions)
    138 {
    139 	SyncTest::Extension foundExtensions = SyncTest::EXTENSION_NONE;
    140 	std::istringstream	extensionStream(eglQueryString(display, EGL_EXTENSIONS));
    141 	string				extension;
    142 
    143 	TCU_CHECK_EGL_MSG("eglQueryString(display, EGL_EXTENSIONS)");
    144 
    145 	while (std::getline(extensionStream, extension, ' '))
    146 	{
    147 		if (extension == "EGL_KHR_fence_sync")
    148 			foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_FENCE_SYNC);
    149 		else if (extension == "EGL_KHR_reusable_sync")
    150 			foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_REUSABLE_SYNC);
    151 		else if (extension == "EGL_KHR_wait_sync")
    152 			foundExtensions = (SyncTest::Extension)(foundExtensions | SyncTest::EXTENSION_WAIT_SYNC);
    153 	}
    154 
    155 	{
    156 		const SyncTest::Extension missingExtensions = (SyncTest::Extension)((foundExtensions & requiredExtensions) ^ requiredExtensions);
    157 
    158 		if ((missingExtensions & SyncTest::EXTENSION_FENCE_SYNC) != 0)
    159 			throw tcu::NotSupportedError("EGL_KHR_fence_sync not supported", "", __FILE__, __LINE__);
    160 
    161 		if ((missingExtensions & SyncTest::EXTENSION_REUSABLE_SYNC) != 0)
    162 			throw tcu::NotSupportedError("EGL_KHR_reusable_sync not supported", "", __FILE__, __LINE__);
    163 
    164 		if ((missingExtensions & SyncTest::EXTENSION_WAIT_SYNC) != 0)
    165 			throw tcu::NotSupportedError("EGL_KHR_wait_sync not supported", "", __FILE__, __LINE__);
    166 	}
    167 }
    168 
    169 void requiredGLESExtensions (void)
    170 {
    171 	bool				found = false;
    172 	std::istringstream	extensionStream((const char*)glGetString(GL_EXTENSIONS));
    173 	string				extension;
    174 
    175 	GLU_CHECK_MSG("glGetString(GL_EXTENSIONS)");
    176 
    177 	while (std::getline(extensionStream, extension, ' '))
    178 	{
    179 		if (extension == "GL_OES_EGL_sync")
    180 			found = true;
    181 	}
    182 
    183 	if (!found)
    184 		throw tcu::NotSupportedError("GL_OES_EGL_sync not supported", "", __FILE__, __LINE__);
    185 }
    186 
    187 SyncTest::Extension getSyncTypeExtension (EGLenum syncType)
    188 {
    189 	switch (syncType)
    190 	{
    191 		case EGL_SYNC_FENCE_KHR:	return SyncTest::EXTENSION_FENCE_SYNC;
    192 		case EGL_SYNC_REUSABLE_KHR:	return SyncTest::EXTENSION_REUSABLE_SYNC;
    193 		default:
    194 			DE_ASSERT(DE_FALSE);
    195 			return SyncTest::EXTENSION_NONE;
    196 	}
    197 }
    198 
    199 void SyncTest::init (void)
    200 {
    201 	const EGLint displayAttribList[] =
    202 	{
    203 		EGL_RENDERABLE_TYPE,	EGL_OPENGL_ES2_BIT,
    204 		EGL_SURFACE_TYPE,		EGL_WINDOW_BIT,
    205 		EGL_ALPHA_SIZE,			1,
    206 		EGL_NONE
    207 	};
    208 
    209 	const EGLint contextAttribList[] =
    210 	{
    211 		EGL_CONTEXT_CLIENT_VERSION, 2,
    212 		EGL_NONE
    213 	};
    214 
    215 	tcu::egl::Display&	display = m_eglTestCtx.getDisplay();
    216 	vector<EGLConfig>	configs;
    217 
    218 	display.chooseConfig(displayAttribList, configs);
    219 	m_eglDisplay	= display.getEGLDisplay();
    220 	m_eglConfig 	= configs[0];
    221 
    222 	{
    223 		const Extension syncTypeExtension = getSyncTypeExtension(m_syncType);
    224 		requiredEGLExtensions(m_eglDisplay, (Extension)(m_extensions | syncTypeExtension));
    225 	}
    226 
    227 	m_ext.createSync		= (PFNEGLCREATESYNCKHRPROC)eglGetProcAddress("eglCreateSyncKHR");
    228 	m_ext.destroySync		= (PFNEGLDESTROYSYNCKHRPROC)eglGetProcAddress("eglDestroySyncKHR");
    229 	m_ext.clientWaitSync	= (PFNEGLCLIENTWAITSYNCKHRPROC)eglGetProcAddress("eglClientWaitSyncKHR");
    230 	m_ext.getSyncAttrib		= (PFNEGLGETSYNCATTRIBKHRPROC)eglGetProcAddress("eglGetSyncAttribKHR");
    231 	m_ext.waitSync			= (PFNEGLWAITSYNCKHRPROC)eglGetProcAddress("eglWaitSyncKHR");
    232 	m_ext.signalSync		= (PFNEGLSIGNALSYNCKHRPROC)eglGetProcAddress("eglSignalSyncKHR");
    233 
    234 	// Create context
    235 	TCU_CHECK_EGL_CALL(eglBindAPI(EGL_OPENGL_ES_API));
    236 	m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttribList);
    237 	TCU_CHECK_EGL_MSG("Failed to create GLES2 context");
    238 
    239 	// Create surface
    240 	m_nativeWindow = m_eglTestCtx.createNativeWindow(m_eglDisplay, m_eglConfig, DE_NULL, 480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine()));
    241 	m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_nativeWindow, m_eglDisplay, m_eglConfig, DE_NULL);
    242 
    243 	TCU_CHECK_EGL_CALL(eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext));
    244 
    245 	requiredGLESExtensions();
    246 }
    247 
    248 void SyncTest::deinit (void)
    249 {
    250 	if (m_eglDisplay != EGL_NO_DISPLAY)
    251 	{
    252 		if (m_sync != EGL_NO_SYNC_KHR)
    253 		{
    254 			TCU_CHECK_EGL_CALL(m_ext.destroySync(m_eglDisplay, m_sync));
    255 			m_sync = EGL_NO_SYNC_KHR;
    256 		}
    257 
    258 		TCU_CHECK_EGL_CALL(eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
    259 
    260 		if (m_eglContext != EGL_NO_CONTEXT)
    261 		{
    262 			TCU_CHECK_EGL_CALL(eglDestroyContext(m_eglDisplay, m_eglContext));
    263 			m_eglContext = EGL_NO_CONTEXT;
    264 		}
    265 
    266 		if (m_eglSurface != EGL_NO_SURFACE)
    267 		{
    268 			TCU_CHECK_EGL_CALL(eglDestroySurface(m_eglDisplay, m_eglSurface));
    269 			m_eglSurface = EGL_NO_SURFACE;
    270 		}
    271 
    272 		delete m_nativeWindow;
    273 		m_nativeWindow = DE_NULL;
    274 
    275 		m_eglDisplay = EGL_NO_DISPLAY;
    276 	}
    277 }
    278 
    279 class CreateNullAttribsTest : public SyncTest
    280 {
    281 public:
    282 					CreateNullAttribsTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_null_attribs", "create_null_attribs") {}
    283 
    284 	IterateResult	iterate					(void)
    285 	{
    286 		TestLog& log = m_testCtx.getLog();
    287 		TCU_CHECK(m_ext.createSync);
    288 
    289 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    290 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    291 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    292 
    293 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    294 		return STOP;
    295 	}
    296 };
    297 
    298 class CreateEmptyAttribsTest : public SyncTest
    299 {
    300 public:
    301 					CreateEmptyAttribsTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_empty_attribs", "create_empty_attribs") {}
    302 
    303 	IterateResult	iterate					(void)
    304 	{
    305 
    306 		const EGLint attribList[] = {
    307 			EGL_NONE
    308 		};
    309 		TestLog& log = m_testCtx.getLog();
    310 		TCU_CHECK(m_ext.createSync);
    311 
    312 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, attribList);
    313 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", { EGL_NONE })" << TestLog::EndMessage;
    314 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    315 
    316 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    317 		return STOP;
    318 	}
    319 };
    320 
    321 class CreateInvalidDisplayTest : public SyncTest
    322 {
    323 public:
    324 					CreateInvalidDisplayTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_display", "create_invalid_display") {}
    325 
    326 	IterateResult	iterate						(void)
    327 	{
    328 		TestLog& log = m_testCtx.getLog();
    329 		TCU_CHECK(m_ext.createSync);
    330 
    331 		m_sync = m_ext.createSync(EGL_NO_DISPLAY, m_syncType, NULL);
    332 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(EGL_NO_DISPLAY, " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    333 
    334 		EGLint error = eglGetError();
    335 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    336 
    337 		if (error != EGL_BAD_DISPLAY)
    338 		{
    339 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
    340 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    341 			return STOP;
    342 		}
    343 
    344 		TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
    345 
    346 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    347 		return STOP;
    348 	}
    349 };
    350 
    351 class CreateInvalidTypeTest : public SyncTest
    352 {
    353 public:
    354 					CreateInvalidTypeTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_type", "create_invalid_type") {}
    355 
    356 	IterateResult	iterate					(void)
    357 	{
    358 		TestLog& log = m_testCtx.getLog();
    359 		TCU_CHECK(m_ext.createSync);
    360 
    361 		m_sync = m_ext.createSync(m_eglDisplay, EGL_NONE, NULL);
    362 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", EGL_NONE, NULL)" << TestLog::EndMessage;
    363 
    364 		EGLint error = eglGetError();
    365 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    366 
    367 		if (error != EGL_BAD_ATTRIBUTE)
    368 		{
    369 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
    370 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    371 			return STOP;
    372 		}
    373 
    374 		TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
    375 
    376 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    377 		return STOP;
    378 	}
    379 };
    380 
    381 class CreateInvalidAttribsTest : public SyncTest
    382 {
    383 public:
    384 					CreateInvalidAttribsTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_attribs", "create_invalid_attribs") {}
    385 
    386 	IterateResult	iterate						(void)
    387 	{
    388 		TestLog& log = m_testCtx.getLog();
    389 		TCU_CHECK(m_ext.createSync);
    390 
    391 		EGLint attribs[] = {
    392 			2, 3, 4, 5,
    393 			EGL_NONE
    394 		};
    395 
    396 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, attribs);
    397 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", { 2, 3, 4, 5, EGL_NONE })" << TestLog::EndMessage;
    398 
    399 		EGLint error = eglGetError();
    400 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    401 
    402 		if (error != EGL_BAD_ATTRIBUTE)
    403 		{
    404 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
    405 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    406 			return STOP;
    407 		}
    408 
    409 		TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
    410 
    411 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    412 		return STOP;
    413 	}
    414 };
    415 
    416 class CreateInvalidContextTest : public SyncTest
    417 {
    418 public:
    419 					CreateInvalidContextTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "create_invalid_context", "create_invalid_context") {}
    420 
    421 	IterateResult	iterate						(void)
    422 	{
    423 		TestLog& log = m_testCtx.getLog();
    424 		TCU_CHECK(m_ext.createSync);
    425 
    426 		log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
    427 		TCU_CHECK_EGL_CALL(eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
    428 
    429 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    430 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    431 
    432 		EGLint error = eglGetError();
    433 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    434 
    435 		if (error != EGL_BAD_MATCH)
    436 		{
    437 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_MATCH" << TestLog::EndMessage;
    438 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    439 			return STOP;
    440 		}
    441 
    442 		TCU_CHECK(m_sync == EGL_NO_SYNC_KHR);
    443 
    444 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    445 		return STOP;
    446 	}
    447 };
    448 
    449 class ClientWaitNoTimeoutTest : public SyncTest
    450 {
    451 public:
    452 					ClientWaitNoTimeoutTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_no_timeout", "wait_no_timeout") {}
    453 
    454 	IterateResult	iterate					(void)
    455 	{
    456 		TestLog& log = m_testCtx.getLog();
    457 		TCU_CHECK(m_ext.createSync);
    458 		TCU_CHECK(m_ext.clientWaitSync);
    459 
    460 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    461 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    462 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    463 
    464 		EGLint status = m_ext.clientWaitSync(m_eglDisplay, m_sync, 0, 0);
    465 		log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
    466 
    467 		if (m_syncType == EGL_SYNC_FENCE_KHR)
    468 			TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR || status == EGL_TIMEOUT_EXPIRED_KHR);
    469 		else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
    470 			TCU_CHECK(status == EGL_TIMEOUT_EXPIRED_KHR);
    471 		else
    472 			DE_ASSERT(DE_FALSE);
    473 
    474 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    475 		return STOP;
    476 	}
    477 
    478 };
    479 
    480 class ClientWaitForeverTest : public SyncTest
    481 {
    482 public:
    483 					ClientWaitForeverTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_forever", "wait_forever") {}
    484 
    485 	IterateResult	iterate					(void)
    486 	{
    487 		TestLog& log = m_testCtx.getLog();
    488 		TCU_CHECK(m_ext.createSync);
    489 		TCU_CHECK(m_ext.clientWaitSync);
    490 
    491 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    492 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    493 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    494 
    495 		if (m_syncType == EGL_SYNC_REUSABLE_KHR)
    496 		{
    497 			EGLBoolean ret = m_ext.signalSync(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
    498 			log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
    499 			TCU_CHECK_EGL_MSG("eglSignalSyncKHR()");
    500 		}
    501 		else if (m_syncType == EGL_SYNC_FENCE_KHR)
    502 		{
    503 			GLU_CHECK_CALL(glFlush());
    504 			log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
    505 		}
    506 		else
    507 			DE_ASSERT(DE_FALSE);
    508 
    509 		EGLint status = m_ext.clientWaitSync(m_eglDisplay, m_sync, 0, EGL_FOREVER_KHR);
    510 		log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
    511 
    512 		TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
    513 		TCU_CHECK_EGL_MSG("eglClientWaitSyncKHR()");
    514 
    515 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    516 		return STOP;
    517 	}
    518 };
    519 
    520 class ClientWaitNoContextTest : public SyncTest
    521 {
    522 public:
    523 					ClientWaitNoContextTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_no_context", "wait_no_Context") {}
    524 
    525 	IterateResult	iterate					(void)
    526 	{
    527 		TestLog& log = m_testCtx.getLog();
    528 		TCU_CHECK(m_ext.createSync);
    529 		TCU_CHECK(m_ext.clientWaitSync);
    530 
    531 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    532 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    533 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    534 
    535 
    536 		if (m_syncType == EGL_SYNC_REUSABLE_KHR)
    537 		{
    538 			EGLBoolean ret = m_ext.signalSync(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
    539 			log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
    540 			TCU_CHECK_EGL_MSG("eglSignalSyncKHR()");
    541 		}
    542 		else if (m_syncType == EGL_SYNC_FENCE_KHR)
    543 		{
    544 			GLU_CHECK_CALL(glFlush());
    545 			log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
    546 		}
    547 		else
    548 			DE_ASSERT(DE_FALSE);
    549 
    550 		log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay << ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
    551 		TCU_CHECK_EGL_CALL(eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
    552 
    553 		EGLint result = m_ext.clientWaitSync(m_eglDisplay, m_sync, 0, EGL_FOREVER_KHR);
    554 		log << TestLog::Message << result << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
    555 
    556 		TCU_CHECK(result == EGL_CONDITION_SATISFIED_KHR);
    557 
    558 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    559 		return STOP;
    560 	}
    561 };
    562 
    563 class ClientWaitForeverFlushTest : public SyncTest
    564 {
    565 public:
    566 					ClientWaitForeverFlushTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_forever_flush", "wait_forever_flush") {}
    567 
    568 	IterateResult	iterate						(void)
    569 	{
    570 		TestLog& log = m_testCtx.getLog();
    571 		TCU_CHECK(m_ext.createSync);
    572 		TCU_CHECK(m_ext.clientWaitSync);
    573 
    574 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    575 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    576 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    577 
    578 		if (m_syncType == EGL_SYNC_REUSABLE_KHR)
    579 		{
    580 			EGLBoolean ret = m_ext.signalSync(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
    581 			log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
    582 			TCU_CHECK_EGL_MSG("eglSignalSyncKHR()");
    583 		}
    584 
    585 		EGLint status = m_ext.clientWaitSync(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
    586 		log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
    587 
    588 		TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
    589 
    590 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    591 		return STOP;
    592 	}
    593 };
    594 
    595 class ClientWaitInvalidDisplayTest : public SyncTest
    596 {
    597 public:
    598 					ClientWaitInvalidDisplayTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_invalid_display", "wait_invalid_display") {}
    599 
    600 	IterateResult	iterate							(void)
    601 	{
    602 		TestLog& log = m_testCtx.getLog();
    603 		TCU_CHECK(m_ext.createSync);
    604 		TCU_CHECK(m_ext.clientWaitSync);
    605 
    606 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    607 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    608 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    609 
    610 		EGLint status = m_ext.clientWaitSync(EGL_NO_DISPLAY, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
    611 		log << TestLog::Message << status << " = eglClientWaitSyncKHR(EGL_NO_DISPLAY, " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
    612 
    613 		EGLint error = eglGetError();
    614 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    615 
    616 		if (error != EGL_BAD_DISPLAY)
    617 		{
    618 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
    619 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    620 			return STOP;
    621 		}
    622 
    623 		TCU_CHECK(status == EGL_FALSE);
    624 
    625 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    626 		return STOP;
    627 	}
    628 };
    629 
    630 class ClientWaitInvalidSyncTest : public SyncTest
    631 {
    632 public:
    633 					ClientWaitInvalidSyncTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_invalid_sync", "wait_invalid_sync") {}
    634 
    635 	IterateResult	iterate						(void)
    636 	{
    637 		TestLog& log = m_testCtx.getLog();
    638 		TCU_CHECK(m_ext.clientWaitSync);
    639 
    640 		EGLint status = m_ext.clientWaitSync(m_eglDisplay, EGL_NO_SYNC_KHR, 0, EGL_FOREVER_KHR);
    641 		log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, 0, EGL_FOREVER_KHR)" << TestLog::EndMessage;
    642 
    643 		EGLint error = eglGetError();
    644 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    645 
    646 		if (error != EGL_BAD_PARAMETER)
    647 		{
    648 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
    649 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    650 			return STOP;
    651 		}
    652 
    653 		TCU_CHECK(status == EGL_FALSE);
    654 
    655 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    656 		return STOP;
    657 	}
    658 };
    659 
    660 class ClientWaitInvalidFlagTest : public SyncTest
    661 {
    662 public:
    663 					ClientWaitInvalidFlagTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "wait_invalid_flag", "wait_invalid_flag") {}
    664 
    665 	IterateResult	iterate						(void)
    666 	{
    667 		TestLog& log = m_testCtx.getLog();
    668 		TCU_CHECK(m_ext.createSync);
    669 		TCU_CHECK(m_ext.clientWaitSync);
    670 
    671 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    672 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    673 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    674 
    675 		EGLint status = m_ext.clientWaitSync(m_eglDisplay, m_sync, 0xFFFFFFFF, EGL_FOREVER_KHR);
    676 		log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0xFFFFFFFF, EGL_FOREVER_KHR)" << TestLog::EndMessage;
    677 
    678 		EGLint error = eglGetError();
    679 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    680 
    681 		if (error != EGL_BAD_PARAMETER)
    682 		{
    683 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
    684 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    685 			return STOP;
    686 		}
    687 
    688 		TCU_CHECK(status == EGL_FALSE);
    689 
    690 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    691 		return STOP;
    692 	}
    693 };
    694 
    695 class GetSyncTypeTest : public SyncTest
    696 {
    697 public:
    698 					GetSyncTypeTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_type", "get_type") {}
    699 
    700 	IterateResult	iterate			(void)
    701 	{
    702 		TestLog& log = m_testCtx.getLog();
    703 		TCU_CHECK(m_ext.createSync);
    704 		TCU_CHECK(m_ext.getSyncAttrib);
    705 
    706 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    707 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    708 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    709 
    710 		EGLint type = 0;
    711 		TCU_CHECK_EGL_CALL(m_ext.getSyncAttrib(m_eglDisplay, m_sync, EGL_SYNC_TYPE_KHR, &type));
    712 		log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_TYPE_KHR, {" << type << "})" << TestLog::EndMessage;
    713 
    714 		TCU_CHECK(type == ((EGLint)m_syncType));
    715 
    716 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    717 		return STOP;
    718 	}
    719 };
    720 
    721 class GetSyncStatusTest : public SyncTest
    722 {
    723 public:
    724 					GetSyncStatusTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_status", "get_status") {}
    725 
    726 	IterateResult	iterate				(void)
    727 	{
    728 		TestLog& log = m_testCtx.getLog();
    729 		TCU_CHECK(m_ext.createSync);
    730 		TCU_CHECK(m_ext.getSyncAttrib);
    731 
    732 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    733 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    734 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    735 
    736 		EGLint status = 0;
    737 		TCU_CHECK_EGL_CALL(m_ext.getSyncAttrib(m_eglDisplay, m_sync, EGL_SYNC_STATUS_KHR, &status));
    738 		log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_STATUS_KHR, {" << status << "})" << TestLog::EndMessage;
    739 
    740 		if (m_syncType == EGL_SYNC_FENCE_KHR)
    741 			TCU_CHECK(status == EGL_SIGNALED_KHR || status == EGL_UNSIGNALED_KHR);
    742 		else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
    743 			TCU_CHECK(status == EGL_UNSIGNALED_KHR);
    744 
    745 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    746 		return STOP;
    747 	}
    748 };
    749 
    750 class GetSyncStatusSignaledTest : public SyncTest
    751 {
    752 public:
    753 					GetSyncStatusSignaledTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_status_signaled", "get_status_signaled") {}
    754 
    755 	IterateResult	iterate						(void)
    756 	{
    757 		TestLog& log = m_testCtx.getLog();
    758 		TCU_CHECK(m_ext.createSync);
    759 		TCU_CHECK(m_ext.clientWaitSync);
    760 		TCU_CHECK(m_ext.getSyncAttrib);
    761 
    762 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    763 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    764 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    765 
    766 		if (m_syncType == EGL_SYNC_REUSABLE_KHR)
    767 		{
    768 			EGLBoolean ret = m_ext.signalSync(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
    769 			log << TestLog::Message << ret << " = eglSignalSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" << TestLog::EndMessage;
    770 			TCU_CHECK_EGL_MSG("eglSignalSyncKHR()");
    771 		}
    772 		else if (m_syncType == EGL_SYNC_FENCE_KHR)
    773 		{
    774 			GLU_CHECK_CALL(glFinish());
    775 			log << TestLog::Message << "glFinish()" << TestLog::EndMessage;
    776 		}
    777 		else
    778 			DE_ASSERT(DE_FALSE);
    779 
    780 		{
    781 			EGLint status = m_ext.clientWaitSync(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR);
    782 			log << TestLog::Message << status << " = eglClientWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR)" << TestLog::EndMessage;
    783 			TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR);
    784 		}
    785 
    786 		EGLint status = 0;
    787 		TCU_CHECK_EGL_CALL(m_ext.getSyncAttrib(m_eglDisplay, m_sync, EGL_SYNC_STATUS_KHR, &status));
    788 		log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_STATUS_KHR, {" << status << "})" << TestLog::EndMessage;
    789 
    790 		TCU_CHECK(status == EGL_SIGNALED_KHR);
    791 
    792 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    793 		return STOP;
    794 	}
    795 };
    796 
    797 class GetSyncConditionTest : public SyncTest
    798 {
    799 public:
    800 					GetSyncConditionTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_condition", "get_condition") {}
    801 
    802 	IterateResult	iterate					(void)
    803 	{
    804 		TestLog& log = m_testCtx.getLog();
    805 		TCU_CHECK(m_ext.createSync);
    806 		TCU_CHECK(m_ext.getSyncAttrib);
    807 
    808 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    809 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    810 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    811 
    812 		EGLint condition = 0;
    813 		TCU_CHECK_EGL_CALL(m_ext.getSyncAttrib(m_eglDisplay, m_sync, EGL_SYNC_CONDITION_KHR, &condition));
    814 		log << TestLog::Message << "eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
    815 
    816 		TCU_CHECK(condition == EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR);
    817 
    818 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    819 		return STOP;
    820 	}
    821 };
    822 
    823 class GetSyncInvalidDisplayTest : public SyncTest
    824 {
    825 public:
    826 					GetSyncInvalidDisplayTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_display", "get_invalid_display") {}
    827 
    828 	IterateResult	iterate						(void)
    829 	{
    830 		TestLog& log = m_testCtx.getLog();
    831 		TCU_CHECK(m_ext.createSync);
    832 		TCU_CHECK(m_ext.getSyncAttrib);
    833 
    834 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    835 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    836 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    837 
    838 		EGLint condition = 0xF0F0F;
    839 		EGLBoolean result = m_ext.getSyncAttrib(EGL_NO_DISPLAY, m_sync, EGL_SYNC_CONDITION_KHR, &condition);
    840 		log << TestLog::Message << result << " = eglGetSyncAttribKHR(EGL_NO_DISPLAY, " << m_sync << ", EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
    841 
    842 		EGLint error = eglGetError();
    843 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    844 
    845 		if (error != EGL_BAD_DISPLAY)
    846 		{
    847 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
    848 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    849 			return STOP;
    850 		}
    851 
    852 		TCU_CHECK(result == EGL_FALSE);
    853 		TCU_CHECK(condition == 0xF0F0F);
    854 
    855 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    856 		return STOP;
    857 	}
    858 };
    859 
    860 class GetSyncInvalidSyncTest : public SyncTest
    861 {
    862 public:
    863 					GetSyncInvalidSyncTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_sync", "get_invalid_sync") {}
    864 
    865 	IterateResult	iterate					(void)
    866 	{
    867 		TestLog& log = m_testCtx.getLog();
    868 		TCU_CHECK(m_ext.getSyncAttrib);
    869 
    870 		EGLint condition = 0xF0F0F;
    871 		EGLBoolean result = m_ext.getSyncAttrib(m_eglDisplay, EGL_NO_SYNC_KHR, EGL_SYNC_CONDITION_KHR, &condition);
    872 		log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, EGL_SYNC_CONDITION_KHR, {" << condition << "})" << TestLog::EndMessage;
    873 
    874 		EGLint error = eglGetError();
    875 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    876 
    877 		if (error != EGL_BAD_PARAMETER)
    878 		{
    879 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
    880 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    881 			return STOP;
    882 		}
    883 
    884 		TCU_CHECK(result == EGL_FALSE);
    885 		TCU_CHECK(condition == 0xF0F0F);
    886 
    887 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    888 		return STOP;
    889 	}
    890 };
    891 
    892 class GetSyncInvalidAttributeTest : public SyncTest
    893 {
    894 public:
    895 					GetSyncInvalidAttributeTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_attribute", "get_invalid_attribute") {}
    896 
    897 	IterateResult	iterate						(void)
    898 	{
    899 		TestLog& log = m_testCtx.getLog();
    900 		TCU_CHECK(m_ext.createSync);
    901 		TCU_CHECK(m_ext.getSyncAttrib);
    902 
    903 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    904 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    905 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    906 
    907 		EGLint condition = 0xF0F0F;
    908 		EGLBoolean result = m_ext.getSyncAttrib(m_eglDisplay, m_sync, EGL_NONE, &condition);
    909 		log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_NONE, {" << condition << "})" << TestLog::EndMessage;
    910 
    911 		EGLint error = eglGetError();
    912 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    913 
    914 		if (error != EGL_BAD_ATTRIBUTE)
    915 		{
    916 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
    917 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    918 			return STOP;
    919 		}
    920 
    921 		TCU_CHECK(result == EGL_FALSE);
    922 		TCU_CHECK(condition == 0xF0F0F);
    923 
    924 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    925 		return STOP;
    926 	}
    927 };
    928 
    929 class GetSyncInvalidValueTest : public SyncTest
    930 {
    931 public:
    932 					GetSyncInvalidValueTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "get_invalid_value", "get_invalid_value") {}
    933 
    934 	IterateResult	iterate					(void)
    935 	{
    936 		TestLog& log = m_testCtx.getLog();
    937 		TCU_CHECK(m_ext.createSync);
    938 		TCU_CHECK(m_ext.getSyncAttrib);
    939 
    940 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    941 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    942 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    943 
    944 		EGLBoolean result = m_ext.getSyncAttrib(m_eglDisplay, m_sync, EGL_SYNC_TYPE_KHR, NULL);
    945 		log << TestLog::Message << result << " = eglGetSyncAttribKHR(" << m_eglDisplay << ", " << m_sync << ", EGL_SYNC_CONDITION_KHR, NULL)" << TestLog::EndMessage;
    946 
    947 		EGLint error = eglGetError();
    948 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
    949 
    950 		if (error != EGL_BAD_PARAMETER)
    951 		{
    952 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
    953 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
    954 			return STOP;
    955 		}
    956 
    957 		TCU_CHECK(result == EGL_FALSE);
    958 
    959 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    960 		return STOP;
    961 	}
    962 };
    963 
    964 class DestroySyncTest : public SyncTest
    965 {
    966 public:
    967 					DestroySyncTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "destroy", "destroy") {}
    968 
    969 	IterateResult	iterate			(void)
    970 	{
    971 		TestLog& log = m_testCtx.getLog();
    972 		TCU_CHECK(m_ext.createSync);
    973 		TCU_CHECK(m_ext.destroySync);
    974 
    975 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
    976 		log << TestLog::Message << "eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
    977 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
    978 
    979 		log << TestLog::Message << "eglDestroySyncKHR(" << m_eglDisplay << ", " << m_sync << ")" << TestLog::EndMessage;
    980 		TCU_CHECK_EGL_CALL(m_ext.destroySync(m_eglDisplay, m_sync));
    981 		m_sync = EGL_NO_SYNC_KHR;
    982 
    983 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
    984 		return STOP;
    985 	}
    986 };
    987 
    988 class DestroySyncInvalidDislayTest : public SyncTest
    989 {
    990 public:
    991 					DestroySyncInvalidDislayTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "destroy_invalid_display", "destroy_invalid_display") {}
    992 
    993 	IterateResult	iterate							(void)
    994 	{
    995 		TestLog& log = m_testCtx.getLog();
    996 		TCU_CHECK(m_ext.createSync);
    997 		TCU_CHECK(m_ext.destroySync);
    998 
    999 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
   1000 		log << TestLog::Message << "eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
   1001 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
   1002 
   1003 		EGLBoolean result = m_ext.destroySync(EGL_NO_DISPLAY, m_sync);
   1004 		log << TestLog::Message << result << " = eglDestroySyncKHR(EGL_NO_DISPLAY, " << m_sync << ")" << TestLog::EndMessage;
   1005 
   1006 		EGLint error = eglGetError();
   1007 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
   1008 
   1009 		if (error != EGL_BAD_DISPLAY)
   1010 		{
   1011 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
   1012 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
   1013 			return STOP;
   1014 		}
   1015 
   1016 		TCU_CHECK(result == EGL_FALSE);
   1017 
   1018 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
   1019 		return STOP;
   1020 	}
   1021 };
   1022 
   1023 class DestroySyncInvalidSyncTest : public SyncTest
   1024 {
   1025 public:
   1026 					DestroySyncInvalidSyncTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, "destroy_invalid_sync", "destroy_invalid_sync") {}
   1027 
   1028 	IterateResult	iterate						(void)
   1029 	{
   1030 		TestLog& log = m_testCtx.getLog();
   1031 		TCU_CHECK(m_ext.destroySync);
   1032 
   1033 		EGLBoolean result = m_ext.destroySync(m_eglDisplay, EGL_NO_SYNC_KHR);
   1034 		log << TestLog::Message << result << " = eglDestroySyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR)" << TestLog::EndMessage;
   1035 
   1036 		EGLint error = eglGetError();
   1037 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
   1038 
   1039 		if (error != EGL_BAD_PARAMETER)
   1040 		{
   1041 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
   1042 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
   1043 			return STOP;
   1044 		}
   1045 
   1046 		TCU_CHECK(result == EGL_FALSE);
   1047 
   1048 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
   1049 		return STOP;
   1050 	}
   1051 };
   1052 
   1053 class WaitSyncTest : public SyncTest
   1054 {
   1055 public:
   1056 					WaitSyncTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server", "wait_server") {}
   1057 
   1058 	IterateResult	iterate			(void)
   1059 	{
   1060 		TestLog& log = m_testCtx.getLog();
   1061 		TCU_CHECK(m_ext.createSync);
   1062 		TCU_CHECK(m_ext.waitSync);
   1063 
   1064 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
   1065 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
   1066 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
   1067 
   1068 		EGLint status = m_ext.waitSync(m_eglDisplay, m_sync, 0);
   1069 		log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
   1070 
   1071 		TCU_CHECK(status == EGL_TRUE);
   1072 
   1073 		GLU_CHECK_CALL(glFinish());
   1074 
   1075 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
   1076 		return STOP;
   1077 	}
   1078 
   1079 };
   1080 
   1081 class WaitSyncInvalidDisplayTest : public SyncTest
   1082 {
   1083 public:
   1084 					WaitSyncInvalidDisplayTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server_invalid_display", "wait_server_invalid_display") {}
   1085 
   1086 	IterateResult	iterate						(void)
   1087 	{
   1088 		TestLog& log = m_testCtx.getLog();
   1089 		TCU_CHECK(m_ext.createSync);
   1090 		TCU_CHECK(m_ext.waitSync);
   1091 
   1092 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
   1093 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
   1094 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
   1095 
   1096 		EGLint status = m_ext.waitSync(EGL_NO_DISPLAY, m_sync, 0);
   1097 		log << TestLog::Message << status << " = eglWaitSyncKHR(EGL_NO_DISPLAY, " << m_sync << ", 0)" << TestLog::EndMessage;
   1098 
   1099 		EGLint error = eglGetError();
   1100 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
   1101 
   1102 		if (error != EGL_BAD_DISPLAY)
   1103 		{
   1104 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
   1105 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
   1106 			return STOP;
   1107 		}
   1108 
   1109 		TCU_CHECK(status == EGL_FALSE);
   1110 
   1111 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
   1112 		return STOP;
   1113 	}
   1114 };
   1115 
   1116 class WaitSyncInvalidSyncTest : public SyncTest
   1117 {
   1118 public:
   1119 					WaitSyncInvalidSyncTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server_invalid_sync", "wait_server_invalid_sync") {}
   1120 
   1121 	IterateResult	iterate					(void)
   1122 	{
   1123 		TestLog& log = m_testCtx.getLog();
   1124 		TCU_CHECK(m_ext.waitSync);
   1125 
   1126 		EGLint status = m_ext.waitSync(m_eglDisplay, EGL_NO_SYNC_KHR, 0);
   1127 		log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", EGL_NO_SYNC_KHR, 0)" << TestLog::EndMessage;
   1128 
   1129 		EGLint error = eglGetError();
   1130 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
   1131 
   1132 		if (error != EGL_BAD_PARAMETER)
   1133 		{
   1134 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
   1135 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
   1136 			return STOP;
   1137 		}
   1138 
   1139 		TCU_CHECK(status == EGL_FALSE);
   1140 
   1141 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
   1142 		return STOP;
   1143 	}
   1144 };
   1145 
   1146 class WaitSyncInvalidFlagTest : public SyncTest
   1147 {
   1148 public:
   1149 					WaitSyncInvalidFlagTest	(EglTestContext& eglTestCtx, EGLenum syncType) : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, "wait_server_invalid_flag", "wait_server_invalid_flag") {}
   1150 
   1151 	IterateResult	iterate					(void)
   1152 	{
   1153 		TestLog& log = m_testCtx.getLog();
   1154 		TCU_CHECK(m_ext.createSync);
   1155 		TCU_CHECK(m_ext.waitSync);
   1156 
   1157 		m_sync = m_ext.createSync(m_eglDisplay, m_syncType, NULL);
   1158 		log << TestLog::Message << m_sync << " = eglCreateSyncKHR(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" << TestLog::EndMessage;
   1159 		TCU_CHECK_EGL_MSG("eglCreateSyncKHR()");
   1160 
   1161 		EGLint status = m_ext.waitSync(m_eglDisplay, m_sync, 0xFFFFFFFF);
   1162 		log << TestLog::Message << status << " = eglWaitSyncKHR(" << m_eglDisplay << ", " << m_sync << ", 0xFFFFFFFF)" << TestLog::EndMessage;
   1163 
   1164 		EGLint error = eglGetError();
   1165 		log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
   1166 
   1167 		if (error != EGL_BAD_PARAMETER)
   1168 		{
   1169 			log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) << "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
   1170 			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
   1171 			return STOP;
   1172 		}
   1173 
   1174 		TCU_CHECK(status == EGL_FALSE);
   1175 
   1176 		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
   1177 		return STOP;
   1178 	}
   1179 };
   1180 
   1181 } // anonymous
   1182 
   1183 FenceSyncTests::FenceSyncTests (EglTestContext& eglTestCtx)
   1184 	: TestCaseGroup	(eglTestCtx, "fence_sync", "EGL_KHR_fence_sync extension tests")
   1185 {
   1186 }
   1187 
   1188 void FenceSyncTests::init (void)
   1189 {
   1190 	// Add valid API test
   1191 	{
   1192 		TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
   1193 
   1194 		// eglCreateSyncKHR tests
   1195 		valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1196 		valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1197 
   1198 		// eglClientWaitSyncKHR tests
   1199 		valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1200 		valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1201 		valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1202 		valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1203 
   1204 		// eglGetSyncAttribKHR tests
   1205 		valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1206 		valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1207 		valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1208 		valid->addChild(new GetSyncConditionTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1209 
   1210 		// eglDestroySyncKHR tests
   1211 		valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1212 
   1213 		// eglWaitSyncKHR tests
   1214 		valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1215 
   1216 		addChild(valid);
   1217 	}
   1218 
   1219 	// Add negative API tests
   1220 	{
   1221 		TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
   1222 
   1223 		// eglCreateSyncKHR tests
   1224 		invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1225 		invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1226 		invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1227 		invalid->addChild(new CreateInvalidContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1228 
   1229 		// eglClientWaitSyncKHR tests
   1230 		invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1231 		invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1232 		invalid->addChild(new ClientWaitInvalidFlagTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1233 
   1234 		// eglGetSyncAttribKHR tests
   1235 		invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1236 		invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1237 		invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1238 		invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1239 
   1240 		// eglDestroySyncKHR tests
   1241 		invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1242 		invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1243 
   1244 		// eglWaitSyncKHR tests
   1245 		invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1246 		invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1247 		invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
   1248 
   1249 		addChild(invalid);
   1250 	}
   1251 }
   1252 
   1253 ReusableSyncTests::ReusableSyncTests (EglTestContext& eglTestCtx)
   1254 	: TestCaseGroup	(eglTestCtx, "reusable_sync", "EGL_KHR_reusable_sync extension tests")
   1255 {
   1256 }
   1257 
   1258 void ReusableSyncTests::init (void)
   1259 {
   1260 	// Add valid API test
   1261 	{
   1262 		TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
   1263 
   1264 		// eglCreateSyncKHR tests
   1265 		valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1266 		valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1267 
   1268 		// eglClientWaitSyncKHR tests
   1269 		valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1270 		valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1271 		valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1272 		valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1273 
   1274 		// eglGetSyncAttribKHR tests
   1275 		valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1276 		valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1277 		valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1278 
   1279 		// eglDestroySyncKHR tests
   1280 		valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1281 
   1282 		// eglWaitSyncKHR tests
   1283 		valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1284 
   1285 		addChild(valid);
   1286 	}
   1287 
   1288 	// Add negative API tests
   1289 	{
   1290 		TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
   1291 
   1292 		// eglCreateSyncKHR tests
   1293 		invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1294 		invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1295 		invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1296 		invalid->addChild(new CreateInvalidContextTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1297 
   1298 		// eglClientWaitSyncKHR tests
   1299 		invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1300 		invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1301 		invalid->addChild(new ClientWaitInvalidFlagTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1302 
   1303 		// eglGetSyncAttribKHR tests
   1304 		invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1305 		invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1306 		invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1307 		invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1308 
   1309 		// eglDestroySyncKHR tests
   1310 		invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1311 		invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1312 
   1313 		// eglWaitSyncKHR tests
   1314 		invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1315 		invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1316 		invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
   1317 
   1318 		addChild(invalid);
   1319 	}
   1320 }
   1321 
   1322 } // egl
   1323 } // deqp
   1324