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 eglMakeCurrent performance tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglMakeCurrentPerfTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeWindow.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativePixmap.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluUtil.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 303c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "eglwLibrary.hpp" 313c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "eglwEnums.hpp" 323c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp" 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deRandom.hpp" 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp" 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deClock.h" 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deString.h" 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <algorithm> 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <cmath> 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <limits> 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <sstream> 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string> 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector> 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::ostringstream; 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string; 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector; 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog; 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 543c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosusing namespace eglw; 553c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace egl 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MakeCurrentPerfCase : public TestCase 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum SurfaceType 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SURFACETYPE_PBUFFER = (1<<0), 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SURFACETYPE_WINDOW = (1<<1), 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SURFACETYPE_PIXMAP = (1<<2) 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry struct Spec 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SurfaceType surfaceTypes; 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int contextCount; 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int surfaceCount; 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool release; 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int iterationCount; 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int sampleCount; 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry string toName (void) const; 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry string toDescription (void) const; 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase (EglTestContext& eglTestCtx, const Spec& spec, const char* name, const char* description); 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~MakeCurrentPerfCase (void); 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void deinit (void); 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IterateResult iterate (void); 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Spec m_spec; 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry de::Random m_rnd; 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 963c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLDisplay m_display; 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLConfig m_config; 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vector<EGLContext> m_contexts; 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vector<EGLSurface> m_surfaces; 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vector<eglu::NativeWindow*> m_windows; 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vector<eglu::NativePixmap*> m_pixmaps; 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vector<deUint64> m_samples; 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void chooseConfig (void); 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void createSurfaces (void); 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void createContexts (void); 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void destroySurfaces (void); 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void destroyContexts (void); 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void createPBuffer (void); 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void createWindow (void); 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void createPixmap (void); 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void logTestInfo (void); 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void logResults (void); 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Disabled 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase (const MakeCurrentPerfCase&); 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase& operator= (const MakeCurrentPerfCase&); 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring MakeCurrentPerfCase::Spec::toName (void) const 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ostringstream name; 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry name << "context"; 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (contextCount > 1) 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry name << "s_" << contextCount; 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((surfaceTypes & SURFACETYPE_WINDOW) != 0) 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry name << "_window" << (surfaceCount > 1 ? "s" : ""); 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((surfaceTypes & SURFACETYPE_PIXMAP) != 0) 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry name << "_pixmap" << (surfaceCount > 1 ? "s" : ""); 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((surfaceTypes & SURFACETYPE_PBUFFER) != 0) 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry name << "_pbuffer" << (surfaceCount > 1 ? "s" : ""); 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (surfaceCount > 1) 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry name << "_" << surfaceCount; 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (release) 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry name << "_release"; 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return name.str(); 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring MakeCurrentPerfCase::Spec::toDescription (void) const 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \todo [mika] Generate descrpition 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return toName(); 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1573c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMakeCurrentPerfCase::MakeCurrentPerfCase (EglTestContext& eglTestCtx, const Spec& spec, const char* name, const char* description) 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCase (eglTestCtx, tcu::NODETYPE_PERFORMANCE, name, description) 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_spec (spec) 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_rnd (deStringHash(name)) 1613c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos , m_display (EGL_NO_DISPLAY) 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_config (DE_NULL) 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1663c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMakeCurrentPerfCase::~MakeCurrentPerfCase (void) 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deinit(); 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::init (void) 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1733c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos m_display = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay()); 1743c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry chooseConfig(); 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry createContexts(); 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry createSurfaces(); 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::deinit (void) 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry destroyContexts(); 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry destroySurfaces(); 1843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 1858e814ce14475b71be9d3e17db2f1d1c6a3fcc59fPyry Haulos if (m_display != EGL_NO_DISPLAY) 1868e814ce14475b71be9d3e17db2f1d1c6a3fcc59fPyry Haulos { 1878e814ce14475b71be9d3e17db2f1d1c6a3fcc59fPyry Haulos m_eglTestCtx.getLibrary().terminate(m_display); 1888e814ce14475b71be9d3e17db2f1d1c6a3fcc59fPyry Haulos m_display = EGL_NO_DISPLAY; 1898e814ce14475b71be9d3e17db2f1d1c6a3fcc59fPyry Haulos } 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::chooseConfig (void) 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint surfaceBits = ((m_spec.surfaceTypes & SURFACETYPE_WINDOW) != 0 ? EGL_WINDOW_BIT : 0) 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry | ((m_spec.surfaceTypes & SURFACETYPE_PIXMAP) != 0 ? EGL_PIXMAP_BIT : 0) 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry | ((m_spec.surfaceTypes & SURFACETYPE_PBUFFER) != 0 ? EGL_PBUFFER_BIT : 0); 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint attribList[] = { 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_SURFACE_TYPE, surfaceBits, 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_NONE 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2043c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 2053c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLint configCount = 0; 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2073c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_CALL(egl, chooseConfig(m_display, attribList, &m_config, 1, &configCount)); 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (configCount <= 0) 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("No compatible configs found"); 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::createSurfaces (void) 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vector<SurfaceType> types; 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((m_spec.surfaceTypes & SURFACETYPE_WINDOW) != 0) 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry types.push_back(SURFACETYPE_WINDOW); 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((m_spec.surfaceTypes & SURFACETYPE_PIXMAP) != 0) 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry types.push_back(SURFACETYPE_PIXMAP); 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((m_spec.surfaceTypes & SURFACETYPE_PBUFFER) != 0) 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry types.push_back(SURFACETYPE_PBUFFER); 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT((int)types.size() <= m_spec.surfaceCount); 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Create surfaces 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int surfaceNdx = 0; surfaceNdx < m_spec.surfaceCount; surfaceNdx++) 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SurfaceType type = types[surfaceNdx % types.size()]; 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry switch (type) 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case SURFACETYPE_PBUFFER: 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry createPBuffer(); 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case SURFACETYPE_WINDOW: 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry createWindow(); 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry case SURFACETYPE_PIXMAP: 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry createPixmap(); 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry break; 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry default: 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(false); 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::createPBuffer (void) 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2553c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint width = 256; 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint height = 256; 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint attribList[] = { 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_WIDTH, width, 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_HEIGHT, height, 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_NONE 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2653c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLSurface surface = egl.createPbufferSurface(m_display, m_config, attribList); 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2673c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_MSG(egl, "eglCreatePbufferSurface()"); 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_surfaces.push_back(surface); 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::createWindow (void) 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2743c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 2753c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint width = 256; 2763c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint height = 256; 2773c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 278485844e764f2821545146b832726a36012f86238Mika Isojärvi const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine()); 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2803c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::NativeWindow* window = DE_NULL; 2813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLSurface surface = EGL_NO_SURFACE; 2823c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry try 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 285485844e764f2821545146b832726a36012f86238Mika Isojärvi window = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_eglTestCtx.getTestContext().getCommandLine()))); 2863c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos surface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, m_display, m_config, DE_NULL); 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2883c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos catch (...) 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (surface != EGL_NO_SURFACE) 2913c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos egl.destroySurface(m_display, surface); 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete window; 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw; 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_windows.push_back(window); 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_surfaces.push_back(surface); 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::createPixmap (void) 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3033c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 3043c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint width = 256; 3053c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint height = 256; 3063c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 307485844e764f2821545146b832726a36012f86238Mika Isojärvi const eglu::NativePixmapFactory& pixmapFactory = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine()); 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3093c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::NativePixmap* pixmap = DE_NULL; 3103c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLSurface surface = EGL_NO_SURFACE; 3113c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry try 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 314485844e764f2821545146b832726a36012f86238Mika Isojärvi pixmap = pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, width, height); 3153c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos surface = eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, m_display, m_config, DE_NULL); 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3173c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos catch (...) 3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (surface != EGL_NO_SURFACE) 3203c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos egl.destroySurface(m_display, surface); 3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete pixmap; 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw; 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_pixmaps.push_back(pixmap); 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_surfaces.push_back(surface); 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::destroySurfaces (void) 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3323c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 3333c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_surfaces.size() > 0) 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3363c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLDisplay display = m_display; 3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Destroy surfaces 3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (vector<EGLSurface>::iterator iter = m_surfaces.begin(); iter != m_surfaces.end(); ++iter) 3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (*iter != EGL_NO_SURFACE) 3423c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_CALL(egl, destroySurface(display, *iter)); 3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *iter = EGL_NO_SURFACE; 3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_surfaces.clear(); 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Destroy pixmaps 3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (vector<eglu::NativePixmap*>::iterator iter = m_pixmaps.begin(); iter != m_pixmaps.end(); ++iter) 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete *iter; 3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *iter = NULL; 3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_pixmaps.clear(); 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Destroy windows 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (vector<eglu::NativeWindow*>::iterator iter = m_windows.begin(); iter != m_windows.end(); ++iter) 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete *iter; 3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *iter = NULL; 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_windows.clear(); 3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Clear all surface handles 3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_surfaces.clear(); 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::createContexts (void) 3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3733c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int contextNdx = 0; contextNdx < m_spec.contextCount; contextNdx++) 3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint attribList[] = { 3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_CONTEXT_CLIENT_VERSION, 2, 3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_NONE 3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3823c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API)); 3833c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLContext context = egl.createContext(m_display, m_config, EGL_NO_CONTEXT, attribList); 3843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_MSG(egl, "eglCreateContext()"); 3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_contexts.push_back(context); 3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::destroyContexts (void) 3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3923c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_contexts.size() > 0) 3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3953c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLDisplay display = m_display; 3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (vector<EGLContext>::iterator iter = m_contexts.begin(); iter != m_contexts.end(); ++iter) 3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (*iter != EGL_NO_CONTEXT) 4003c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_CALL(egl, destroyContext(display, *iter)); 4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *iter = EGL_NO_CONTEXT; 4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_contexts.clear(); 4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::logTestInfo (void) 4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestLog& log = m_testCtx.getLog(); 4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::ScopedLogSection section(log, "Test Info", "Test case information."); 4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Context count: " << m_contexts.size() << TestLog::EndMessage; 4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Surfaces count: " << m_surfaces.size() << TestLog::EndMessage; 4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Sample count: " << m_spec.sampleCount << TestLog::EndMessage; 4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Iteration count: " << m_spec.iterationCount << TestLog::EndMessage; 4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Window count: " << m_windows.size() << TestLog::EndMessage; 4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Pixmap count: " << m_pixmaps.size() << TestLog::EndMessage; 4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "PBuffer count: " << (m_surfaces.size() - m_windows.size() - m_pixmaps.size()) << TestLog::EndMessage; 4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_spec.release) 4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Context is released after each use. Both binding and releasing context are included in result time." << TestLog::EndMessage; 4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::logResults (void) 4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestLog& log = m_testCtx.getLog(); 4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::SampleList("Result", "Result") 4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << TestLog::SampleInfo << TestLog::ValueInfo("Time", "Time", "us", QP_SAMPLE_VALUE_TAG_RESPONSE) 4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << TestLog::EndSampleInfo; 4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++) 4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Sample << deInt64(m_samples[sampleNdx]) << TestLog::EndSample; 4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::EndSampleList; 4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Log stats 4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint64 totalTimeUs = 0; 4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint64 totalIterationCount = 0; 4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float iterationTimeMeanUs = 0.0f; 4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float iterationTimeMedianUs = 0.0f; 4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float iterationTimeVarianceUs = 0.0f; 4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float iterationTimeSkewnessUs = 0.0f; 4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float iterationTimeMinUs = std::numeric_limits<float>::max(); 4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float iterationTimeMaxUs = 0.0f; 4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::sort(m_samples.begin(), m_samples.end()); 4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Calculate totals 4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++) 4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry totalTimeUs += m_samples[sampleNdx]; 4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry totalIterationCount += m_spec.iterationCount; 4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Calculate mean and median 4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry iterationTimeMeanUs = ((float)(((double)totalTimeUs) / totalIterationCount)); 4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry iterationTimeMedianUs = ((float)(((double)m_samples[m_samples.size() / 2]) / m_spec.iterationCount)); 4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Calculate variance 4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++) 4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float iterationTimeUs = (float)(((double)m_samples[sampleNdx]) / m_spec.iterationCount); 4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry iterationTimeVarianceUs += std::pow(iterationTimeUs - iterationTimeMedianUs, 2.0f); 4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Calculate min and max 4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++) 4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float iterationTimeUs = (float)(((double)m_samples[sampleNdx]) / m_spec.iterationCount); 4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry iterationTimeMinUs = std::min<float>(iterationTimeMinUs, iterationTimeUs); 4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry iterationTimeMaxUs = std::max<float>(iterationTimeMaxUs, iterationTimeUs); 4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry iterationTimeVarianceUs /= m_samples.size(); 4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Calculate skewness 4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++) 4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float iterationTimeUs = (float)(((double)m_samples[sampleNdx]) / m_spec.iterationCount); 4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry iterationTimeSkewnessUs = std::pow((iterationTimeUs - iterationTimeMedianUs) / iterationTimeVarianceUs, 2.0f); 4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry iterationTimeSkewnessUs /= (float)m_samples.size(); 4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::ScopedLogSection section(log, "Result", "Statistics from results."); 4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Total time: " << totalTimeUs << "us" << TestLog::EndMessage; 4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Mean: " << iterationTimeMeanUs << "us" << TestLog::EndMessage; 4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Median: " << iterationTimeMedianUs << "us" << TestLog::EndMessage; 4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Variance: " << iterationTimeVarianceUs << "us" << TestLog::EndMessage; 4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Skewness: " << iterationTimeSkewnessUs << "us" << TestLog::EndMessage; 5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Min: " << iterationTimeMinUs << "us" << TestLog::EndMessage; 5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Max: " << iterationTimeMaxUs << "us" << TestLog::EndMessage; 5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_PASS, de::floatToString((float)(((double)totalTimeUs)/totalIterationCount), 2).c_str()); 5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5083c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestCase::IterateResult MakeCurrentPerfCase::iterate (void) 5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5103c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_samples.size() == 0) 5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logTestInfo(); 5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5153c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLDisplay display = m_display; 5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint64 beginTimeUs = deGetMicroseconds(); 5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int iteration = 0; iteration < m_spec.iterationCount; iteration++) 5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLContext context = m_contexts[m_rnd.getUint32() % m_contexts.size()]; 5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLSurface surface = m_surfaces[m_rnd.getUint32() % m_surfaces.size()]; 5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5233c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos egl.makeCurrent(display, surface, surface, context); 5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_spec.release) 5263c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos egl.makeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); 5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_samples.push_back(deGetMicroseconds() - beginTimeUs); 5303c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 531d2722f6ec95d6f745a9ee1bfa5f033574b91f235Mika Isojärvi egl.makeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); 5323c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_MSG(egl, "eglMakeCurrent()"); 5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((int)m_samples.size() == m_spec.sampleCount) 5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logResults(); 5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return STOP; 5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return CONTINUE; 5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5443c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMakeCurrentPerfTests::MakeCurrentPerfTests (EglTestContext& eglTestCtx) 5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(eglTestCtx, "make_current", "eglMakeCurrent performance tests") 5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfTests::init (void) 5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int iterationCount = 100; 5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int sampleCount = 100; 5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Add simple test group 5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestCaseGroup* simple = new TestCaseGroup(m_eglTestCtx, "simple", "Simple eglMakeCurrent performance tests using single context and surface"); 5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const MakeCurrentPerfCase::SurfaceType types[] = { 5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_PBUFFER, 5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_PIXMAP, 5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_WINDOW 5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int typeNdx = 0; typeNdx < DE_LENGTH_OF_ARRAY(types); typeNdx++) 5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int releaseNdx = 0; releaseNdx < 2; releaseNdx++) 5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::Spec spec; 5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.surfaceTypes = types[typeNdx]; 5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.contextCount = 1; 5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.surfaceCount = 1; 5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.release = (releaseNdx == 1); 5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.iterationCount = iterationCount; 5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.sampleCount = sampleCount; 5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry simple->addChild(new MakeCurrentPerfCase(m_eglTestCtx, spec, spec.toName().c_str(), spec.toDescription().c_str())); 5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(simple); 5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Add multi context test group 5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestCaseGroup* multiContext = new TestCaseGroup(m_eglTestCtx, "multi_context", "eglMakeCurrent performance tests using multiple contexts and single surface"); 5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const MakeCurrentPerfCase::SurfaceType types[] = { 5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_PBUFFER, 5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_PIXMAP, 5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_WINDOW 5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int contextCounts[] = { 5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10, 100 5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int contextCountNdx = 0; contextCountNdx < DE_LENGTH_OF_ARRAY(contextCounts); contextCountNdx++) 5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int typeNdx = 0; typeNdx < DE_LENGTH_OF_ARRAY(types); typeNdx++) 6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int releaseNdx = 0; releaseNdx < 2; releaseNdx++) 6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::Spec spec; 6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.surfaceTypes = types[typeNdx]; 6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.contextCount = contextCounts[contextCountNdx]; 6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.surfaceCount = 1; 6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.release = (releaseNdx == 1); 6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.iterationCount = iterationCount; 6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.sampleCount = sampleCount; 6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry multiContext->addChild(new MakeCurrentPerfCase(m_eglTestCtx, spec, spec.toName().c_str(), spec.toDescription().c_str())); 6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(multiContext); 6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Add multi surface test group 6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestCaseGroup* multiSurface = new TestCaseGroup(m_eglTestCtx, "multi_surface", "eglMakeCurrent performance tests using single context and multiple surfaces"); 6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const MakeCurrentPerfCase::SurfaceType types[] = { 6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_PBUFFER, 6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_PIXMAP, 6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_WINDOW, 6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry (MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER |MakeCurrentPerfCase::SURFACETYPE_PIXMAP), 6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry (MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER |MakeCurrentPerfCase::SURFACETYPE_WINDOW), 6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry (MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PIXMAP |MakeCurrentPerfCase::SURFACETYPE_WINDOW), 6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry (MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER|MakeCurrentPerfCase::SURFACETYPE_PIXMAP|MakeCurrentPerfCase::SURFACETYPE_WINDOW) 6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int surfaceCounts[] = { 6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10, 100 6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int surfaceCountNdx = 0; surfaceCountNdx < DE_LENGTH_OF_ARRAY(surfaceCounts); surfaceCountNdx++) 6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int typeNdx = 0; typeNdx < DE_LENGTH_OF_ARRAY(types); typeNdx++) 6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int releaseNdx = 0; releaseNdx < 2; releaseNdx++) 6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::Spec spec; 6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.surfaceTypes = types[typeNdx]; 6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.surfaceCount = surfaceCounts[surfaceCountNdx]; 6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.contextCount = 1; 6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.release = (releaseNdx == 1); 6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.iterationCount = iterationCount; 6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.sampleCount = sampleCount; 6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry multiSurface->addChild(new MakeCurrentPerfCase(m_eglTestCtx, spec, spec.toName().c_str(), spec.toDescription().c_str())); 6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(multiSurface); 6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Add Complex? test group 6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TestCaseGroup* multi = new TestCaseGroup(m_eglTestCtx, "complex", "eglMakeCurrent performance tests using multiple contexts and multiple surfaces"); 6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const MakeCurrentPerfCase::SurfaceType types[] = { 6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_PBUFFER, 6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_PIXMAP, 6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::SURFACETYPE_WINDOW, 6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry (MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER |MakeCurrentPerfCase::SURFACETYPE_PIXMAP), 6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry (MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER |MakeCurrentPerfCase::SURFACETYPE_WINDOW), 6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry (MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PIXMAP |MakeCurrentPerfCase::SURFACETYPE_WINDOW), 6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry (MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER|MakeCurrentPerfCase::SURFACETYPE_PIXMAP|MakeCurrentPerfCase::SURFACETYPE_WINDOW) 6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int surfaceCounts[] = { 6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10, 100 6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int contextCounts[] = { 6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10, 100 6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int surfaceCountNdx = 0; surfaceCountNdx < DE_LENGTH_OF_ARRAY(surfaceCounts); surfaceCountNdx++) 6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int contextCountNdx = 0; contextCountNdx < DE_LENGTH_OF_ARRAY(contextCounts); contextCountNdx++) 6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int typeNdx = 0; typeNdx < DE_LENGTH_OF_ARRAY(types); typeNdx++) 6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int releaseNdx = 0; releaseNdx < 2; releaseNdx++) 6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MakeCurrentPerfCase::Spec spec; 6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.surfaceTypes = types[typeNdx]; 7003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.contextCount = contextCounts[contextCountNdx]; 7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.surfaceCount = surfaceCounts[surfaceCountNdx]; 7023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.release = (releaseNdx == 1); 7033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.iterationCount = iterationCount; 7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.sampleCount = sampleCount; 7053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry multi->addChild(new MakeCurrentPerfCase(m_eglTestCtx, spec, spec.toName().c_str(), spec.toDescription().c_str())); 7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(multi); 7133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // egl 7173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 718