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