1 /*
2 ** Copyright 2010, The Android Open Source Project
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16
17 #include <stdlib.h>
18 #include <stdio.h>
19
20 #include <EGL/egl.h>
21
22 #define ATTRIBUTE(_attr) { _attr, #_attr }
23
24 struct Attribute {
25 EGLint attribute;
26 char const* name;
27 };
28
29 Attribute attributes[] = {
30 ATTRIBUTE( EGL_BUFFER_SIZE ),
31 ATTRIBUTE( EGL_ALPHA_SIZE ),
32 ATTRIBUTE( EGL_BLUE_SIZE ),
33 ATTRIBUTE( EGL_GREEN_SIZE ),
34 ATTRIBUTE( EGL_RED_SIZE ),
35 ATTRIBUTE( EGL_DEPTH_SIZE ),
36 ATTRIBUTE( EGL_STENCIL_SIZE ),
37 ATTRIBUTE( EGL_CONFIG_CAVEAT ),
38 ATTRIBUTE( EGL_CONFIG_ID ),
39 ATTRIBUTE( EGL_LEVEL ),
40 ATTRIBUTE( EGL_MAX_PBUFFER_HEIGHT ),
41 ATTRIBUTE( EGL_MAX_PBUFFER_WIDTH ),
42 ATTRIBUTE( EGL_MAX_PBUFFER_PIXELS ),
43 ATTRIBUTE( EGL_NATIVE_RENDERABLE ),
44 ATTRIBUTE( EGL_NATIVE_VISUAL_ID ),
45 ATTRIBUTE( EGL_NATIVE_VISUAL_TYPE ),
46 ATTRIBUTE( EGL_SAMPLES ),
47 ATTRIBUTE( EGL_SAMPLE_BUFFERS ),
48 ATTRIBUTE( EGL_SURFACE_TYPE ),
49 ATTRIBUTE( EGL_TRANSPARENT_TYPE ),
50 ATTRIBUTE( EGL_TRANSPARENT_BLUE_VALUE ),
51 ATTRIBUTE( EGL_TRANSPARENT_GREEN_VALUE ),
52 ATTRIBUTE( EGL_TRANSPARENT_RED_VALUE ),
53 ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGB ),
54 ATTRIBUTE( EGL_BIND_TO_TEXTURE_RGBA ),
55 ATTRIBUTE( EGL_MIN_SWAP_INTERVAL ),
56 ATTRIBUTE( EGL_MAX_SWAP_INTERVAL ),
57 ATTRIBUTE( EGL_LUMINANCE_SIZE ),
58 ATTRIBUTE( EGL_ALPHA_MASK_SIZE ),
59 ATTRIBUTE( EGL_COLOR_BUFFER_TYPE ),
60 ATTRIBUTE( EGL_RENDERABLE_TYPE ),
61 ATTRIBUTE( EGL_MATCH_NATIVE_PIXMAP ),
62 ATTRIBUTE( EGL_CONFORMANT ),
63 };
64
65
main(int argc,char ** argv)66 int main(int argc, char** argv)
67 {
68 EGLConfig* configs;
69 EGLint n;
70
71 EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
72 eglInitialize(dpy, 0, 0);
73 eglGetConfigs(dpy, NULL, 0, &n);
74 configs = new EGLConfig[n];
75 eglGetConfigs(dpy, configs, n, &n);
76
77 for (EGLint i=0 ; i<n ; i++) {
78 printf("EGLConfig[%d]\n", i);
79 for (int attr = 0 ; attr<sizeof(attributes)/sizeof(Attribute) ; attr++) {
80 EGLint value;
81 eglGetConfigAttrib(dpy, configs[i], attributes[attr].attribute, &value);
82 printf("\t%-32s: %10d (0x%08x)\n", attributes[attr].name, value, value);
83 }
84 }
85
86 delete [] configs;
87 eglTerminate(dpy);
88 return 0;
89 }
90