13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program EGL Module
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ---------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief EGL Test Package
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglTestPackage.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuPlatform.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuCommandLine.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluPlatform.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeDisplay.hpp"
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeWindow.hpp"
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativePixmap.hpp"
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglInfoTests.hpp"
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglCreateContextTests.hpp"
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglQueryContextTests.hpp"
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglCreateSurfaceTests.hpp"
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglQuerySurfaceTests.hpp"
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglChooseConfigTests.hpp"
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglQueryConfigTests.hpp"
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglColorClearTests.hpp"
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglRenderTests.hpp"
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglImageTests.hpp"
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglGLES2SharingTests.hpp"
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglNegativeApiTests.hpp"
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglSyncTests.hpp"
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglMultiThreadTests.hpp"
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglGetProcAddressTests.hpp"
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglMemoryStressTests.hpp"
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglMakeCurrentPerfTests.hpp"
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglGLES2SharedRenderingPerfTests.hpp"
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglPreservingSwapTests.hpp"
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglClientExtensionTests.hpp"
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglCreateContextExtTests.hpp"
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglSurfacelessContextTests.hpp"
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglSwapBuffersTests.hpp"
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglNativeColorMappingTests.hpp"
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglNativeCoordMappingTests.hpp"
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglResizeTests.hpp"
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <typeinfo>
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector;
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace egl
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StressTests : public TestCaseGroup
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StressTests (EglTestContext& eglTestCtx)
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: TestCaseGroup(eglTestCtx, "stress", "EGL stress tests")
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void init (void)
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new MemoryStressTests(m_eglTestCtx));
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass PerformanceTests : public TestCaseGroup
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	PerformanceTests (EglTestContext& eglTestCtx)
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: TestCaseGroup(eglTestCtx, "performance", "EGL performance tests")
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void init (void)
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new MakeCurrentPerfTests			(m_eglTestCtx));
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new GLES2SharedRenderingPerfTests	(m_eglTestCtx));
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FunctionalTests : public TestCaseGroup
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FunctionalTests (EglTestContext& eglTestCtx)
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: TestCaseGroup(eglTestCtx, "functional", "EGL functional tests")
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void init (void)
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new CreateContextTests			(m_eglTestCtx));
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new QueryContextTests			(m_eglTestCtx));
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new CreateSurfaceTests			(m_eglTestCtx));
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new QuerySurfaceTests			(m_eglTestCtx));
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new QueryConfigTests			(m_eglTestCtx));
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new ChooseConfigTests			(m_eglTestCtx));
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new ColorClearTests			(m_eglTestCtx));
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new RenderTests				(m_eglTestCtx));
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new ImageTests					(m_eglTestCtx));
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new SharingTests				(m_eglTestCtx));
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new NegativeApiTests			(m_eglTestCtx));
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new FenceSyncTests				(m_eglTestCtx));
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new MultiThreadedTests			(m_eglTestCtx));
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new GetProcAddressTests		(m_eglTestCtx));
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new PreservingSwapTests		(m_eglTestCtx));
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new ClientExtensionTests		(m_eglTestCtx));
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new CreateContextExtTests		(m_eglTestCtx));
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new SurfacelessContextTests	(m_eglTestCtx));
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new SwapBuffersTests			(m_eglTestCtx));
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new NativeColorMappingTests	(m_eglTestCtx));
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new NativeCoordMappingTests	(m_eglTestCtx));
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new ReusableSyncTests			(m_eglTestCtx));
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new ResizeTests				(m_eglTestCtx));
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1363c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestCaseWrapper::TestCaseWrapper (EglTestContext& eglTestCtx)
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: tcu::TestCaseWrapper	(eglTestCtx.getTestContext())
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_eglTestCtx			(eglTestCtx)
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1423c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestCaseWrapper::~TestCaseWrapper (void)
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool TestCaseWrapper::initTestCase (tcu::TestCase* testCase)
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TestLog& log = m_eglTestCtx.getTestContext().getLog();
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Create display
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_eglTestCtx.createDefaultDisplay();
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (const std::exception& e)
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << e;
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_eglTestCtx.getTestContext().setTestResult(QP_TEST_RESULT_FAIL, "Failed to initialize EGL for default display");
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return false;
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return tcu::TestCaseWrapper::initTestCase(testCase);
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool TestCaseWrapper::deinitTestCase (tcu::TestCase* testCase)
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TestLog& log = m_eglTestCtx.getTestContext().getLog();
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool deinitOk = tcu::TestCaseWrapper::deinitTestCase(testCase);
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Destroy display
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK_EGL_CALL(eglMakeCurrent(m_eglTestCtx.getDisplay().getEGLDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_eglTestCtx.destroyDefaultDisplay();
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (const std::exception& e)
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << e;
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << tcu::TestLog::Message << "Error in EGL deinit, test program will teminate." << tcu::TestLog::EndMessage;
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return false;
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return deinitOk;
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestNode::IterateResult TestCaseWrapper::iterateTestCase (tcu::TestCase* testCase)
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return tcu::TestCaseWrapper::iterateTestCase(testCase);
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1923c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPackageContext::PackageContext (tcu::TestContext& testCtx)
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: m_eglTestCtx	(DE_NULL)
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_caseWrapper	(DE_NULL)
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const eglu::NativeDisplayFactoryRegistry&	dpyFactoryRegistry	= testCtx.getPlatform().getEGLPlatform().getNativeDisplayFactoryRegistry();
19789659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos	const char* const							displayFactoryName	= testCtx.getCommandLine().getEGLDisplayType();
19889659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos	const char* const							windowFactoryName	= testCtx.getCommandLine().getEGLWindowType();
19989659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos	const char* const							pixmapFactoryName	= testCtx.getCommandLine().getEGLPixmapType();
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const eglu::NativeDisplayFactory*			displayFactory		= DE_NULL;
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const eglu::NativeWindowFactory*			windowFactory		= DE_NULL;
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const eglu::NativePixmapFactory*			pixmapFactory		= DE_NULL;
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (dpyFactoryRegistry.empty())
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::print("ERROR: Platform doesn't support any EGL native display types!\n");
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw tcu::NotSupportedError("Platform doesn't have EGL any native display factories", DE_NULL, __FILE__, __LINE__);
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
21189659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos	if (!displayFactoryName)
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		displayFactory = dpyFactoryRegistry.getDefaultFactory();
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
21589659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos		displayFactory = dpyFactoryRegistry.getFactoryByName(displayFactoryName);
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!displayFactory)
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
21989659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos			tcu::print("ERROR: Unknown/unsupported EGL native display type '%s'\n", displayFactoryName);
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			tcu::print("Supported EGL native display types:\n");
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int factoryNdx = 0; factoryNdx < (int)dpyFactoryRegistry.getFactoryCount(); factoryNdx++)
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const char* name = dpyFactoryRegistry.getFactoryByIndex(factoryNdx)->getName();
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const char* desc = dpyFactoryRegistry.getFactoryByIndex(factoryNdx)->getDescription();
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				tcu::print("  %s: %s\n", name, desc);
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
23089659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos			throw tcu::NotSupportedError(("Unknown EGL native display type '" + std::string(displayFactoryName) + "'.").c_str(), DE_NULL, __FILE__, __LINE__);
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::print("Using EGL native display type '%s'\n", displayFactory->getName());
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!displayFactory->getNativeWindowRegistry().empty())
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
23889659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos		windowFactory = windowFactoryName ? displayFactory->getNativeWindowRegistry().getFactoryByName(windowFactoryName)
23989659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos										  : displayFactory->getNativeWindowRegistry().getDefaultFactory();
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!windowFactory)
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
24389659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos			DE_ASSERT(windowFactoryName);
24489659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos			tcu::print("ERROR: Unknown/unsupported EGL native window type '%s'\n", windowFactoryName);
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			tcu::print("Supported EGL native window types for native display '%s':\n", displayFactory->getName());
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int factoryNdx = 0; factoryNdx < (int)displayFactory->getNativeWindowRegistry().getFactoryCount(); factoryNdx++)
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const char* name = displayFactory->getNativeWindowRegistry().getFactoryByIndex(factoryNdx)->getName();
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const char* desc = displayFactory->getNativeWindowRegistry().getFactoryByIndex(factoryNdx)->getDescription();
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				tcu::print("  %s: %s\n", name, desc);
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
25589659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos			throw tcu::NotSupportedError(("Unknown EGL native window type '" + std::string(windowFactoryName) + "'").c_str(), DE_NULL, __FILE__, __LINE__);
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::print("Warning: EGL native display doesn't have any native window types.\n");
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!displayFactory->getNativePixmapRegistry().empty())
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
26389659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos		pixmapFactory = pixmapFactoryName ? displayFactory->getNativePixmapRegistry().getFactoryByName(pixmapFactoryName)
26489659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos										  : displayFactory->getNativePixmapRegistry().getDefaultFactory();
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!pixmapFactory)
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
26889659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos			DE_ASSERT(pixmapFactoryName);
26989659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos			tcu::print("ERROR: Unknown/unsupported EGL native pixmap type '%s'\n", pixmapFactoryName);
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			tcu::print("Supported EGL native pixmap types for native display '%s':\n", displayFactory->getName());
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int factoryNdx = 0; factoryNdx < (int)displayFactory->getNativePixmapRegistry().getFactoryCount(); factoryNdx++)
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const char* name = displayFactory->getNativePixmapRegistry().getFactoryByIndex(factoryNdx)->getName();
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const char* desc = displayFactory->getNativePixmapRegistry().getFactoryByIndex(factoryNdx)->getDescription();
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				tcu::print("  %s: %s\n", name, desc);
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
28089659d2685195bf9e34ff7a2e321e6ce471c8462Pyry Haulos			throw tcu::NotSupportedError(("Unknown EGL native pixmap type '" + std::string(pixmapFactoryName) + "'").c_str(), DE_NULL, __FILE__, __LINE__);
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::print("Warning: EGL native display doesn't have any native pixmap types.\n");
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (windowFactory)
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::print("Using EGL native window type '%s'\n", windowFactory->getName());
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (pixmapFactory)
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::print("Using EGL native pixmap type '%s'\n", pixmapFactory->getName());
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_eglTestCtx	= new EglTestContext(testCtx, *displayFactory, windowFactory, pixmapFactory);
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_caseWrapper	= new TestCaseWrapper(*m_eglTestCtx);
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (...)
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		delete m_caseWrapper;
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		delete m_eglTestCtx;
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3053c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPackageContext::~PackageContext (void)
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	delete m_caseWrapper;
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	delete m_eglTestCtx;
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3113c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestPackage::TestPackage (tcu::TestContext& testCtx)
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: tcu::TestPackage	(testCtx, "dEQP-EGL", "dEQP EGL Tests")
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_packageCtx		(DE_NULL)
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_archive			(testCtx.getRootArchive(), "egl/")
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3183c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestPackage::~TestPackage (void)
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Destroy children first since destructors may access context.
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestNode::deinit();
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	delete m_packageCtx;
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid TestPackage::init (void)
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(!m_packageCtx);
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_packageCtx = new PackageContext(m_testCtx);
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new InfoTests				(m_packageCtx->getEglTestContext()));
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new FunctionalTests		(m_packageCtx->getEglTestContext()));
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new PerformanceTests		(m_packageCtx->getEglTestContext()));
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new StressTests			(m_packageCtx->getEglTestContext()));
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (...)
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		delete m_packageCtx;
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_packageCtx = DE_NULL;
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid TestPackage::deinit (void)
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TestNode::deinit();
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	delete m_packageCtx;
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_packageCtx = DE_NULL;
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // egl
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
355