1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 *//*--------------------------------------------------------------------*/
24 #include "teglConfigList.hpp"
25 #include "tcuTestLog.hpp"
26 #include "egluStrUtil.hpp"
27 #include "egluUtil.hpp"
28 #include "eglwLibrary.hpp"
29 #include "eglwEnums.hpp"
30 #include "deStringUtil.hpp"
42 ConfigList::ConfigList (EglTestContext& eglTestCtx)
43 : TestCase(eglTestCtx, "configs", "Output the list of configs from EGL")
48 ConfigList::~ConfigList (void)
52 void ConfigList::init (void)
56 void ConfigList::deinit (void)
60 tcu::TestNode::IterateResult ConfigList::iterate (void)
62 const Library& egl = m_eglTestCtx.getLibrary();
63 tcu::TestLog& log = m_testCtx.getLog();
64 EGLDisplay display = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
65 vector<EGLConfig> configs = eglu::getConfigs(egl, display);
67 // \todo [2011-03-23 pyry] Check error codes!
69 // \todo [kalle 10/08/2010] Get EGL version.
71 log.startEglConfigSet("EGL-configs", "List of all EGL configs");
73 // \todo [kalle 10/08/2010] Add validity checks for the values?
74 // \todo [kalle 10/08/2010] Adapt for different EGL versions
76 for (int i = 0; i < (int)configs.size(); i++)
81 egl.getConfigAttrib(display, configs[i], EGL_BUFFER_SIZE, &val);
82 info.bufferSize = val;
84 egl.getConfigAttrib(display, configs[i], EGL_RED_SIZE, &val);
87 egl.getConfigAttrib(display, configs[i], EGL_GREEN_SIZE, &val);
90 egl.getConfigAttrib(display, configs[i], EGL_BLUE_SIZE, &val);
93 egl.getConfigAttrib(display, configs[i], EGL_LUMINANCE_SIZE, &val);
94 info.luminanceSize = val;
96 egl.getConfigAttrib(display, configs[i], EGL_ALPHA_SIZE, &val);
99 egl.getConfigAttrib(display, configs[i], EGL_ALPHA_MASK_SIZE, &val);
100 info.alphaMaskSize = val;
102 egl.getConfigAttrib(display, configs[i], EGL_BIND_TO_TEXTURE_RGB, &val);
103 info.bindToTextureRGB = val == EGL_TRUE ? DE_TRUE : DE_FALSE;
105 egl.getConfigAttrib(display, configs[i], EGL_BIND_TO_TEXTURE_RGBA, &val);
106 info.bindToTextureRGBA = val == EGL_TRUE ? DE_TRUE : DE_FALSE;
108 egl.getConfigAttrib(display, configs[i], EGL_COLOR_BUFFER_TYPE, &val);
109 std::string colorBufferType = de::toString(eglu::getColorBufferTypeStr(val));
110 info.colorBufferType = colorBufferType.c_str();
112 egl.getConfigAttrib(display, configs[i], EGL_CONFIG_CAVEAT, &val);
113 std::string caveat = de::toString(eglu::getConfigCaveatStr(val));
114 info.configCaveat = caveat.c_str();
116 egl.getConfigAttrib(display, configs[i], EGL_CONFIG_ID, &val);
119 egl.getConfigAttrib(display, configs[i], EGL_CONFORMANT, &val);
120 std::string conformant = de::toString(eglu::getAPIBitsStr(val));
121 info.conformant = conformant.c_str();
123 egl.getConfigAttrib(display, configs[i], EGL_DEPTH_SIZE, &val);
124 info.depthSize = val;
126 egl.getConfigAttrib(display, configs[i], EGL_LEVEL, &val);
129 egl.getConfigAttrib(display, configs[i], EGL_MAX_PBUFFER_WIDTH, &val);
130 info.maxPBufferWidth = val;
132 egl.getConfigAttrib(display, configs[i], EGL_MAX_PBUFFER_HEIGHT, &val);
133 info.maxPBufferHeight = val;
135 egl.getConfigAttrib(display, configs[i], EGL_MAX_PBUFFER_PIXELS, &val);
136 info.maxPBufferPixels = val;
138 egl.getConfigAttrib(display, configs[i], EGL_MAX_SWAP_INTERVAL, &val);
139 info.maxSwapInterval = val;
141 egl.getConfigAttrib(display, configs[i], EGL_MIN_SWAP_INTERVAL, &val);
142 info.minSwapInterval = val;
144 egl.getConfigAttrib(display, configs[i], EGL_NATIVE_RENDERABLE, &val);
145 info.nativeRenderable = val == EGL_TRUE ? DE_TRUE : DE_FALSE;
147 egl.getConfigAttrib(display, configs[i], EGL_RENDERABLE_TYPE, &val);
148 std::string renderableTypes = de::toString(eglu::getAPIBitsStr(val));
149 info.renderableType = renderableTypes.c_str();
151 egl.getConfigAttrib(display, configs[i], EGL_SAMPLE_BUFFERS, &val);
152 info.sampleBuffers = val;
154 egl.getConfigAttrib(display, configs[i], EGL_SAMPLES, &val);
157 egl.getConfigAttrib(display, configs[i], EGL_STENCIL_SIZE, &val);
158 info.stencilSize = val;
160 egl.getConfigAttrib(display, configs[i], EGL_SURFACE_TYPE, &val);
161 std::string surfaceTypes = de::toString(eglu::getSurfaceBitsStr(val));
162 info.surfaceTypes = surfaceTypes.c_str();
164 egl.getConfigAttrib(display, configs[i], EGL_TRANSPARENT_TYPE, &val);
165 std::string transparentType = de::toString(eglu::getTransparentTypeStr(val));
166 info.transparentType = transparentType.c_str();
168 egl.getConfigAttrib(display, configs[i], EGL_TRANSPARENT_RED_VALUE, &val);
169 info.transparentRedValue = val;
171 egl.getConfigAttrib(display, configs[i], EGL_TRANSPARENT_GREEN_VALUE, &val);
172 info.transparentGreenValue = val;
174 egl.getConfigAttrib(display, configs[i], EGL_TRANSPARENT_BLUE_VALUE, &val);
175 info.transparentBlueValue = val;
177 log.writeEglConfig(&info);
179 log.endEglConfigSet();
181 egl.terminate(display);
183 getTestContext().setTestResult(QP_TEST_RESULT_PASS, "");
185 return TestNode::STOP;