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 Surface query tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglQuerySurfaceTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglSimpleConfigCase.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeDisplay.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeWindow.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativePixmap.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluStrUtil.hpp" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluUtil.hpp" 333c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "egluUnique.hpp" 343c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 353c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "eglwLibrary.hpp" 363c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "eglwEnums.hpp" 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp" 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestContext.hpp" 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuCommandLine.hpp" 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deUniquePtr.hpp" 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string> 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector> 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace egl 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing eglu::ConfigInfo; 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog; 543c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosusing namespace eglw; 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void logSurfaceAttribute (tcu::TestLog& log, EGLint attribute, EGLint value) 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* name = eglu::getSurfaceAttribName(attribute); 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const eglu::SurfaceAttribValueFmt valueFmt (attribute, value); 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " " << name << ": " << valueFmt << TestLog::EndMessage; 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 643c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosstatic void logSurfaceAttributes (tcu::TestLog& log, const Library& egl, EGLDisplay display, EGLSurface surface, const EGLint* attributes, int numAttribs) 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 663c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos for (int ndx = 0; ndx < numAttribs; ndx++) 673c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos logSurfaceAttribute(log, attributes[ndx], eglu::querySurfaceInt(egl, display, surface, attributes[ndx])); 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 703c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosstatic void logCommonSurfaceAttributes (tcu::TestLog& log, const Library& egl, EGLDisplay display, EGLSurface surface) 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry static const EGLint attributes[] = 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_CONFIG_ID, 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_WIDTH, 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_HEIGHT, 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_HORIZONTAL_RESOLUTION, 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_VERTICAL_RESOLUTION, 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_MULTISAMPLE_RESOLVE, 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_PIXEL_ASPECT_RATIO, 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_RENDER_BUFFER, 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_SWAP_BEHAVIOR, 833c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGL_ALPHA_FORMAT, 843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGL_COLORSPACE 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 873c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos logSurfaceAttributes(log, egl, display, surface, attributes, DE_LENGTH_OF_ARRAY(attributes)); 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 903c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosstatic void logPbufferSurfaceAttributes (tcu::TestLog& log, const Library& egl, EGLDisplay display, EGLSurface surface) 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 923c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos static const EGLint attributes[] = 933c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos { 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_LARGEST_PBUFFER, 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_TEXTURE_FORMAT, 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_TEXTURE_TARGET, 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_MIPMAP_TEXTURE, 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_MIPMAP_LEVEL, 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1013c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos logSurfaceAttributes(log, egl, display, surface, attributes, DE_LENGTH_OF_ARRAY(attributes)); 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass QuerySurfaceCase : public SimpleConfigCase 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1073c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos QuerySurfaceCase (EglTestContext& eglTestCtx, const char* name, const char* description, const eglu::FilterList& filters); 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1093c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos void checkCommonAttributes (EGLDisplay display, EGLSurface surface, const ConfigInfo& info); 1103c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos void checkNonPbufferAttributes (EGLDisplay display, EGLSurface surface); 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1133c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry HaulosQuerySurfaceCase::QuerySurfaceCase (EglTestContext& eglTestCtx, const char* name, const char* description, const eglu::FilterList& filters) 1143c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos : SimpleConfigCase(eglTestCtx, name, description, filters) 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1183c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosvoid QuerySurfaceCase::checkCommonAttributes (EGLDisplay display, EGLSurface surface, const ConfigInfo& info) 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1203c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestLog& log = m_testCtx.getLog(); 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Attributes which are common to all surface types 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Config ID 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1273c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint id = eglu::querySurfaceInt(egl, display, surface, EGL_CONFIG_ID); 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (id != info.configId) 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, config ID " << id << " does not match the one used to create the surface" << TestLog::EndMessage; 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Config ID mismatch"); 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Width and height 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1383c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint width = eglu::querySurfaceInt(egl, display, surface, EGL_WIDTH); 1393c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint height = eglu::querySurfaceInt(egl, display, surface, EGL_HEIGHT); 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (width <= 0 || height <= 0) 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, invalid surface size " << width << "x" << height << TestLog::EndMessage; 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid surface size"); 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Horizontal and vertical resolution 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1503c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint hRes = eglu::querySurfaceInt(egl, display, surface, EGL_HORIZONTAL_RESOLUTION); 1513c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint vRes = eglu::querySurfaceInt(egl, display, surface, EGL_VERTICAL_RESOLUTION); 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if ((hRes <= 0 || vRes <= 0) && (hRes != EGL_UNKNOWN && vRes != EGL_UNKNOWN)) 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, invalid surface resolution " << hRes << "x" << vRes << TestLog::EndMessage; 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid surface resolution"); 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Pixel aspect ratio 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1623c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint pixelRatio = eglu::querySurfaceInt(egl, display, surface, EGL_PIXEL_ASPECT_RATIO); 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (pixelRatio <= 0 && pixelRatio != EGL_UNKNOWN) 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1663c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos log << TestLog::Message << " Fail, invalid pixel aspect ratio " << eglu::querySurfaceInt(egl, display, surface, EGL_PIXEL_ASPECT_RATIO) << TestLog::EndMessage; 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid pixel aspect ratio"); 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Render buffer 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1733c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint renderBuffer = eglu::querySurfaceInt(egl, display, surface, EGL_RENDER_BUFFER); 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (renderBuffer != EGL_BACK_BUFFER && renderBuffer != EGL_SINGLE_BUFFER) 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, invalid render buffer value " << renderBuffer << TestLog::EndMessage; 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid render buffer"); 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Multisample resolve 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint multisampleResolve = eglu::querySurfaceInt(egl, display, surface, EGL_MULTISAMPLE_RESOLVE); 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (multisampleResolve != EGL_MULTISAMPLE_RESOLVE_DEFAULT && multisampleResolve != EGL_MULTISAMPLE_RESOLVE_BOX) 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, invalid multisample resolve value " << multisampleResolve << TestLog::EndMessage; 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid multisample resolve"); 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (multisampleResolve == EGL_MULTISAMPLE_RESOLVE_BOX && !(info.surfaceType & EGL_MULTISAMPLE_RESOLVE_BOX_BIT)) 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, multisample resolve is reported as box filter but configuration does not support it." << TestLog::EndMessage; 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid multisample resolve"); 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Swap behavior 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2013c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint swapBehavior = eglu::querySurfaceInt(egl, display, surface, EGL_SWAP_BEHAVIOR); 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (swapBehavior != EGL_BUFFER_DESTROYED && swapBehavior != EGL_BUFFER_PRESERVED) 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, invalid swap behavior value " << swapBehavior << TestLog::EndMessage; 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid swap behavior"); 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (swapBehavior == EGL_BUFFER_PRESERVED && !(info.surfaceType & EGL_SWAP_BEHAVIOR_PRESERVED_BIT)) 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, swap behavior is reported as preserve but configuration does not support it." << TestLog::EndMessage; 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid swap behavior"); 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2163c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos // alpha format 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2183c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint alphaFormat = eglu::querySurfaceInt(egl, display, surface, EGL_ALPHA_FORMAT); 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2203c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos if (alphaFormat != EGL_ALPHA_FORMAT_NONPRE && alphaFormat != EGL_ALPHA_FORMAT_PRE) 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2223c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos log << TestLog::Message << " Fail, invalid alpha format value " << alphaFormat << TestLog::EndMessage; 2233c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid alpha format"); 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2263c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos if (alphaFormat == EGL_ALPHA_FORMAT_PRE && !(info.surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT)) 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2283c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos log << TestLog::Message << " Fail, is set to use premultiplied alpha but configuration does not support it." << TestLog::EndMessage; 2293c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid alpha format"); 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2333c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos // color space 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2353c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint colorspace = eglu::querySurfaceInt(egl, display, surface, EGL_COLORSPACE); 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2373c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos if (colorspace != EGL_VG_COLORSPACE_sRGB && colorspace != EGL_VG_COLORSPACE_LINEAR) 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2393c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos log << TestLog::Message << " Fail, invalid color space value " << colorspace << TestLog::EndMessage; 2403c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid color space"); 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2433c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos if (colorspace == EGL_VG_COLORSPACE_LINEAR && !(info.surfaceType & EGL_VG_COLORSPACE_LINEAR_BIT)) 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2453c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos log << TestLog::Message << " Fail, is set to use a linear color space but configuration does not support it." << TestLog::EndMessage; 2463c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid color space"); 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2513c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosvoid QuerySurfaceCase::checkNonPbufferAttributes (EGLDisplay display, EGLSurface surface) 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2533c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint uninitializedMagicValue = -42; 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestLog& log = m_testCtx.getLog(); 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLint value = uninitializedMagicValue; 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2583c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos static const EGLint pbufferAttribs[] = 2593c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos { 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_LARGEST_PBUFFER, 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_TEXTURE_FORMAT, 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_TEXTURE_TARGET, 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_MIPMAP_TEXTURE, 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_MIPMAP_LEVEL, 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(pbufferAttribs); ndx++) 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint attribute = pbufferAttribs[ndx]; 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string name = eglu::getSurfaceAttribName(pbufferAttribs[ndx]); 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2723c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos egl.querySurface(display, surface, attribute, &value); 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2753c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint error = egl.getError(); 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (error != EGL_SUCCESS) 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, querying " << name << " from a non-pbuffer surface should not result in an error, received " 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << eglu::getErrorStr(error) << TestLog::EndMessage; 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Illegal error condition"); 2823c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos break; 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // "For a window or pixmap surface, the contents of value are not modified." 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (value != uninitializedMagicValue) 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, return value contents were modified when querying " << name << " from a non-pbuffer surface." << TestLog::EndMessage; 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Illegal modification of return value"); 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass QuerySurfaceSimpleWindowCase : public QuerySurfaceCase 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2983c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos QuerySurfaceSimpleWindowCase (EglTestContext& eglTestCtx, const char* name, const char* description, const eglu::FilterList& filters) 2993c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos : QuerySurfaceCase(eglTestCtx, name, description, filters) 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3033c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos void executeForConfig (EGLDisplay display, EGLConfig config) 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3053c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 3063c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos tcu::TestLog& log = m_testCtx.getLog(); 3073c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const int width = 64; 3083c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const int height = 64; 309485844e764f2821545146b832726a36012f86238Mika Isojärvi const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine()); 3103c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos ConfigInfo info; 3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3123c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::queryConfigInfo(egl, display, config, &info); 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3143c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos log << TestLog::Message << "Creating window surface with config ID " << info.configId << TestLog::EndMessage; 3153c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_MSG(egl, "before queries"); 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 317485844e764f2821545146b832726a36012f86238Mika Isojärvi de::UniquePtr<eglu::NativeWindow> window (windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine())))); 3183c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::UniqueSurface surface (egl, display, eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, display, config, DE_NULL)); 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3203c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos logCommonSurfaceAttributes (log, egl, display, *surface); 3213c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos checkCommonAttributes (display, *surface, info); 3223c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos checkNonPbufferAttributes (display, *surface); 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass QuerySurfaceSimplePixmapCase : public QuerySurfaceCase 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 3293c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos QuerySurfaceSimplePixmapCase (EglTestContext& eglTestCtx, const char* name, const char* description, const eglu::FilterList& filters) 3303c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos : QuerySurfaceCase(eglTestCtx, name, description, filters) 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3343c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos void executeForConfig (EGLDisplay display, EGLConfig config) 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3363c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 3373c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos tcu::TestLog& log = m_testCtx.getLog(); 3383c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const int width = 64; 3393c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const int height = 64; 340485844e764f2821545146b832726a36012f86238Mika Isojärvi const eglu::NativePixmapFactory& pixmapFactory = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine()); 3413c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos ConfigInfo info; 3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3433c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::queryConfigInfo(egl, display, config, &info); 3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3453c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos log << TestLog::Message << "Creating pixmap surface with config ID " << info.configId << TestLog::EndMessage; 3463c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_MSG(egl, "before queries"); 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 348485844e764f2821545146b832726a36012f86238Mika Isojärvi de::UniquePtr<eglu::NativePixmap> pixmap (pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height)); 3493c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::UniqueSurface surface (egl, display, eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, display, config, DE_NULL)); 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3513c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos logCommonSurfaceAttributes (log, egl, display, *surface); 3523c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos checkCommonAttributes (display, *surface, info); 3533c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos checkNonPbufferAttributes (display, *surface); 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass QuerySurfaceSimplePbufferCase : public QuerySurfaceCase 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 3603c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos QuerySurfaceSimplePbufferCase (EglTestContext& eglTestCtx, const char* name, const char* description, const eglu::FilterList& filters) 3613c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos : QuerySurfaceCase(eglTestCtx, name, description, filters) 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3653c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos void executeForConfig (EGLDisplay display, EGLConfig config) 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3673c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestLog& log = m_testCtx.getLog(); 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int width = 64; 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int height = 64; 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ConfigInfo info; 3723c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 3733c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::queryConfigInfo(egl, display, config, &info); 3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Creating pbuffer surface with config ID " << info.configId << TestLog::EndMessage; 3763c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_MSG(egl, "before queries"); 3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Clamp to maximums reported by implementation 3793c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos width = deMin32(width, eglu::getConfigAttribInt(egl, display, config, EGL_MAX_PBUFFER_WIDTH)); 3803c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos height = deMin32(height, eglu::getConfigAttribInt(egl, display, config, EGL_MAX_PBUFFER_HEIGHT)); 3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (width == 0 || height == 0) 3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, maximum pbuffer size of " << width << "x" << height << " reported" << TestLog::EndMessage; 3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid maximum pbuffer size"); 3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return; 3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint attribs[] = 3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_WIDTH, width, 3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_HEIGHT, height, 3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE, 3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_NONE 3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3983c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::UniqueSurface surface(egl, display, egl.createPbufferSurface(display, config, attribs)); 3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4003c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos logCommonSurfaceAttributes (log, egl, display, *surface); 4013c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos logPbufferSurfaceAttributes (log, egl, display, *surface); 4023c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos checkCommonAttributes (display, *surface, info); 4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Pbuffer-specific attributes 4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Largest pbuffer 4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4083c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint largestPbuffer = eglu::querySurfaceInt(egl, display, *surface, EGL_LARGEST_PBUFFER); 4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (largestPbuffer != EGL_FALSE && largestPbuffer != EGL_TRUE) 4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, invalid largest pbuffer value " << largestPbuffer << TestLog::EndMessage; 4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid largest pbuffer"); 4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Texture format 4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4193c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint textureFormat = eglu::querySurfaceInt(egl, display, *surface, EGL_TEXTURE_FORMAT); 4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (textureFormat != EGL_NO_TEXTURE && textureFormat != EGL_TEXTURE_RGB && textureFormat != EGL_TEXTURE_RGBA) 4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, invalid texture format value " << textureFormat << TestLog::EndMessage; 4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid texture format"); 4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Texture target 4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4303c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint textureTarget = eglu::querySurfaceInt(egl, display, *surface, EGL_TEXTURE_TARGET); 4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (textureTarget != EGL_NO_TEXTURE && textureTarget != EGL_TEXTURE_2D) 4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, invalid texture target value " << textureTarget << TestLog::EndMessage; 4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid texture target"); 4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Mipmap texture 4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4413c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint mipmapTexture = eglu::querySurfaceInt(egl, display, *surface, EGL_MIPMAP_TEXTURE); 4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (mipmapTexture != EGL_FALSE && mipmapTexture != EGL_TRUE) 4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, invalid mipmap texture value " << mipmapTexture << TestLog::EndMessage; 4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid mipmap texture"); 4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SurfaceAttribCase : public SimpleConfigCase 4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 4563c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos SurfaceAttribCase (EglTestContext& eglTestCtx, const char* name, const char* description, const eglu::FilterList& filters); 4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual ~SurfaceAttribCase (void) {} 4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4593c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos void testAttributes (EGLDisplay display, EGLSurface surface, EGLint surfaceType, const ConfigInfo& info); 4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4623c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry HaulosSurfaceAttribCase::SurfaceAttribCase (EglTestContext& eglTestCtx, const char* name, const char* description, const eglu::FilterList& filters) 4633c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos : SimpleConfigCase(eglTestCtx, name, description, filters) 4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4673c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosvoid SurfaceAttribCase::testAttributes (EGLDisplay display, EGLSurface surface, EGLint surfaceType, const ConfigInfo& info) 4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4693c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 4703c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos tcu::TestLog& log = m_testCtx.getLog(); 4713c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const eglu::Version version = eglu::getVersion(egl, display); 4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4733c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos if (version.getMajor() == 1 && version.getMinor() == 0) 4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "No attributes can be set in EGL 1.0" << TestLog::EndMessage; 4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return; 4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Mipmap level 4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (info.renderableType & EGL_OPENGL_ES_BIT || info.renderableType & EGL_OPENGL_ES2_BIT) 4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 482ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi const EGLint initialValue = 0xDEADBAAD; 483ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi EGLint value = initialValue; 484ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi 4853c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_CALL(egl, querySurface(display, surface, EGL_MIPMAP_LEVEL, &value)); 4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logSurfaceAttribute(log, EGL_MIPMAP_LEVEL, value); 4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4893c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos if (surfaceType == EGL_PBUFFER_BIT) 490ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi { 491ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi if (value != 0) 492ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi { 493ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi log << TestLog::Message << " Fail, initial mipmap level value should be 0, is " << value << TestLog::EndMessage; 494ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid default mipmap level"); 495ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi } 496ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi } 497ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi else if (value != initialValue) 4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 499ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi log << TestLog::Message << " Fail, eglQuerySurface changed value when querying EGL_MIPMAP_LEVEL for non-pbuffer surface. Result: " << value << ". Expected: " << initialValue << TestLog::EndMessage; 500ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4cMika Isojärvi m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "EGL_MIPMAP_LEVEL query modified result for non-pbuffer surface."); 5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5033c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos egl.surfaceAttrib(display, surface, EGL_MIPMAP_LEVEL, 1); 5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5063c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint error = egl.getError(); 5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (error != EGL_SUCCESS) 5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, setting EGL_MIPMAP_LEVEL should not result in an error, received " << eglu::getErrorStr(error) << TestLog::EndMessage; 5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Illegal error condition"); 5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Only mipmap level can be set in EGL 1.3 and lower 5183c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos if (version.getMajor() == 1 && version.getMinor() <= 3) return; 5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Multisample resolve 5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5223c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint value = eglu::querySurfaceInt(egl, display, surface, EGL_MULTISAMPLE_RESOLVE); 5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logSurfaceAttribute(log, EGL_MULTISAMPLE_RESOLVE, value); 5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (value != EGL_MULTISAMPLE_RESOLVE_DEFAULT) 5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, initial multisample resolve value should be EGL_MULTISAMPLE_RESOLVE_DEFAULT, is " 5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry << eglu::getSurfaceAttribValueStr(EGL_MULTISAMPLE_RESOLVE, value) << TestLog::EndMessage; 5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid default multisample resolve"); 5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (info.renderableType & EGL_MULTISAMPLE_RESOLVE_BOX_BIT) 5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Box filter is supported by surface, trying to set." << TestLog::EndMessage; 5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5373c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos egl.surfaceAttrib(display, surface, EGL_MULTISAMPLE_RESOLVE, EGL_MULTISAMPLE_RESOLVE_BOX); 5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5393c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos if (eglu::querySurfaceInt(egl, display, surface, EGL_MULTISAMPLE_RESOLVE) != EGL_MULTISAMPLE_RESOLVE_BOX) 5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, tried to enable box filter but value did not change."; 5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to set multisample resolve"); 5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Swap behavior 5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5493c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const EGLint value = eglu::querySurfaceInt(egl, display, surface, EGL_SWAP_BEHAVIOR); 5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry logSurfaceAttribute(log, EGL_SWAP_BEHAVIOR, value); 5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (info.renderableType & EGL_SWAP_BEHAVIOR_PRESERVED_BIT) 5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint nextValue = (value == EGL_BUFFER_DESTROYED) ? EGL_BUFFER_PRESERVED : EGL_BUFFER_DESTROYED; 5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5573c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos egl.surfaceAttrib(display, surface, EGL_SWAP_BEHAVIOR, nextValue); 5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5593c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos if (eglu::querySurfaceInt(egl, display, surface, EGL_SWAP_BEHAVIOR) != nextValue) 5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, tried to set swap behavior to " << eglu::getSurfaceAttribStr(nextValue) << TestLog::EndMessage; 5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to set swap behavior"); 5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SurfaceAttribWindowCase : public SurfaceAttribCase 5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 5713c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos SurfaceAttribWindowCase (EglTestContext& eglTestCtx, const char* name, const char* description, const eglu::FilterList& filters) 5723c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos : SurfaceAttribCase(eglTestCtx, name, description, filters) 5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5763c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos void executeForConfig (EGLDisplay display, EGLConfig config) 5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5783c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 5793c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos tcu::TestLog& log = m_testCtx.getLog(); 5803c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const int width = 64; 5813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const int height = 64; 582485844e764f2821545146b832726a36012f86238Mika Isojärvi const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine()); 5833c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos ConfigInfo info; 5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5853c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::queryConfigInfo(egl, display, config, &info); 5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Creating window surface with config ID " << info.configId << TestLog::EndMessage; 5883c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_MSG(egl, "before queries"); 5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 590485844e764f2821545146b832726a36012f86238Mika Isojärvi de::UniquePtr<eglu::NativeWindow> window (windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine())))); 5913c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::UniqueSurface surface (egl, display, eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, display, config, DE_NULL)); 5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5933c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos testAttributes(display, *surface, EGL_WINDOW_BIT, info); 5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SurfaceAttribPixmapCase : public SurfaceAttribCase 5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 6003c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos SurfaceAttribPixmapCase (EglTestContext& eglTestCtx, const char* name, const char* description, const eglu::FilterList& filters) 6013c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos : SurfaceAttribCase(eglTestCtx, name, description, filters) 6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6053c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos void executeForConfig (EGLDisplay display, EGLConfig config) 6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6073c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 6083c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos tcu::TestLog& log = m_testCtx.getLog(); 6093c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const int width = 64; 6103c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const int height = 64; 611485844e764f2821545146b832726a36012f86238Mika Isojärvi const eglu::NativePixmapFactory& pixmapFactory = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine()); 6123c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos ConfigInfo info; 6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6143c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::queryConfigInfo(egl, display, config, &info); 6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Creating pixmap surface with config ID " << info.configId << TestLog::EndMessage; 6173c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_MSG(egl, "before queries"); 6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 619485844e764f2821545146b832726a36012f86238Mika Isojärvi de::UniquePtr<eglu::NativePixmap> pixmap (pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height)); 6203c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::UniqueSurface surface (egl, display, eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, display, config, DE_NULL)); 6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6223c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos testAttributes(display, *surface, EGL_PIXMAP_BIT, info); 6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SurfaceAttribPbufferCase : public SurfaceAttribCase 6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 6293c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos SurfaceAttribPbufferCase (EglTestContext& eglTestCtx, const char* name, const char* description, const eglu::FilterList& filters) 6303c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos : SurfaceAttribCase(eglTestCtx, name, description, filters) 6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6343c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos void executeForConfig (EGLDisplay display, EGLConfig config) 6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6363c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Library& egl = m_eglTestCtx.getLibrary(); 6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestLog& log = m_testCtx.getLog(); 6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int width = 64; 6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int height = 64; 6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ConfigInfo info; 6413c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos 6423c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::queryConfigInfo(egl, display, config, &info); 6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << "Creating pbuffer surface with config ID " << info.configId << TestLog::EndMessage; 6453c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos EGLU_CHECK_MSG(egl, "before queries"); 6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Clamp to maximums reported by implementation 6483c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos width = deMin32(width, eglu::getConfigAttribInt(egl, display, config, EGL_MAX_PBUFFER_WIDTH)); 6493c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos height = deMin32(height, eglu::getConfigAttribInt(egl, display, config, EGL_MAX_PBUFFER_HEIGHT)); 6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (width == 0 || height == 0) 6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry log << TestLog::Message << " Fail, maximum pbuffer size of " << width << "x" << height << " reported" << TestLog::EndMessage; 6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid maximum pbuffer size"); 6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return; 6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const EGLint attribs[] = 6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_WIDTH, width, 6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_HEIGHT, height, 6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE, 6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGL_NONE 6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6663c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::UniqueSurface surface(egl, display, egl.createPbufferSurface(display, config, attribs)); 6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6683c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos testAttributes(display, *surface, EGL_PBUFFER_BIT, info); 6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6723c827367444ee418f129b2c238299f49d3264554Jarkko PoyryQuerySurfaceTests::QuerySurfaceTests (EglTestContext& eglTestCtx) 6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(eglTestCtx, "query_surface", "Surface Query Tests") 6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6773c827367444ee418f129b2c238299f49d3264554Jarkko PoyryQuerySurfaceTests::~QuerySurfaceTests (void) 6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulostemplate <deUint32 Type> 6823c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosstatic bool surfaceType (const eglu::CandidateConfig& c) 6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos return (c.surfaceType() & Type) == Type; 6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid QuerySurfaceTests::init (void) 6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Simple queries 6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* simpleGroup = new tcu::TestCaseGroup(m_testCtx, "simple", "Simple queries"); 6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(simpleGroup); 6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Window 6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* windowGroup = new tcu::TestCaseGroup(m_testCtx, "window", "Window surfaces"); 6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry simpleGroup->addChild(windowGroup); 6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6993c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::FilterList baseFilters; 7003c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos baseFilters << surfaceType<EGL_WINDOW_BIT>; 7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7023c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos std::vector<NamedFilterList> filterLists; 7033c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos getDefaultFilterLists(filterLists, baseFilters); 7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7053c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++) 7063c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos windowGroup->addChild(new QuerySurfaceSimpleWindowCase(m_eglTestCtx, i->getName(), i->getDescription(), *i)); 7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Pixmap 7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* pixmapGroup = new tcu::TestCaseGroup(m_testCtx, "pixmap", "Pixmap surfaces"); 7123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry simpleGroup->addChild(pixmapGroup); 7133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7143c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::FilterList baseFilters; 7153c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos baseFilters << surfaceType<EGL_PIXMAP_BIT>; 7163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7173c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos std::vector<NamedFilterList> filterLists; 7183c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos getDefaultFilterLists(filterLists, baseFilters); 7193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7203c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++) 7213c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos pixmapGroup->addChild(new QuerySurfaceSimplePixmapCase(m_eglTestCtx, i->getName(), i->getDescription(), *i)); 7223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Pbuffer 7253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* pbufferGroup = new tcu::TestCaseGroup(m_testCtx, "pbuffer", "Pbuffer surfaces"); 7273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry simpleGroup->addChild(pbufferGroup); 7283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7293c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::FilterList baseFilters; 7303c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos baseFilters << surfaceType<EGL_PBUFFER_BIT>; 7313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7323c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos std::vector<NamedFilterList> filterLists; 7333c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos getDefaultFilterLists(filterLists, baseFilters); 7343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7353c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++) 7363c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos pbufferGroup->addChild(new QuerySurfaceSimplePbufferCase(m_eglTestCtx, i->getName(), i->getDescription(), *i)); 7373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Set surface attributes 7413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* setAttributeGroup = new tcu::TestCaseGroup(m_testCtx, "set_attribute", "Setting attributes"); 7433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(setAttributeGroup); 7443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Window 7463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* windowGroup = new tcu::TestCaseGroup(m_testCtx, "window", "Window surfaces"); 7483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry setAttributeGroup->addChild(windowGroup); 7493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7503c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::FilterList baseFilters; 7513c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos baseFilters << surfaceType<EGL_WINDOW_BIT>; 7523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7533c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos std::vector<NamedFilterList> filterLists; 7543c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos getDefaultFilterLists(filterLists, baseFilters); 7553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7563c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++) 7573c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos windowGroup->addChild(new SurfaceAttribWindowCase(m_eglTestCtx, i->getName(), i->getDescription(), *i)); 7583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Pixmap 7613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* pixmapGroup = new tcu::TestCaseGroup(m_testCtx, "pixmap", "Pixmap surfaces"); 7633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry setAttributeGroup->addChild(pixmapGroup); 7643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7653c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::FilterList baseFilters; 7663c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos baseFilters << surfaceType<EGL_PIXMAP_BIT>; 7673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7683c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos std::vector<NamedFilterList> filterLists; 7693c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos getDefaultFilterLists(filterLists, baseFilters); 7703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7713c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++) 7723c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos pixmapGroup->addChild(new SurfaceAttribPixmapCase(m_eglTestCtx, i->getName(), i->getDescription(), *i)); 7733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Pbuffer 7763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 7773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* pbufferGroup = new tcu::TestCaseGroup(m_testCtx, "pbuffer", "Pbuffer surfaces"); 7783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry setAttributeGroup->addChild(pbufferGroup); 7793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7803c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos eglu::FilterList baseFilters; 7813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos baseFilters << surfaceType<EGL_PBUFFER_BIT>; 7823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7833c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos std::vector<NamedFilterList> filterLists; 7843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos getDefaultFilterLists(filterLists, baseFilters); 7853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7863c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++) 7873c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos pbufferGroup->addChild(new SurfaceAttribPbufferCase(m_eglTestCtx, i->getName(), i->getDescription(), *i)); 7883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 7903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // egl 7933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 794