xref: /aosp_15_r20/external/deqp/modules/egl/teglQuerySurfaceTests.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker  * drawElements Quality Program EGL Module
3*35238bceSAndroid Build Coastguard Worker  * ---------------------------------------
4*35238bceSAndroid Build Coastguard Worker  *
5*35238bceSAndroid Build Coastguard Worker  * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker  *
7*35238bceSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker  *
11*35238bceSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker  *
13*35238bceSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker  * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker  *
19*35238bceSAndroid Build Coastguard Worker  *//*!
20*35238bceSAndroid Build Coastguard Worker  * \file
21*35238bceSAndroid Build Coastguard Worker  * \brief Surface query tests.
22*35238bceSAndroid Build Coastguard Worker  *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker 
24*35238bceSAndroid Build Coastguard Worker #include "teglQuerySurfaceTests.hpp"
25*35238bceSAndroid Build Coastguard Worker 
26*35238bceSAndroid Build Coastguard Worker #include "teglSimpleConfigCase.hpp"
27*35238bceSAndroid Build Coastguard Worker 
28*35238bceSAndroid Build Coastguard Worker #include "egluNativeDisplay.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "egluNativeWindow.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "egluNativePixmap.hpp"
31*35238bceSAndroid Build Coastguard Worker #include "egluStrUtil.hpp"
32*35238bceSAndroid Build Coastguard Worker #include "egluUtil.hpp"
33*35238bceSAndroid Build Coastguard Worker #include "egluUnique.hpp"
34*35238bceSAndroid Build Coastguard Worker 
35*35238bceSAndroid Build Coastguard Worker #include "eglwLibrary.hpp"
36*35238bceSAndroid Build Coastguard Worker #include "eglwEnums.hpp"
37*35238bceSAndroid Build Coastguard Worker 
38*35238bceSAndroid Build Coastguard Worker #include "tcuTestLog.hpp"
39*35238bceSAndroid Build Coastguard Worker #include "tcuTestContext.hpp"
40*35238bceSAndroid Build Coastguard Worker #include "tcuCommandLine.hpp"
41*35238bceSAndroid Build Coastguard Worker 
42*35238bceSAndroid Build Coastguard Worker #include "deUniquePtr.hpp"
43*35238bceSAndroid Build Coastguard Worker 
44*35238bceSAndroid Build Coastguard Worker #include <string>
45*35238bceSAndroid Build Coastguard Worker #include <vector>
46*35238bceSAndroid Build Coastguard Worker 
47*35238bceSAndroid Build Coastguard Worker namespace deqp
48*35238bceSAndroid Build Coastguard Worker {
49*35238bceSAndroid Build Coastguard Worker namespace egl
50*35238bceSAndroid Build Coastguard Worker {
51*35238bceSAndroid Build Coastguard Worker 
52*35238bceSAndroid Build Coastguard Worker using eglu::ConfigInfo;
53*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
54*35238bceSAndroid Build Coastguard Worker using namespace eglw;
55*35238bceSAndroid Build Coastguard Worker 
logSurfaceAttribute(tcu::TestLog & log,EGLint attribute,EGLint value)56*35238bceSAndroid Build Coastguard Worker static void logSurfaceAttribute(tcu::TestLog &log, EGLint attribute, EGLint value)
57*35238bceSAndroid Build Coastguard Worker {
58*35238bceSAndroid Build Coastguard Worker     const char *name = eglu::getSurfaceAttribName(attribute);
59*35238bceSAndroid Build Coastguard Worker     const eglu::SurfaceAttribValueFmt valueFmt(attribute, value);
60*35238bceSAndroid Build Coastguard Worker 
61*35238bceSAndroid Build Coastguard Worker     log << TestLog::Message << "  " << name << ": " << valueFmt << TestLog::EndMessage;
62*35238bceSAndroid Build Coastguard Worker }
63*35238bceSAndroid Build Coastguard Worker 
logSurfaceAttributes(tcu::TestLog & log,const Library & egl,EGLDisplay display,EGLSurface surface,const EGLint * attributes,int numAttribs)64*35238bceSAndroid Build Coastguard Worker static void logSurfaceAttributes(tcu::TestLog &log, const Library &egl, EGLDisplay display, EGLSurface surface,
65*35238bceSAndroid Build Coastguard Worker                                  const EGLint *attributes, int numAttribs)
66*35238bceSAndroid Build Coastguard Worker {
67*35238bceSAndroid Build Coastguard Worker     for (int ndx = 0; ndx < numAttribs; ndx++)
68*35238bceSAndroid Build Coastguard Worker         logSurfaceAttribute(log, attributes[ndx], eglu::querySurfaceInt(egl, display, surface, attributes[ndx]));
69*35238bceSAndroid Build Coastguard Worker }
70*35238bceSAndroid Build Coastguard Worker 
logCommonSurfaceAttributes(tcu::TestLog & log,const Library & egl,EGLDisplay display,EGLSurface surface)71*35238bceSAndroid Build Coastguard Worker static void logCommonSurfaceAttributes(tcu::TestLog &log, const Library &egl, EGLDisplay display, EGLSurface surface)
72*35238bceSAndroid Build Coastguard Worker {
73*35238bceSAndroid Build Coastguard Worker     static const EGLint attributes[] = {EGL_CONFIG_ID,
74*35238bceSAndroid Build Coastguard Worker                                         EGL_WIDTH,
75*35238bceSAndroid Build Coastguard Worker                                         EGL_HEIGHT,
76*35238bceSAndroid Build Coastguard Worker                                         EGL_HORIZONTAL_RESOLUTION,
77*35238bceSAndroid Build Coastguard Worker                                         EGL_VERTICAL_RESOLUTION,
78*35238bceSAndroid Build Coastguard Worker                                         EGL_MULTISAMPLE_RESOLVE,
79*35238bceSAndroid Build Coastguard Worker                                         EGL_PIXEL_ASPECT_RATIO,
80*35238bceSAndroid Build Coastguard Worker                                         EGL_RENDER_BUFFER,
81*35238bceSAndroid Build Coastguard Worker                                         EGL_SWAP_BEHAVIOR,
82*35238bceSAndroid Build Coastguard Worker                                         EGL_ALPHA_FORMAT,
83*35238bceSAndroid Build Coastguard Worker                                         EGL_COLORSPACE};
84*35238bceSAndroid Build Coastguard Worker 
85*35238bceSAndroid Build Coastguard Worker     logSurfaceAttributes(log, egl, display, surface, attributes, DE_LENGTH_OF_ARRAY(attributes));
86*35238bceSAndroid Build Coastguard Worker }
87*35238bceSAndroid Build Coastguard Worker 
logPbufferSurfaceAttributes(tcu::TestLog & log,const Library & egl,EGLDisplay display,EGLSurface surface)88*35238bceSAndroid Build Coastguard Worker static void logPbufferSurfaceAttributes(tcu::TestLog &log, const Library &egl, EGLDisplay display, EGLSurface surface)
89*35238bceSAndroid Build Coastguard Worker {
90*35238bceSAndroid Build Coastguard Worker     static const EGLint attributes[] = {
91*35238bceSAndroid Build Coastguard Worker         EGL_LARGEST_PBUFFER, EGL_TEXTURE_FORMAT, EGL_TEXTURE_TARGET, EGL_MIPMAP_TEXTURE, EGL_MIPMAP_LEVEL,
92*35238bceSAndroid Build Coastguard Worker     };
93*35238bceSAndroid Build Coastguard Worker 
94*35238bceSAndroid Build Coastguard Worker     logSurfaceAttributes(log, egl, display, surface, attributes, DE_LENGTH_OF_ARRAY(attributes));
95*35238bceSAndroid Build Coastguard Worker }
96*35238bceSAndroid Build Coastguard Worker 
97*35238bceSAndroid Build Coastguard Worker class QuerySurfaceCase : public SimpleConfigCase
98*35238bceSAndroid Build Coastguard Worker {
99*35238bceSAndroid Build Coastguard Worker public:
100*35238bceSAndroid Build Coastguard Worker     QuerySurfaceCase(EglTestContext &eglTestCtx, const char *name, const char *description,
101*35238bceSAndroid Build Coastguard Worker                      const eglu::FilterList &filters);
102*35238bceSAndroid Build Coastguard Worker 
103*35238bceSAndroid Build Coastguard Worker     void checkCommonAttributes(EGLDisplay display, EGLSurface surface, const ConfigInfo &info);
104*35238bceSAndroid Build Coastguard Worker     void checkNonPbufferAttributes(EGLDisplay display, EGLSurface surface);
105*35238bceSAndroid Build Coastguard Worker };
106*35238bceSAndroid Build Coastguard Worker 
QuerySurfaceCase(EglTestContext & eglTestCtx,const char * name,const char * description,const eglu::FilterList & filters)107*35238bceSAndroid Build Coastguard Worker QuerySurfaceCase::QuerySurfaceCase(EglTestContext &eglTestCtx, const char *name, const char *description,
108*35238bceSAndroid Build Coastguard Worker                                    const eglu::FilterList &filters)
109*35238bceSAndroid Build Coastguard Worker     : SimpleConfigCase(eglTestCtx, name, description, filters)
110*35238bceSAndroid Build Coastguard Worker {
111*35238bceSAndroid Build Coastguard Worker }
112*35238bceSAndroid Build Coastguard Worker 
checkCommonAttributes(EGLDisplay display,EGLSurface surface,const ConfigInfo & info)113*35238bceSAndroid Build Coastguard Worker void QuerySurfaceCase::checkCommonAttributes(EGLDisplay display, EGLSurface surface, const ConfigInfo &info)
114*35238bceSAndroid Build Coastguard Worker {
115*35238bceSAndroid Build Coastguard Worker     const Library &egl = m_eglTestCtx.getLibrary();
116*35238bceSAndroid Build Coastguard Worker     tcu::TestLog &log  = m_testCtx.getLog();
117*35238bceSAndroid Build Coastguard Worker 
118*35238bceSAndroid Build Coastguard Worker     // Attributes which are common to all surface types
119*35238bceSAndroid Build Coastguard Worker 
120*35238bceSAndroid Build Coastguard Worker     // Config ID
121*35238bceSAndroid Build Coastguard Worker     {
122*35238bceSAndroid Build Coastguard Worker         const EGLint id = eglu::querySurfaceInt(egl, display, surface, EGL_CONFIG_ID);
123*35238bceSAndroid Build Coastguard Worker 
124*35238bceSAndroid Build Coastguard Worker         if (id != info.configId)
125*35238bceSAndroid Build Coastguard Worker         {
126*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, config ID " << id
127*35238bceSAndroid Build Coastguard Worker                 << " does not match the one used to create the surface" << TestLog::EndMessage;
128*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Config ID mismatch");
129*35238bceSAndroid Build Coastguard Worker         }
130*35238bceSAndroid Build Coastguard Worker     }
131*35238bceSAndroid Build Coastguard Worker 
132*35238bceSAndroid Build Coastguard Worker     // Width and height
133*35238bceSAndroid Build Coastguard Worker     {
134*35238bceSAndroid Build Coastguard Worker         const EGLint width  = eglu::querySurfaceInt(egl, display, surface, EGL_WIDTH);
135*35238bceSAndroid Build Coastguard Worker         const EGLint height = eglu::querySurfaceInt(egl, display, surface, EGL_HEIGHT);
136*35238bceSAndroid Build Coastguard Worker 
137*35238bceSAndroid Build Coastguard Worker         if (width <= 0 || height <= 0)
138*35238bceSAndroid Build Coastguard Worker         {
139*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, invalid surface size " << width << "x" << height
140*35238bceSAndroid Build Coastguard Worker                 << TestLog::EndMessage;
141*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid surface size");
142*35238bceSAndroid Build Coastguard Worker         }
143*35238bceSAndroid Build Coastguard Worker     }
144*35238bceSAndroid Build Coastguard Worker 
145*35238bceSAndroid Build Coastguard Worker     // Horizontal and vertical resolution
146*35238bceSAndroid Build Coastguard Worker     {
147*35238bceSAndroid Build Coastguard Worker         const EGLint hRes = eglu::querySurfaceInt(egl, display, surface, EGL_HORIZONTAL_RESOLUTION);
148*35238bceSAndroid Build Coastguard Worker         const EGLint vRes = eglu::querySurfaceInt(egl, display, surface, EGL_VERTICAL_RESOLUTION);
149*35238bceSAndroid Build Coastguard Worker 
150*35238bceSAndroid Build Coastguard Worker         if ((hRes <= 0 || vRes <= 0) && (hRes != EGL_UNKNOWN && vRes != EGL_UNKNOWN))
151*35238bceSAndroid Build Coastguard Worker         {
152*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, invalid surface resolution " << hRes << "x" << vRes
153*35238bceSAndroid Build Coastguard Worker                 << TestLog::EndMessage;
154*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid surface resolution");
155*35238bceSAndroid Build Coastguard Worker         }
156*35238bceSAndroid Build Coastguard Worker     }
157*35238bceSAndroid Build Coastguard Worker 
158*35238bceSAndroid Build Coastguard Worker     // Pixel aspect ratio
159*35238bceSAndroid Build Coastguard Worker     {
160*35238bceSAndroid Build Coastguard Worker         const EGLint pixelRatio = eglu::querySurfaceInt(egl, display, surface, EGL_PIXEL_ASPECT_RATIO);
161*35238bceSAndroid Build Coastguard Worker 
162*35238bceSAndroid Build Coastguard Worker         if (pixelRatio <= 0 && pixelRatio != EGL_UNKNOWN)
163*35238bceSAndroid Build Coastguard Worker         {
164*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, invalid pixel aspect ratio "
165*35238bceSAndroid Build Coastguard Worker                 << eglu::querySurfaceInt(egl, display, surface, EGL_PIXEL_ASPECT_RATIO) << TestLog::EndMessage;
166*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid pixel aspect ratio");
167*35238bceSAndroid Build Coastguard Worker         }
168*35238bceSAndroid Build Coastguard Worker     }
169*35238bceSAndroid Build Coastguard Worker 
170*35238bceSAndroid Build Coastguard Worker     // Render buffer
171*35238bceSAndroid Build Coastguard Worker     {
172*35238bceSAndroid Build Coastguard Worker         const EGLint renderBuffer = eglu::querySurfaceInt(egl, display, surface, EGL_RENDER_BUFFER);
173*35238bceSAndroid Build Coastguard Worker 
174*35238bceSAndroid Build Coastguard Worker         if (renderBuffer != EGL_BACK_BUFFER && renderBuffer != EGL_SINGLE_BUFFER)
175*35238bceSAndroid Build Coastguard Worker         {
176*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, invalid render buffer value " << renderBuffer << TestLog::EndMessage;
177*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid render buffer");
178*35238bceSAndroid Build Coastguard Worker         }
179*35238bceSAndroid Build Coastguard Worker     }
180*35238bceSAndroid Build Coastguard Worker 
181*35238bceSAndroid Build Coastguard Worker     // Multisample resolve
182*35238bceSAndroid Build Coastguard Worker     {
183*35238bceSAndroid Build Coastguard Worker         const EGLint multisampleResolve = eglu::querySurfaceInt(egl, display, surface, EGL_MULTISAMPLE_RESOLVE);
184*35238bceSAndroid Build Coastguard Worker 
185*35238bceSAndroid Build Coastguard Worker         if (multisampleResolve != EGL_MULTISAMPLE_RESOLVE_DEFAULT && multisampleResolve != EGL_MULTISAMPLE_RESOLVE_BOX)
186*35238bceSAndroid Build Coastguard Worker         {
187*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, invalid multisample resolve value " << multisampleResolve
188*35238bceSAndroid Build Coastguard Worker                 << TestLog::EndMessage;
189*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid multisample resolve");
190*35238bceSAndroid Build Coastguard Worker         }
191*35238bceSAndroid Build Coastguard Worker 
192*35238bceSAndroid Build Coastguard Worker         if (multisampleResolve == EGL_MULTISAMPLE_RESOLVE_BOX && !(info.surfaceType & EGL_MULTISAMPLE_RESOLVE_BOX_BIT))
193*35238bceSAndroid Build Coastguard Worker         {
194*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message
195*35238bceSAndroid Build Coastguard Worker                 << "    Fail, multisample resolve is reported as box filter but configuration does not support it."
196*35238bceSAndroid Build Coastguard Worker                 << TestLog::EndMessage;
197*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid multisample resolve");
198*35238bceSAndroid Build Coastguard Worker         }
199*35238bceSAndroid Build Coastguard Worker     }
200*35238bceSAndroid Build Coastguard Worker 
201*35238bceSAndroid Build Coastguard Worker     // Swap behavior
202*35238bceSAndroid Build Coastguard Worker     {
203*35238bceSAndroid Build Coastguard Worker         const EGLint swapBehavior = eglu::querySurfaceInt(egl, display, surface, EGL_SWAP_BEHAVIOR);
204*35238bceSAndroid Build Coastguard Worker 
205*35238bceSAndroid Build Coastguard Worker         if (swapBehavior != EGL_BUFFER_DESTROYED && swapBehavior != EGL_BUFFER_PRESERVED)
206*35238bceSAndroid Build Coastguard Worker         {
207*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, invalid swap behavior value " << swapBehavior << TestLog::EndMessage;
208*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid swap behavior");
209*35238bceSAndroid Build Coastguard Worker         }
210*35238bceSAndroid Build Coastguard Worker 
211*35238bceSAndroid Build Coastguard Worker         if (swapBehavior == EGL_BUFFER_PRESERVED && !(info.surfaceType & EGL_SWAP_BEHAVIOR_PRESERVED_BIT))
212*35238bceSAndroid Build Coastguard Worker         {
213*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message
214*35238bceSAndroid Build Coastguard Worker                 << "    Fail, swap behavior is reported as preserve but configuration does not support it."
215*35238bceSAndroid Build Coastguard Worker                 << TestLog::EndMessage;
216*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid swap behavior");
217*35238bceSAndroid Build Coastguard Worker         }
218*35238bceSAndroid Build Coastguard Worker     }
219*35238bceSAndroid Build Coastguard Worker 
220*35238bceSAndroid Build Coastguard Worker     // alpha format
221*35238bceSAndroid Build Coastguard Worker     {
222*35238bceSAndroid Build Coastguard Worker         const EGLint alphaFormat = eglu::querySurfaceInt(egl, display, surface, EGL_ALPHA_FORMAT);
223*35238bceSAndroid Build Coastguard Worker 
224*35238bceSAndroid Build Coastguard Worker         if (alphaFormat != EGL_ALPHA_FORMAT_NONPRE && alphaFormat != EGL_ALPHA_FORMAT_PRE)
225*35238bceSAndroid Build Coastguard Worker         {
226*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, invalid alpha format value " << alphaFormat << TestLog::EndMessage;
227*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid alpha format");
228*35238bceSAndroid Build Coastguard Worker         }
229*35238bceSAndroid Build Coastguard Worker 
230*35238bceSAndroid Build Coastguard Worker         if (alphaFormat == EGL_ALPHA_FORMAT_PRE && !(info.surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT))
231*35238bceSAndroid Build Coastguard Worker         {
232*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message
233*35238bceSAndroid Build Coastguard Worker                 << "    Fail, is set to use premultiplied alpha but configuration does not support it."
234*35238bceSAndroid Build Coastguard Worker                 << TestLog::EndMessage;
235*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid alpha format");
236*35238bceSAndroid Build Coastguard Worker         }
237*35238bceSAndroid Build Coastguard Worker     }
238*35238bceSAndroid Build Coastguard Worker 
239*35238bceSAndroid Build Coastguard Worker     // color space
240*35238bceSAndroid Build Coastguard Worker     {
241*35238bceSAndroid Build Coastguard Worker         const EGLint colorspace = eglu::querySurfaceInt(egl, display, surface, EGL_COLORSPACE);
242*35238bceSAndroid Build Coastguard Worker 
243*35238bceSAndroid Build Coastguard Worker         if (colorspace != EGL_VG_COLORSPACE_sRGB && colorspace != EGL_VG_COLORSPACE_LINEAR)
244*35238bceSAndroid Build Coastguard Worker         {
245*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, invalid color space value " << colorspace << TestLog::EndMessage;
246*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid color space");
247*35238bceSAndroid Build Coastguard Worker         }
248*35238bceSAndroid Build Coastguard Worker 
249*35238bceSAndroid Build Coastguard Worker         if (colorspace == EGL_VG_COLORSPACE_LINEAR && !(info.surfaceType & EGL_VG_COLORSPACE_LINEAR_BIT))
250*35238bceSAndroid Build Coastguard Worker         {
251*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message
252*35238bceSAndroid Build Coastguard Worker                 << "    Fail, is set to use a linear color space but configuration does not support it."
253*35238bceSAndroid Build Coastguard Worker                 << TestLog::EndMessage;
254*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid color space");
255*35238bceSAndroid Build Coastguard Worker         }
256*35238bceSAndroid Build Coastguard Worker     }
257*35238bceSAndroid Build Coastguard Worker }
258*35238bceSAndroid Build Coastguard Worker 
checkNonPbufferAttributes(EGLDisplay display,EGLSurface surface)259*35238bceSAndroid Build Coastguard Worker void QuerySurfaceCase::checkNonPbufferAttributes(EGLDisplay display, EGLSurface surface)
260*35238bceSAndroid Build Coastguard Worker {
261*35238bceSAndroid Build Coastguard Worker     const Library &egl                   = m_eglTestCtx.getLibrary();
262*35238bceSAndroid Build Coastguard Worker     const EGLint uninitializedMagicValue = -42;
263*35238bceSAndroid Build Coastguard Worker     tcu::TestLog &log                    = m_testCtx.getLog();
264*35238bceSAndroid Build Coastguard Worker     EGLint value                         = uninitializedMagicValue;
265*35238bceSAndroid Build Coastguard Worker 
266*35238bceSAndroid Build Coastguard Worker     static const EGLint pbufferAttribs[] = {
267*35238bceSAndroid Build Coastguard Worker         EGL_LARGEST_PBUFFER, EGL_TEXTURE_FORMAT, EGL_TEXTURE_TARGET, EGL_MIPMAP_TEXTURE, EGL_MIPMAP_LEVEL,
268*35238bceSAndroid Build Coastguard Worker     };
269*35238bceSAndroid Build Coastguard Worker 
270*35238bceSAndroid Build Coastguard Worker     for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(pbufferAttribs); ndx++)
271*35238bceSAndroid Build Coastguard Worker     {
272*35238bceSAndroid Build Coastguard Worker         const EGLint attribute = pbufferAttribs[ndx];
273*35238bceSAndroid Build Coastguard Worker         const std::string name = eglu::getSurfaceAttribName(pbufferAttribs[ndx]);
274*35238bceSAndroid Build Coastguard Worker 
275*35238bceSAndroid Build Coastguard Worker         egl.querySurface(display, surface, attribute, &value);
276*35238bceSAndroid Build Coastguard Worker 
277*35238bceSAndroid Build Coastguard Worker         {
278*35238bceSAndroid Build Coastguard Worker             const EGLint error = egl.getError();
279*35238bceSAndroid Build Coastguard Worker 
280*35238bceSAndroid Build Coastguard Worker             if (error != EGL_SUCCESS)
281*35238bceSAndroid Build Coastguard Worker             {
282*35238bceSAndroid Build Coastguard Worker                 log << TestLog::Message << "    Fail, querying " << name
283*35238bceSAndroid Build Coastguard Worker                     << " from a non-pbuffer surface should not result in an error, received "
284*35238bceSAndroid Build Coastguard Worker                     << eglu::getErrorStr(error) << TestLog::EndMessage;
285*35238bceSAndroid Build Coastguard Worker                 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Illegal error condition");
286*35238bceSAndroid Build Coastguard Worker                 break;
287*35238bceSAndroid Build Coastguard Worker             }
288*35238bceSAndroid Build Coastguard Worker         }
289*35238bceSAndroid Build Coastguard Worker 
290*35238bceSAndroid Build Coastguard Worker         // "For a window or pixmap surface, the contents of value are not modified."
291*35238bceSAndroid Build Coastguard Worker         if (value != uninitializedMagicValue)
292*35238bceSAndroid Build Coastguard Worker         {
293*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, return value contents were modified when querying " << name
294*35238bceSAndroid Build Coastguard Worker                 << " from a non-pbuffer surface." << TestLog::EndMessage;
295*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Illegal modification of return value");
296*35238bceSAndroid Build Coastguard Worker         }
297*35238bceSAndroid Build Coastguard Worker     }
298*35238bceSAndroid Build Coastguard Worker }
299*35238bceSAndroid Build Coastguard Worker 
300*35238bceSAndroid Build Coastguard Worker class QuerySurfaceSimpleWindowCase : public QuerySurfaceCase
301*35238bceSAndroid Build Coastguard Worker {
302*35238bceSAndroid Build Coastguard Worker public:
QuerySurfaceSimpleWindowCase(EglTestContext & eglTestCtx,const char * name,const char * description,const eglu::FilterList & filters)303*35238bceSAndroid Build Coastguard Worker     QuerySurfaceSimpleWindowCase(EglTestContext &eglTestCtx, const char *name, const char *description,
304*35238bceSAndroid Build Coastguard Worker                                  const eglu::FilterList &filters)
305*35238bceSAndroid Build Coastguard Worker         : QuerySurfaceCase(eglTestCtx, name, description, filters)
306*35238bceSAndroid Build Coastguard Worker     {
307*35238bceSAndroid Build Coastguard Worker     }
308*35238bceSAndroid Build Coastguard Worker 
executeForConfig(EGLDisplay display,EGLConfig config)309*35238bceSAndroid Build Coastguard Worker     void executeForConfig(EGLDisplay display, EGLConfig config)
310*35238bceSAndroid Build Coastguard Worker     {
311*35238bceSAndroid Build Coastguard Worker         const Library &egl = m_eglTestCtx.getLibrary();
312*35238bceSAndroid Build Coastguard Worker         tcu::TestLog &log  = m_testCtx.getLog();
313*35238bceSAndroid Build Coastguard Worker         const int width    = 64;
314*35238bceSAndroid Build Coastguard Worker         const int height   = 64;
315*35238bceSAndroid Build Coastguard Worker         const eglu::NativeWindowFactory &windowFactory =
316*35238bceSAndroid Build Coastguard Worker             eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
317*35238bceSAndroid Build Coastguard Worker         ConfigInfo info;
318*35238bceSAndroid Build Coastguard Worker 
319*35238bceSAndroid Build Coastguard Worker         eglu::queryCoreConfigInfo(egl, display, config, &info);
320*35238bceSAndroid Build Coastguard Worker 
321*35238bceSAndroid Build Coastguard Worker         log << TestLog::Message << "Creating window surface with config ID " << info.configId << TestLog::EndMessage;
322*35238bceSAndroid Build Coastguard Worker         EGLU_CHECK_MSG(egl, "before queries");
323*35238bceSAndroid Build Coastguard Worker 
324*35238bceSAndroid Build Coastguard Worker         de::UniquePtr<eglu::NativeWindow> window(windowFactory.createWindow(
325*35238bceSAndroid Build Coastguard Worker             &m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL,
326*35238bceSAndroid Build Coastguard Worker             eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
327*35238bceSAndroid Build Coastguard Worker         eglu::UniqueSurface surface(
328*35238bceSAndroid Build Coastguard Worker             egl, display,
329*35238bceSAndroid Build Coastguard Worker             eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, display, config, DE_NULL));
330*35238bceSAndroid Build Coastguard Worker 
331*35238bceSAndroid Build Coastguard Worker         logCommonSurfaceAttributes(log, egl, display, *surface);
332*35238bceSAndroid Build Coastguard Worker         checkCommonAttributes(display, *surface, info);
333*35238bceSAndroid Build Coastguard Worker         checkNonPbufferAttributes(display, *surface);
334*35238bceSAndroid Build Coastguard Worker     }
335*35238bceSAndroid Build Coastguard Worker };
336*35238bceSAndroid Build Coastguard Worker 
337*35238bceSAndroid Build Coastguard Worker class QuerySurfaceSimplePixmapCase : public QuerySurfaceCase
338*35238bceSAndroid Build Coastguard Worker {
339*35238bceSAndroid Build Coastguard Worker public:
QuerySurfaceSimplePixmapCase(EglTestContext & eglTestCtx,const char * name,const char * description,const eglu::FilterList & filters)340*35238bceSAndroid Build Coastguard Worker     QuerySurfaceSimplePixmapCase(EglTestContext &eglTestCtx, const char *name, const char *description,
341*35238bceSAndroid Build Coastguard Worker                                  const eglu::FilterList &filters)
342*35238bceSAndroid Build Coastguard Worker         : QuerySurfaceCase(eglTestCtx, name, description, filters)
343*35238bceSAndroid Build Coastguard Worker     {
344*35238bceSAndroid Build Coastguard Worker     }
345*35238bceSAndroid Build Coastguard Worker 
executeForConfig(EGLDisplay display,EGLConfig config)346*35238bceSAndroid Build Coastguard Worker     void executeForConfig(EGLDisplay display, EGLConfig config)
347*35238bceSAndroid Build Coastguard Worker     {
348*35238bceSAndroid Build Coastguard Worker         const Library &egl = m_eglTestCtx.getLibrary();
349*35238bceSAndroid Build Coastguard Worker         tcu::TestLog &log  = m_testCtx.getLog();
350*35238bceSAndroid Build Coastguard Worker         const int width    = 64;
351*35238bceSAndroid Build Coastguard Worker         const int height   = 64;
352*35238bceSAndroid Build Coastguard Worker         const eglu::NativePixmapFactory &pixmapFactory =
353*35238bceSAndroid Build Coastguard Worker             eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
354*35238bceSAndroid Build Coastguard Worker         ConfigInfo info;
355*35238bceSAndroid Build Coastguard Worker 
356*35238bceSAndroid Build Coastguard Worker         eglu::queryCoreConfigInfo(egl, display, config, &info);
357*35238bceSAndroid Build Coastguard Worker 
358*35238bceSAndroid Build Coastguard Worker         log << TestLog::Message << "Creating pixmap surface with config ID " << info.configId << TestLog::EndMessage;
359*35238bceSAndroid Build Coastguard Worker         EGLU_CHECK_MSG(egl, "before queries");
360*35238bceSAndroid Build Coastguard Worker 
361*35238bceSAndroid Build Coastguard Worker         de::UniquePtr<eglu::NativePixmap> pixmap(
362*35238bceSAndroid Build Coastguard Worker             pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height));
363*35238bceSAndroid Build Coastguard Worker         eglu::UniqueSurface surface(
364*35238bceSAndroid Build Coastguard Worker             egl, display,
365*35238bceSAndroid Build Coastguard Worker             eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, display, config, DE_NULL));
366*35238bceSAndroid Build Coastguard Worker 
367*35238bceSAndroid Build Coastguard Worker         logCommonSurfaceAttributes(log, egl, display, *surface);
368*35238bceSAndroid Build Coastguard Worker         checkCommonAttributes(display, *surface, info);
369*35238bceSAndroid Build Coastguard Worker         checkNonPbufferAttributes(display, *surface);
370*35238bceSAndroid Build Coastguard Worker     }
371*35238bceSAndroid Build Coastguard Worker };
372*35238bceSAndroid Build Coastguard Worker 
373*35238bceSAndroid Build Coastguard Worker class QuerySurfaceSimplePbufferCase : public QuerySurfaceCase
374*35238bceSAndroid Build Coastguard Worker {
375*35238bceSAndroid Build Coastguard Worker public:
QuerySurfaceSimplePbufferCase(EglTestContext & eglTestCtx,const char * name,const char * description,const eglu::FilterList & filters)376*35238bceSAndroid Build Coastguard Worker     QuerySurfaceSimplePbufferCase(EglTestContext &eglTestCtx, const char *name, const char *description,
377*35238bceSAndroid Build Coastguard Worker                                   const eglu::FilterList &filters)
378*35238bceSAndroid Build Coastguard Worker         : QuerySurfaceCase(eglTestCtx, name, description, filters)
379*35238bceSAndroid Build Coastguard Worker     {
380*35238bceSAndroid Build Coastguard Worker     }
381*35238bceSAndroid Build Coastguard Worker 
executeForConfig(EGLDisplay display,EGLConfig config)382*35238bceSAndroid Build Coastguard Worker     void executeForConfig(EGLDisplay display, EGLConfig config)
383*35238bceSAndroid Build Coastguard Worker     {
384*35238bceSAndroid Build Coastguard Worker         const Library &egl = m_eglTestCtx.getLibrary();
385*35238bceSAndroid Build Coastguard Worker         tcu::TestLog &log  = m_testCtx.getLog();
386*35238bceSAndroid Build Coastguard Worker         int width          = 64;
387*35238bceSAndroid Build Coastguard Worker         int height         = 64;
388*35238bceSAndroid Build Coastguard Worker         ConfigInfo info;
389*35238bceSAndroid Build Coastguard Worker 
390*35238bceSAndroid Build Coastguard Worker         eglu::queryCoreConfigInfo(egl, display, config, &info);
391*35238bceSAndroid Build Coastguard Worker 
392*35238bceSAndroid Build Coastguard Worker         log << TestLog::Message << "Creating pbuffer surface with config ID " << info.configId << TestLog::EndMessage;
393*35238bceSAndroid Build Coastguard Worker         EGLU_CHECK_MSG(egl, "before queries");
394*35238bceSAndroid Build Coastguard Worker 
395*35238bceSAndroid Build Coastguard Worker         // Clamp to maximums reported by implementation
396*35238bceSAndroid Build Coastguard Worker         width  = deMin32(width, eglu::getConfigAttribInt(egl, display, config, EGL_MAX_PBUFFER_WIDTH));
397*35238bceSAndroid Build Coastguard Worker         height = deMin32(height, eglu::getConfigAttribInt(egl, display, config, EGL_MAX_PBUFFER_HEIGHT));
398*35238bceSAndroid Build Coastguard Worker 
399*35238bceSAndroid Build Coastguard Worker         if (width == 0 || height == 0)
400*35238bceSAndroid Build Coastguard Worker         {
401*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, maximum pbuffer size of " << width << "x" << height << " reported"
402*35238bceSAndroid Build Coastguard Worker                 << TestLog::EndMessage;
403*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid maximum pbuffer size");
404*35238bceSAndroid Build Coastguard Worker             return;
405*35238bceSAndroid Build Coastguard Worker         }
406*35238bceSAndroid Build Coastguard Worker 
407*35238bceSAndroid Build Coastguard Worker         const EGLint attribs[] = {EGL_WIDTH, width, EGL_HEIGHT, height, EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE, EGL_NONE};
408*35238bceSAndroid Build Coastguard Worker 
409*35238bceSAndroid Build Coastguard Worker         {
410*35238bceSAndroid Build Coastguard Worker             eglu::UniqueSurface surface(egl, display, egl.createPbufferSurface(display, config, attribs));
411*35238bceSAndroid Build Coastguard Worker 
412*35238bceSAndroid Build Coastguard Worker             logCommonSurfaceAttributes(log, egl, display, *surface);
413*35238bceSAndroid Build Coastguard Worker             logPbufferSurfaceAttributes(log, egl, display, *surface);
414*35238bceSAndroid Build Coastguard Worker             checkCommonAttributes(display, *surface, info);
415*35238bceSAndroid Build Coastguard Worker 
416*35238bceSAndroid Build Coastguard Worker             // Pbuffer-specific attributes
417*35238bceSAndroid Build Coastguard Worker 
418*35238bceSAndroid Build Coastguard Worker             // Largest pbuffer
419*35238bceSAndroid Build Coastguard Worker             {
420*35238bceSAndroid Build Coastguard Worker                 const EGLint largestPbuffer = eglu::querySurfaceInt(egl, display, *surface, EGL_LARGEST_PBUFFER);
421*35238bceSAndroid Build Coastguard Worker 
422*35238bceSAndroid Build Coastguard Worker                 if (largestPbuffer != EGL_FALSE && largestPbuffer != EGL_TRUE)
423*35238bceSAndroid Build Coastguard Worker                 {
424*35238bceSAndroid Build Coastguard Worker                     log << TestLog::Message << "    Fail, invalid largest pbuffer value " << largestPbuffer
425*35238bceSAndroid Build Coastguard Worker                         << TestLog::EndMessage;
426*35238bceSAndroid Build Coastguard Worker                     m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid largest pbuffer");
427*35238bceSAndroid Build Coastguard Worker                 }
428*35238bceSAndroid Build Coastguard Worker             }
429*35238bceSAndroid Build Coastguard Worker 
430*35238bceSAndroid Build Coastguard Worker             // Texture format
431*35238bceSAndroid Build Coastguard Worker             {
432*35238bceSAndroid Build Coastguard Worker                 const EGLint textureFormat = eglu::querySurfaceInt(egl, display, *surface, EGL_TEXTURE_FORMAT);
433*35238bceSAndroid Build Coastguard Worker 
434*35238bceSAndroid Build Coastguard Worker                 if (textureFormat != EGL_NO_TEXTURE && textureFormat != EGL_TEXTURE_RGB &&
435*35238bceSAndroid Build Coastguard Worker                     textureFormat != EGL_TEXTURE_RGBA)
436*35238bceSAndroid Build Coastguard Worker                 {
437*35238bceSAndroid Build Coastguard Worker                     log << TestLog::Message << "    Fail, invalid texture format value " << textureFormat
438*35238bceSAndroid Build Coastguard Worker                         << TestLog::EndMessage;
439*35238bceSAndroid Build Coastguard Worker                     m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid texture format");
440*35238bceSAndroid Build Coastguard Worker                 }
441*35238bceSAndroid Build Coastguard Worker             }
442*35238bceSAndroid Build Coastguard Worker 
443*35238bceSAndroid Build Coastguard Worker             // Texture target
444*35238bceSAndroid Build Coastguard Worker             {
445*35238bceSAndroid Build Coastguard Worker                 const EGLint textureTarget = eglu::querySurfaceInt(egl, display, *surface, EGL_TEXTURE_TARGET);
446*35238bceSAndroid Build Coastguard Worker 
447*35238bceSAndroid Build Coastguard Worker                 if (textureTarget != EGL_NO_TEXTURE && textureTarget != EGL_TEXTURE_2D)
448*35238bceSAndroid Build Coastguard Worker                 {
449*35238bceSAndroid Build Coastguard Worker                     log << TestLog::Message << "    Fail, invalid texture target value " << textureTarget
450*35238bceSAndroid Build Coastguard Worker                         << TestLog::EndMessage;
451*35238bceSAndroid Build Coastguard Worker                     m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid texture target");
452*35238bceSAndroid Build Coastguard Worker                 }
453*35238bceSAndroid Build Coastguard Worker             }
454*35238bceSAndroid Build Coastguard Worker 
455*35238bceSAndroid Build Coastguard Worker             // Mipmap texture
456*35238bceSAndroid Build Coastguard Worker             {
457*35238bceSAndroid Build Coastguard Worker                 const EGLint mipmapTexture = eglu::querySurfaceInt(egl, display, *surface, EGL_MIPMAP_TEXTURE);
458*35238bceSAndroid Build Coastguard Worker 
459*35238bceSAndroid Build Coastguard Worker                 if (mipmapTexture != EGL_FALSE && mipmapTexture != EGL_TRUE)
460*35238bceSAndroid Build Coastguard Worker                 {
461*35238bceSAndroid Build Coastguard Worker                     log << TestLog::Message << "    Fail, invalid mipmap texture value " << mipmapTexture
462*35238bceSAndroid Build Coastguard Worker                         << TestLog::EndMessage;
463*35238bceSAndroid Build Coastguard Worker                     m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid mipmap texture");
464*35238bceSAndroid Build Coastguard Worker                 }
465*35238bceSAndroid Build Coastguard Worker             }
466*35238bceSAndroid Build Coastguard Worker         }
467*35238bceSAndroid Build Coastguard Worker     }
468*35238bceSAndroid Build Coastguard Worker };
469*35238bceSAndroid Build Coastguard Worker 
470*35238bceSAndroid Build Coastguard Worker class SurfaceAttribCase : public SimpleConfigCase
471*35238bceSAndroid Build Coastguard Worker {
472*35238bceSAndroid Build Coastguard Worker public:
473*35238bceSAndroid Build Coastguard Worker     SurfaceAttribCase(EglTestContext &eglTestCtx, const char *name, const char *description,
474*35238bceSAndroid Build Coastguard Worker                       const eglu::FilterList &filters);
~SurfaceAttribCase(void)475*35238bceSAndroid Build Coastguard Worker     virtual ~SurfaceAttribCase(void)
476*35238bceSAndroid Build Coastguard Worker     {
477*35238bceSAndroid Build Coastguard Worker     }
478*35238bceSAndroid Build Coastguard Worker 
479*35238bceSAndroid Build Coastguard Worker     void testAttributes(EGLDisplay display, EGLSurface surface, EGLint surfaceType, const ConfigInfo &info);
480*35238bceSAndroid Build Coastguard Worker };
481*35238bceSAndroid Build Coastguard Worker 
SurfaceAttribCase(EglTestContext & eglTestCtx,const char * name,const char * description,const eglu::FilterList & filters)482*35238bceSAndroid Build Coastguard Worker SurfaceAttribCase::SurfaceAttribCase(EglTestContext &eglTestCtx, const char *name, const char *description,
483*35238bceSAndroid Build Coastguard Worker                                      const eglu::FilterList &filters)
484*35238bceSAndroid Build Coastguard Worker     : SimpleConfigCase(eglTestCtx, name, description, filters)
485*35238bceSAndroid Build Coastguard Worker {
486*35238bceSAndroid Build Coastguard Worker }
487*35238bceSAndroid Build Coastguard Worker 
testAttributes(EGLDisplay display,EGLSurface surface,EGLint surfaceType,const ConfigInfo & info)488*35238bceSAndroid Build Coastguard Worker void SurfaceAttribCase::testAttributes(EGLDisplay display, EGLSurface surface, EGLint surfaceType,
489*35238bceSAndroid Build Coastguard Worker                                        const ConfigInfo &info)
490*35238bceSAndroid Build Coastguard Worker {
491*35238bceSAndroid Build Coastguard Worker     const Library &egl          = m_eglTestCtx.getLibrary();
492*35238bceSAndroid Build Coastguard Worker     tcu::TestLog &log           = m_testCtx.getLog();
493*35238bceSAndroid Build Coastguard Worker     const eglu::Version version = eglu::getVersion(egl, display);
494*35238bceSAndroid Build Coastguard Worker 
495*35238bceSAndroid Build Coastguard Worker     if (version.getMajor() == 1 && version.getMinor() == 0)
496*35238bceSAndroid Build Coastguard Worker     {
497*35238bceSAndroid Build Coastguard Worker         log << TestLog::Message << "No attributes can be set in EGL 1.0" << TestLog::EndMessage;
498*35238bceSAndroid Build Coastguard Worker         return;
499*35238bceSAndroid Build Coastguard Worker     }
500*35238bceSAndroid Build Coastguard Worker 
501*35238bceSAndroid Build Coastguard Worker     // Mipmap level
502*35238bceSAndroid Build Coastguard Worker     if (info.renderableType & EGL_OPENGL_ES_BIT || info.renderableType & EGL_OPENGL_ES2_BIT)
503*35238bceSAndroid Build Coastguard Worker     {
504*35238bceSAndroid Build Coastguard Worker         const EGLint initialValue = 0xDEADBAAD;
505*35238bceSAndroid Build Coastguard Worker         EGLint value              = initialValue;
506*35238bceSAndroid Build Coastguard Worker 
507*35238bceSAndroid Build Coastguard Worker         EGLU_CHECK_CALL(egl, querySurface(display, surface, EGL_MIPMAP_LEVEL, &value));
508*35238bceSAndroid Build Coastguard Worker 
509*35238bceSAndroid Build Coastguard Worker         logSurfaceAttribute(log, EGL_MIPMAP_LEVEL, value);
510*35238bceSAndroid Build Coastguard Worker 
511*35238bceSAndroid Build Coastguard Worker         if (surfaceType == EGL_PBUFFER_BIT)
512*35238bceSAndroid Build Coastguard Worker         {
513*35238bceSAndroid Build Coastguard Worker             if (value != 0)
514*35238bceSAndroid Build Coastguard Worker             {
515*35238bceSAndroid Build Coastguard Worker                 log << TestLog::Message << "    Fail, initial mipmap level value should be 0, is " << value
516*35238bceSAndroid Build Coastguard Worker                     << TestLog::EndMessage;
517*35238bceSAndroid Build Coastguard Worker                 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid default mipmap level");
518*35238bceSAndroid Build Coastguard Worker             }
519*35238bceSAndroid Build Coastguard Worker         }
520*35238bceSAndroid Build Coastguard Worker         else if (value != initialValue)
521*35238bceSAndroid Build Coastguard Worker         {
522*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message
523*35238bceSAndroid Build Coastguard Worker                 << "    Fail, eglQuerySurface changed value when querying EGL_MIPMAP_LEVEL for non-pbuffer surface. "
524*35238bceSAndroid Build Coastguard Worker                    "Result: "
525*35238bceSAndroid Build Coastguard Worker                 << value << ". Expected: " << initialValue << TestLog::EndMessage;
526*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL,
527*35238bceSAndroid Build Coastguard Worker                                     "EGL_MIPMAP_LEVEL query modified result for non-pbuffer surface.");
528*35238bceSAndroid Build Coastguard Worker         }
529*35238bceSAndroid Build Coastguard Worker 
530*35238bceSAndroid Build Coastguard Worker         egl.surfaceAttrib(display, surface, EGL_MIPMAP_LEVEL, 1);
531*35238bceSAndroid Build Coastguard Worker 
532*35238bceSAndroid Build Coastguard Worker         {
533*35238bceSAndroid Build Coastguard Worker             const EGLint error = egl.getError();
534*35238bceSAndroid Build Coastguard Worker 
535*35238bceSAndroid Build Coastguard Worker             if (error != EGL_SUCCESS)
536*35238bceSAndroid Build Coastguard Worker             {
537*35238bceSAndroid Build Coastguard Worker                 log << TestLog::Message << "    Fail, setting EGL_MIPMAP_LEVEL should not result in an error, received "
538*35238bceSAndroid Build Coastguard Worker                     << eglu::getErrorStr(error) << TestLog::EndMessage;
539*35238bceSAndroid Build Coastguard Worker 
540*35238bceSAndroid Build Coastguard Worker                 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Illegal error condition");
541*35238bceSAndroid Build Coastguard Worker             }
542*35238bceSAndroid Build Coastguard Worker         }
543*35238bceSAndroid Build Coastguard Worker     }
544*35238bceSAndroid Build Coastguard Worker 
545*35238bceSAndroid Build Coastguard Worker     // Only mipmap level can be set in EGL 1.3 and lower
546*35238bceSAndroid Build Coastguard Worker     if (version.getMajor() == 1 && version.getMinor() <= 3)
547*35238bceSAndroid Build Coastguard Worker         return;
548*35238bceSAndroid Build Coastguard Worker 
549*35238bceSAndroid Build Coastguard Worker     // Multisample resolve
550*35238bceSAndroid Build Coastguard Worker     {
551*35238bceSAndroid Build Coastguard Worker         const EGLint value = eglu::querySurfaceInt(egl, display, surface, EGL_MULTISAMPLE_RESOLVE);
552*35238bceSAndroid Build Coastguard Worker 
553*35238bceSAndroid Build Coastguard Worker         logSurfaceAttribute(log, EGL_MULTISAMPLE_RESOLVE, value);
554*35238bceSAndroid Build Coastguard Worker 
555*35238bceSAndroid Build Coastguard Worker         if (value != EGL_MULTISAMPLE_RESOLVE_DEFAULT)
556*35238bceSAndroid Build Coastguard Worker         {
557*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message
558*35238bceSAndroid Build Coastguard Worker                 << "    Fail, initial multisample resolve value should be EGL_MULTISAMPLE_RESOLVE_DEFAULT, is "
559*35238bceSAndroid Build Coastguard Worker                 << eglu::getSurfaceAttribValueStr(EGL_MULTISAMPLE_RESOLVE, value) << TestLog::EndMessage;
560*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid default multisample resolve");
561*35238bceSAndroid Build Coastguard Worker         }
562*35238bceSAndroid Build Coastguard Worker 
563*35238bceSAndroid Build Coastguard Worker         if (info.renderableType & EGL_MULTISAMPLE_RESOLVE_BOX_BIT)
564*35238bceSAndroid Build Coastguard Worker         {
565*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Box filter is supported by surface, trying to set." << TestLog::EndMessage;
566*35238bceSAndroid Build Coastguard Worker 
567*35238bceSAndroid Build Coastguard Worker             egl.surfaceAttrib(display, surface, EGL_MULTISAMPLE_RESOLVE, EGL_MULTISAMPLE_RESOLVE_BOX);
568*35238bceSAndroid Build Coastguard Worker 
569*35238bceSAndroid Build Coastguard Worker             if (eglu::querySurfaceInt(egl, display, surface, EGL_MULTISAMPLE_RESOLVE) != EGL_MULTISAMPLE_RESOLVE_BOX)
570*35238bceSAndroid Build Coastguard Worker             {
571*35238bceSAndroid Build Coastguard Worker                 log << TestLog::Message << "    Fail, tried to enable box filter but value did not change.";
572*35238bceSAndroid Build Coastguard Worker                 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to set multisample resolve");
573*35238bceSAndroid Build Coastguard Worker             }
574*35238bceSAndroid Build Coastguard Worker         }
575*35238bceSAndroid Build Coastguard Worker     }
576*35238bceSAndroid Build Coastguard Worker 
577*35238bceSAndroid Build Coastguard Worker     // Swap behavior
578*35238bceSAndroid Build Coastguard Worker     {
579*35238bceSAndroid Build Coastguard Worker         const EGLint value = eglu::querySurfaceInt(egl, display, surface, EGL_SWAP_BEHAVIOR);
580*35238bceSAndroid Build Coastguard Worker 
581*35238bceSAndroid Build Coastguard Worker         logSurfaceAttribute(log, EGL_SWAP_BEHAVIOR, value);
582*35238bceSAndroid Build Coastguard Worker 
583*35238bceSAndroid Build Coastguard Worker         if (info.renderableType & EGL_SWAP_BEHAVIOR_PRESERVED_BIT)
584*35238bceSAndroid Build Coastguard Worker         {
585*35238bceSAndroid Build Coastguard Worker             const EGLint nextValue = (value == EGL_BUFFER_DESTROYED) ? EGL_BUFFER_PRESERVED : EGL_BUFFER_DESTROYED;
586*35238bceSAndroid Build Coastguard Worker 
587*35238bceSAndroid Build Coastguard Worker             egl.surfaceAttrib(display, surface, EGL_SWAP_BEHAVIOR, nextValue);
588*35238bceSAndroid Build Coastguard Worker 
589*35238bceSAndroid Build Coastguard Worker             if (eglu::querySurfaceInt(egl, display, surface, EGL_SWAP_BEHAVIOR) != nextValue)
590*35238bceSAndroid Build Coastguard Worker             {
591*35238bceSAndroid Build Coastguard Worker                 log << TestLog::Message << "  Fail, tried to set swap behavior to "
592*35238bceSAndroid Build Coastguard Worker                     << eglu::getSurfaceAttribStr(nextValue) << TestLog::EndMessage;
593*35238bceSAndroid Build Coastguard Worker                 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Failed to set swap behavior");
594*35238bceSAndroid Build Coastguard Worker             }
595*35238bceSAndroid Build Coastguard Worker         }
596*35238bceSAndroid Build Coastguard Worker     }
597*35238bceSAndroid Build Coastguard Worker }
598*35238bceSAndroid Build Coastguard Worker 
599*35238bceSAndroid Build Coastguard Worker class SurfaceAttribWindowCase : public SurfaceAttribCase
600*35238bceSAndroid Build Coastguard Worker {
601*35238bceSAndroid Build Coastguard Worker public:
SurfaceAttribWindowCase(EglTestContext & eglTestCtx,const char * name,const char * description,const eglu::FilterList & filters)602*35238bceSAndroid Build Coastguard Worker     SurfaceAttribWindowCase(EglTestContext &eglTestCtx, const char *name, const char *description,
603*35238bceSAndroid Build Coastguard Worker                             const eglu::FilterList &filters)
604*35238bceSAndroid Build Coastguard Worker         : SurfaceAttribCase(eglTestCtx, name, description, filters)
605*35238bceSAndroid Build Coastguard Worker     {
606*35238bceSAndroid Build Coastguard Worker     }
607*35238bceSAndroid Build Coastguard Worker 
executeForConfig(EGLDisplay display,EGLConfig config)608*35238bceSAndroid Build Coastguard Worker     void executeForConfig(EGLDisplay display, EGLConfig config)
609*35238bceSAndroid Build Coastguard Worker     {
610*35238bceSAndroid Build Coastguard Worker         const Library &egl = m_eglTestCtx.getLibrary();
611*35238bceSAndroid Build Coastguard Worker         tcu::TestLog &log  = m_testCtx.getLog();
612*35238bceSAndroid Build Coastguard Worker         const int width    = 64;
613*35238bceSAndroid Build Coastguard Worker         const int height   = 64;
614*35238bceSAndroid Build Coastguard Worker         const eglu::NativeWindowFactory &windowFactory =
615*35238bceSAndroid Build Coastguard Worker             eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
616*35238bceSAndroid Build Coastguard Worker         ConfigInfo info;
617*35238bceSAndroid Build Coastguard Worker 
618*35238bceSAndroid Build Coastguard Worker         eglu::queryCoreConfigInfo(egl, display, config, &info);
619*35238bceSAndroid Build Coastguard Worker 
620*35238bceSAndroid Build Coastguard Worker         log << TestLog::Message << "Creating window surface with config ID " << info.configId << TestLog::EndMessage;
621*35238bceSAndroid Build Coastguard Worker         EGLU_CHECK_MSG(egl, "before queries");
622*35238bceSAndroid Build Coastguard Worker 
623*35238bceSAndroid Build Coastguard Worker         de::UniquePtr<eglu::NativeWindow> window(windowFactory.createWindow(
624*35238bceSAndroid Build Coastguard Worker             &m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL,
625*35238bceSAndroid Build Coastguard Worker             eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
626*35238bceSAndroid Build Coastguard Worker         eglu::UniqueSurface surface(
627*35238bceSAndroid Build Coastguard Worker             egl, display,
628*35238bceSAndroid Build Coastguard Worker             eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, display, config, DE_NULL));
629*35238bceSAndroid Build Coastguard Worker 
630*35238bceSAndroid Build Coastguard Worker         testAttributes(display, *surface, EGL_WINDOW_BIT, info);
631*35238bceSAndroid Build Coastguard Worker     }
632*35238bceSAndroid Build Coastguard Worker };
633*35238bceSAndroid Build Coastguard Worker 
634*35238bceSAndroid Build Coastguard Worker class SurfaceAttribPixmapCase : public SurfaceAttribCase
635*35238bceSAndroid Build Coastguard Worker {
636*35238bceSAndroid Build Coastguard Worker public:
SurfaceAttribPixmapCase(EglTestContext & eglTestCtx,const char * name,const char * description,const eglu::FilterList & filters)637*35238bceSAndroid Build Coastguard Worker     SurfaceAttribPixmapCase(EglTestContext &eglTestCtx, const char *name, const char *description,
638*35238bceSAndroid Build Coastguard Worker                             const eglu::FilterList &filters)
639*35238bceSAndroid Build Coastguard Worker         : SurfaceAttribCase(eglTestCtx, name, description, filters)
640*35238bceSAndroid Build Coastguard Worker     {
641*35238bceSAndroid Build Coastguard Worker     }
642*35238bceSAndroid Build Coastguard Worker 
executeForConfig(EGLDisplay display,EGLConfig config)643*35238bceSAndroid Build Coastguard Worker     void executeForConfig(EGLDisplay display, EGLConfig config)
644*35238bceSAndroid Build Coastguard Worker     {
645*35238bceSAndroid Build Coastguard Worker         const Library &egl = m_eglTestCtx.getLibrary();
646*35238bceSAndroid Build Coastguard Worker         tcu::TestLog &log  = m_testCtx.getLog();
647*35238bceSAndroid Build Coastguard Worker         const int width    = 64;
648*35238bceSAndroid Build Coastguard Worker         const int height   = 64;
649*35238bceSAndroid Build Coastguard Worker         const eglu::NativePixmapFactory &pixmapFactory =
650*35238bceSAndroid Build Coastguard Worker             eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
651*35238bceSAndroid Build Coastguard Worker         ConfigInfo info;
652*35238bceSAndroid Build Coastguard Worker 
653*35238bceSAndroid Build Coastguard Worker         eglu::queryCoreConfigInfo(egl, display, config, &info);
654*35238bceSAndroid Build Coastguard Worker 
655*35238bceSAndroid Build Coastguard Worker         log << TestLog::Message << "Creating pixmap surface with config ID " << info.configId << TestLog::EndMessage;
656*35238bceSAndroid Build Coastguard Worker         EGLU_CHECK_MSG(egl, "before queries");
657*35238bceSAndroid Build Coastguard Worker 
658*35238bceSAndroid Build Coastguard Worker         de::UniquePtr<eglu::NativePixmap> pixmap(
659*35238bceSAndroid Build Coastguard Worker             pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height));
660*35238bceSAndroid Build Coastguard Worker         eglu::UniqueSurface surface(
661*35238bceSAndroid Build Coastguard Worker             egl, display,
662*35238bceSAndroid Build Coastguard Worker             eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, display, config, DE_NULL));
663*35238bceSAndroid Build Coastguard Worker 
664*35238bceSAndroid Build Coastguard Worker         testAttributes(display, *surface, EGL_PIXMAP_BIT, info);
665*35238bceSAndroid Build Coastguard Worker     }
666*35238bceSAndroid Build Coastguard Worker };
667*35238bceSAndroid Build Coastguard Worker 
668*35238bceSAndroid Build Coastguard Worker class SurfaceAttribPbufferCase : public SurfaceAttribCase
669*35238bceSAndroid Build Coastguard Worker {
670*35238bceSAndroid Build Coastguard Worker public:
SurfaceAttribPbufferCase(EglTestContext & eglTestCtx,const char * name,const char * description,const eglu::FilterList & filters)671*35238bceSAndroid Build Coastguard Worker     SurfaceAttribPbufferCase(EglTestContext &eglTestCtx, const char *name, const char *description,
672*35238bceSAndroid Build Coastguard Worker                              const eglu::FilterList &filters)
673*35238bceSAndroid Build Coastguard Worker         : SurfaceAttribCase(eglTestCtx, name, description, filters)
674*35238bceSAndroid Build Coastguard Worker     {
675*35238bceSAndroid Build Coastguard Worker     }
676*35238bceSAndroid Build Coastguard Worker 
executeForConfig(EGLDisplay display,EGLConfig config)677*35238bceSAndroid Build Coastguard Worker     void executeForConfig(EGLDisplay display, EGLConfig config)
678*35238bceSAndroid Build Coastguard Worker     {
679*35238bceSAndroid Build Coastguard Worker         const Library &egl = m_eglTestCtx.getLibrary();
680*35238bceSAndroid Build Coastguard Worker         tcu::TestLog &log  = m_testCtx.getLog();
681*35238bceSAndroid Build Coastguard Worker         int width          = 64;
682*35238bceSAndroid Build Coastguard Worker         int height         = 64;
683*35238bceSAndroid Build Coastguard Worker         ConfigInfo info;
684*35238bceSAndroid Build Coastguard Worker 
685*35238bceSAndroid Build Coastguard Worker         eglu::queryCoreConfigInfo(egl, display, config, &info);
686*35238bceSAndroid Build Coastguard Worker 
687*35238bceSAndroid Build Coastguard Worker         log << TestLog::Message << "Creating pbuffer surface with config ID " << info.configId << TestLog::EndMessage;
688*35238bceSAndroid Build Coastguard Worker         EGLU_CHECK_MSG(egl, "before queries");
689*35238bceSAndroid Build Coastguard Worker 
690*35238bceSAndroid Build Coastguard Worker         // Clamp to maximums reported by implementation
691*35238bceSAndroid Build Coastguard Worker         width  = deMin32(width, eglu::getConfigAttribInt(egl, display, config, EGL_MAX_PBUFFER_WIDTH));
692*35238bceSAndroid Build Coastguard Worker         height = deMin32(height, eglu::getConfigAttribInt(egl, display, config, EGL_MAX_PBUFFER_HEIGHT));
693*35238bceSAndroid Build Coastguard Worker 
694*35238bceSAndroid Build Coastguard Worker         if (width == 0 || height == 0)
695*35238bceSAndroid Build Coastguard Worker         {
696*35238bceSAndroid Build Coastguard Worker             log << TestLog::Message << "    Fail, maximum pbuffer size of " << width << "x" << height << " reported"
697*35238bceSAndroid Build Coastguard Worker                 << TestLog::EndMessage;
698*35238bceSAndroid Build Coastguard Worker             m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid maximum pbuffer size");
699*35238bceSAndroid Build Coastguard Worker             return;
700*35238bceSAndroid Build Coastguard Worker         }
701*35238bceSAndroid Build Coastguard Worker 
702*35238bceSAndroid Build Coastguard Worker         const EGLint attribs[] = {EGL_WIDTH, width, EGL_HEIGHT, height, EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE, EGL_NONE};
703*35238bceSAndroid Build Coastguard Worker 
704*35238bceSAndroid Build Coastguard Worker         eglu::UniqueSurface surface(egl, display, egl.createPbufferSurface(display, config, attribs));
705*35238bceSAndroid Build Coastguard Worker 
706*35238bceSAndroid Build Coastguard Worker         testAttributes(display, *surface, EGL_PBUFFER_BIT, info);
707*35238bceSAndroid Build Coastguard Worker     }
708*35238bceSAndroid Build Coastguard Worker };
709*35238bceSAndroid Build Coastguard Worker 
QuerySurfaceTests(EglTestContext & eglTestCtx)710*35238bceSAndroid Build Coastguard Worker QuerySurfaceTests::QuerySurfaceTests(EglTestContext &eglTestCtx)
711*35238bceSAndroid Build Coastguard Worker     : TestCaseGroup(eglTestCtx, "query_surface", "Surface Query Tests")
712*35238bceSAndroid Build Coastguard Worker {
713*35238bceSAndroid Build Coastguard Worker }
714*35238bceSAndroid Build Coastguard Worker 
~QuerySurfaceTests(void)715*35238bceSAndroid Build Coastguard Worker QuerySurfaceTests::~QuerySurfaceTests(void)
716*35238bceSAndroid Build Coastguard Worker {
717*35238bceSAndroid Build Coastguard Worker }
718*35238bceSAndroid Build Coastguard Worker 
719*35238bceSAndroid Build Coastguard Worker template <uint32_t Type>
surfaceType(const eglu::CandidateConfig & c)720*35238bceSAndroid Build Coastguard Worker static bool surfaceType(const eglu::CandidateConfig &c)
721*35238bceSAndroid Build Coastguard Worker {
722*35238bceSAndroid Build Coastguard Worker     return (c.surfaceType() & Type) == Type;
723*35238bceSAndroid Build Coastguard Worker }
724*35238bceSAndroid Build Coastguard Worker 
init(void)725*35238bceSAndroid Build Coastguard Worker void QuerySurfaceTests::init(void)
726*35238bceSAndroid Build Coastguard Worker {
727*35238bceSAndroid Build Coastguard Worker     // Simple queries
728*35238bceSAndroid Build Coastguard Worker     {
729*35238bceSAndroid Build Coastguard Worker         tcu::TestCaseGroup *simpleGroup = new tcu::TestCaseGroup(m_testCtx, "simple", "Simple queries");
730*35238bceSAndroid Build Coastguard Worker         addChild(simpleGroup);
731*35238bceSAndroid Build Coastguard Worker 
732*35238bceSAndroid Build Coastguard Worker         // Window
733*35238bceSAndroid Build Coastguard Worker         {
734*35238bceSAndroid Build Coastguard Worker             tcu::TestCaseGroup *windowGroup = new tcu::TestCaseGroup(m_testCtx, "window", "Window surfaces");
735*35238bceSAndroid Build Coastguard Worker             simpleGroup->addChild(windowGroup);
736*35238bceSAndroid Build Coastguard Worker 
737*35238bceSAndroid Build Coastguard Worker             eglu::FilterList baseFilters;
738*35238bceSAndroid Build Coastguard Worker             baseFilters << surfaceType<EGL_WINDOW_BIT>;
739*35238bceSAndroid Build Coastguard Worker 
740*35238bceSAndroid Build Coastguard Worker             std::vector<NamedFilterList> filterLists;
741*35238bceSAndroid Build Coastguard Worker             getDefaultFilterLists(filterLists, baseFilters);
742*35238bceSAndroid Build Coastguard Worker 
743*35238bceSAndroid Build Coastguard Worker             for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++)
744*35238bceSAndroid Build Coastguard Worker                 windowGroup->addChild(
745*35238bceSAndroid Build Coastguard Worker                     new QuerySurfaceSimpleWindowCase(m_eglTestCtx, i->getName(), i->getDescription(), *i));
746*35238bceSAndroid Build Coastguard Worker         }
747*35238bceSAndroid Build Coastguard Worker 
748*35238bceSAndroid Build Coastguard Worker         // Pixmap
749*35238bceSAndroid Build Coastguard Worker         {
750*35238bceSAndroid Build Coastguard Worker             tcu::TestCaseGroup *pixmapGroup = new tcu::TestCaseGroup(m_testCtx, "pixmap", "Pixmap surfaces");
751*35238bceSAndroid Build Coastguard Worker             simpleGroup->addChild(pixmapGroup);
752*35238bceSAndroid Build Coastguard Worker 
753*35238bceSAndroid Build Coastguard Worker             eglu::FilterList baseFilters;
754*35238bceSAndroid Build Coastguard Worker             baseFilters << surfaceType<EGL_PIXMAP_BIT>;
755*35238bceSAndroid Build Coastguard Worker 
756*35238bceSAndroid Build Coastguard Worker             std::vector<NamedFilterList> filterLists;
757*35238bceSAndroid Build Coastguard Worker             getDefaultFilterLists(filterLists, baseFilters);
758*35238bceSAndroid Build Coastguard Worker 
759*35238bceSAndroid Build Coastguard Worker             for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++)
760*35238bceSAndroid Build Coastguard Worker                 pixmapGroup->addChild(
761*35238bceSAndroid Build Coastguard Worker                     new QuerySurfaceSimplePixmapCase(m_eglTestCtx, i->getName(), i->getDescription(), *i));
762*35238bceSAndroid Build Coastguard Worker         }
763*35238bceSAndroid Build Coastguard Worker 
764*35238bceSAndroid Build Coastguard Worker         // Pbuffer
765*35238bceSAndroid Build Coastguard Worker         {
766*35238bceSAndroid Build Coastguard Worker             tcu::TestCaseGroup *pbufferGroup = new tcu::TestCaseGroup(m_testCtx, "pbuffer", "Pbuffer surfaces");
767*35238bceSAndroid Build Coastguard Worker             simpleGroup->addChild(pbufferGroup);
768*35238bceSAndroid Build Coastguard Worker 
769*35238bceSAndroid Build Coastguard Worker             eglu::FilterList baseFilters;
770*35238bceSAndroid Build Coastguard Worker             baseFilters << surfaceType<EGL_PBUFFER_BIT>;
771*35238bceSAndroid Build Coastguard Worker 
772*35238bceSAndroid Build Coastguard Worker             std::vector<NamedFilterList> filterLists;
773*35238bceSAndroid Build Coastguard Worker             getDefaultFilterLists(filterLists, baseFilters);
774*35238bceSAndroid Build Coastguard Worker 
775*35238bceSAndroid Build Coastguard Worker             for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++)
776*35238bceSAndroid Build Coastguard Worker                 pbufferGroup->addChild(
777*35238bceSAndroid Build Coastguard Worker                     new QuerySurfaceSimplePbufferCase(m_eglTestCtx, i->getName(), i->getDescription(), *i));
778*35238bceSAndroid Build Coastguard Worker         }
779*35238bceSAndroid Build Coastguard Worker     }
780*35238bceSAndroid Build Coastguard Worker 
781*35238bceSAndroid Build Coastguard Worker     // Set surface attributes
782*35238bceSAndroid Build Coastguard Worker     {
783*35238bceSAndroid Build Coastguard Worker         tcu::TestCaseGroup *setAttributeGroup =
784*35238bceSAndroid Build Coastguard Worker             new tcu::TestCaseGroup(m_testCtx, "set_attribute", "Setting attributes");
785*35238bceSAndroid Build Coastguard Worker         addChild(setAttributeGroup);
786*35238bceSAndroid Build Coastguard Worker 
787*35238bceSAndroid Build Coastguard Worker         // Window
788*35238bceSAndroid Build Coastguard Worker         {
789*35238bceSAndroid Build Coastguard Worker             tcu::TestCaseGroup *windowGroup = new tcu::TestCaseGroup(m_testCtx, "window", "Window surfaces");
790*35238bceSAndroid Build Coastguard Worker             setAttributeGroup->addChild(windowGroup);
791*35238bceSAndroid Build Coastguard Worker 
792*35238bceSAndroid Build Coastguard Worker             eglu::FilterList baseFilters;
793*35238bceSAndroid Build Coastguard Worker             baseFilters << surfaceType<EGL_WINDOW_BIT>;
794*35238bceSAndroid Build Coastguard Worker 
795*35238bceSAndroid Build Coastguard Worker             std::vector<NamedFilterList> filterLists;
796*35238bceSAndroid Build Coastguard Worker             getDefaultFilterLists(filterLists, baseFilters);
797*35238bceSAndroid Build Coastguard Worker 
798*35238bceSAndroid Build Coastguard Worker             for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++)
799*35238bceSAndroid Build Coastguard Worker                 windowGroup->addChild(new SurfaceAttribWindowCase(m_eglTestCtx, i->getName(), i->getDescription(), *i));
800*35238bceSAndroid Build Coastguard Worker         }
801*35238bceSAndroid Build Coastguard Worker 
802*35238bceSAndroid Build Coastguard Worker         // Pixmap
803*35238bceSAndroid Build Coastguard Worker         {
804*35238bceSAndroid Build Coastguard Worker             tcu::TestCaseGroup *pixmapGroup = new tcu::TestCaseGroup(m_testCtx, "pixmap", "Pixmap surfaces");
805*35238bceSAndroid Build Coastguard Worker             setAttributeGroup->addChild(pixmapGroup);
806*35238bceSAndroid Build Coastguard Worker 
807*35238bceSAndroid Build Coastguard Worker             eglu::FilterList baseFilters;
808*35238bceSAndroid Build Coastguard Worker             baseFilters << surfaceType<EGL_PIXMAP_BIT>;
809*35238bceSAndroid Build Coastguard Worker 
810*35238bceSAndroid Build Coastguard Worker             std::vector<NamedFilterList> filterLists;
811*35238bceSAndroid Build Coastguard Worker             getDefaultFilterLists(filterLists, baseFilters);
812*35238bceSAndroid Build Coastguard Worker 
813*35238bceSAndroid Build Coastguard Worker             for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++)
814*35238bceSAndroid Build Coastguard Worker                 pixmapGroup->addChild(new SurfaceAttribPixmapCase(m_eglTestCtx, i->getName(), i->getDescription(), *i));
815*35238bceSAndroid Build Coastguard Worker         }
816*35238bceSAndroid Build Coastguard Worker 
817*35238bceSAndroid Build Coastguard Worker         // Pbuffer
818*35238bceSAndroid Build Coastguard Worker         {
819*35238bceSAndroid Build Coastguard Worker             tcu::TestCaseGroup *pbufferGroup = new tcu::TestCaseGroup(m_testCtx, "pbuffer", "Pbuffer surfaces");
820*35238bceSAndroid Build Coastguard Worker             setAttributeGroup->addChild(pbufferGroup);
821*35238bceSAndroid Build Coastguard Worker 
822*35238bceSAndroid Build Coastguard Worker             eglu::FilterList baseFilters;
823*35238bceSAndroid Build Coastguard Worker             baseFilters << surfaceType<EGL_PBUFFER_BIT>;
824*35238bceSAndroid Build Coastguard Worker 
825*35238bceSAndroid Build Coastguard Worker             std::vector<NamedFilterList> filterLists;
826*35238bceSAndroid Build Coastguard Worker             getDefaultFilterLists(filterLists, baseFilters);
827*35238bceSAndroid Build Coastguard Worker 
828*35238bceSAndroid Build Coastguard Worker             for (std::vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++)
829*35238bceSAndroid Build Coastguard Worker                 pbufferGroup->addChild(
830*35238bceSAndroid Build Coastguard Worker                     new SurfaceAttribPbufferCase(m_eglTestCtx, i->getName(), i->getDescription(), *i));
831*35238bceSAndroid Build Coastguard Worker         }
832*35238bceSAndroid Build Coastguard Worker     }
833*35238bceSAndroid Build Coastguard Worker }
834*35238bceSAndroid Build Coastguard Worker 
835*35238bceSAndroid Build Coastguard Worker } // namespace egl
836*35238bceSAndroid Build Coastguard Worker } // namespace deqp
837