1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief EGL tests
22 *//*--------------------------------------------------------------------*/
23
24 #include "teglConfigList.hpp"
25 #include "tcuEgl.hpp"
26 #include "tcuTestLog.hpp"
27 #include "egluStrUtil.hpp"
28 #include "deStringUtil.hpp"
29
30 #include <vector>
31
32 using std::vector;
33
34 namespace deqp
35 {
36 namespace egl
37 {
38
ConfigList(EglTestContext & eglTestCtx)39 ConfigList::ConfigList (EglTestContext& eglTestCtx)
40 : TestCase(eglTestCtx, "configs", "Output the list of configs from EGL")
41
42 {
43 }
44
~ConfigList(void)45 ConfigList::~ConfigList (void)
46 {
47 }
48
init(void)49 void ConfigList::init (void)
50 {
51 }
52
deinit(void)53 void ConfigList::deinit (void)
54 {
55 }
56
iterate(void)57 tcu::TestNode::IterateResult ConfigList::iterate (void)
58 {
59 tcu::TestLog& log = m_testCtx.getLog();
60 EGLDisplay display = m_eglTestCtx.getDisplay().getEGLDisplay();
61 vector<EGLConfig> configs;
62
63 // \todo [2011-03-23 pyry] Check error codes!
64
65 // \todo [kalle 10/08/2010] Get EGL version.
66
67 m_eglTestCtx.getDisplay().getConfigs(configs);
68
69 log.startEglConfigSet("EGL-configs", "List of all EGL configs");
70
71 // \todo [kalle 10/08/2010] Add validity checks for the values?
72 // \todo [kalle 10/08/2010] Adapt for different EGL versions
73
74 for (int i = 0; i < (int)configs.size(); i++)
75 {
76 qpEglConfigInfo info;
77 EGLint val = 0;
78
79 eglGetConfigAttrib(display, configs[i], EGL_BUFFER_SIZE, &val);
80 info.bufferSize = val;
81
82 eglGetConfigAttrib(display, configs[i], EGL_RED_SIZE, &val);
83 info.redSize = val;
84
85 eglGetConfigAttrib(display, configs[i], EGL_GREEN_SIZE, &val);
86 info.greenSize = val;
87
88 eglGetConfigAttrib(display, configs[i], EGL_BLUE_SIZE, &val);
89 info.blueSize = val;
90
91 eglGetConfigAttrib(display, configs[i], EGL_LUMINANCE_SIZE, &val);
92 info.luminanceSize = val;
93
94 eglGetConfigAttrib(display, configs[i], EGL_ALPHA_SIZE, &val);
95 info.alphaSize = val;
96
97 eglGetConfigAttrib(display, configs[i], EGL_ALPHA_MASK_SIZE, &val);
98 info.alphaMaskSize = val;
99
100 eglGetConfigAttrib(display, configs[i], EGL_BIND_TO_TEXTURE_RGB, &val);
101 info.bindToTextureRGB = val == EGL_TRUE ? DE_TRUE : DE_FALSE;
102
103 eglGetConfigAttrib(display, configs[i], EGL_BIND_TO_TEXTURE_RGBA, &val);
104 info.bindToTextureRGBA = val == EGL_TRUE ? DE_TRUE : DE_FALSE;
105
106 eglGetConfigAttrib(display, configs[i], EGL_COLOR_BUFFER_TYPE, &val);
107 std::string colorBufferType = de::toString(eglu::getColorBufferTypeStr(val));
108 info.colorBufferType = colorBufferType.c_str();
109
110 eglGetConfigAttrib(display, configs[i], EGL_CONFIG_CAVEAT, &val);
111 std::string caveat = de::toString(eglu::getConfigCaveatStr(val));
112 info.configCaveat = caveat.c_str();
113
114 eglGetConfigAttrib(display, configs[i], EGL_CONFIG_ID, &val);
115 info.configID = val;
116
117 eglGetConfigAttrib(display, configs[i], EGL_CONFORMANT, &val);
118 std::string conformant = de::toString(eglu::getAPIBitsStr(val));
119 info.conformant = conformant.c_str();
120
121 eglGetConfigAttrib(display, configs[i], EGL_DEPTH_SIZE, &val);
122 info.depthSize = val;
123
124 eglGetConfigAttrib(display, configs[i], EGL_LEVEL, &val);
125 info.level = val;
126
127 eglGetConfigAttrib(display, configs[i], EGL_MAX_PBUFFER_WIDTH, &val);
128 info.maxPBufferWidth = val;
129
130 eglGetConfigAttrib(display, configs[i], EGL_MAX_PBUFFER_HEIGHT, &val);
131 info.maxPBufferHeight = val;
132
133 eglGetConfigAttrib(display, configs[i], EGL_MAX_PBUFFER_PIXELS, &val);
134 info.maxPBufferPixels = val;
135
136 eglGetConfigAttrib(display, configs[i], EGL_MAX_SWAP_INTERVAL, &val);
137 info.maxSwapInterval = val;
138
139 eglGetConfigAttrib(display, configs[i], EGL_MIN_SWAP_INTERVAL, &val);
140 info.minSwapInterval = val;
141
142 eglGetConfigAttrib(display, configs[i], EGL_NATIVE_RENDERABLE, &val);
143 info.nativeRenderable = val == EGL_TRUE ? DE_TRUE : DE_FALSE;
144
145 eglGetConfigAttrib(display, configs[i], EGL_RENDERABLE_TYPE, &val);
146 std::string renderableTypes = de::toString(eglu::getAPIBitsStr(val));
147 info.renderableType = renderableTypes.c_str();
148
149 eglGetConfigAttrib(display, configs[i], EGL_SAMPLE_BUFFERS, &val);
150 info.sampleBuffers = val;
151
152 eglGetConfigAttrib(display, configs[i], EGL_SAMPLES, &val);
153 info.samples = val;
154
155 eglGetConfigAttrib(display, configs[i], EGL_STENCIL_SIZE, &val);
156 info.stencilSize = val;
157
158 eglGetConfigAttrib(display, configs[i], EGL_SURFACE_TYPE, &val);
159 std::string surfaceTypes = de::toString(eglu::getSurfaceBitsStr(val));
160 info.surfaceTypes = surfaceTypes.c_str();
161
162 eglGetConfigAttrib(display, configs[i], EGL_TRANSPARENT_TYPE, &val);
163 std::string transparentType = de::toString(eglu::getTransparentTypeStr(val));
164 info.transparentType = transparentType.c_str();
165
166 eglGetConfigAttrib(display, configs[i], EGL_TRANSPARENT_RED_VALUE, &val);
167 info.transparentRedValue = val;
168
169 eglGetConfigAttrib(display, configs[i], EGL_TRANSPARENT_GREEN_VALUE, &val);
170 info.transparentGreenValue = val;
171
172 eglGetConfigAttrib(display, configs[i], EGL_TRANSPARENT_BLUE_VALUE, &val);
173 info.transparentBlueValue = val;
174
175 log.writeEglConfig(&info);
176 }
177 log.endEglConfigSet();
178
179 getTestContext().setTestResult(QP_TEST_RESULT_PASS, "");
180
181 return TestNode::STOP;
182 }
183
184 } // egl
185 } // deqp
186