2 * Copyright (C) 2011 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef _SYSTEM_EGL_DISPLAY_H
17 #define _SYSTEM_EGL_DISPLAY_H
22 #include <EGL/eglext.h>
23 #include "EGLClientIface.h"
24 #include <utils/KeyedVector.h>
26 #include <ui/PixelFormat.h>
28 #define ATTRIBUTE_NONE -1
29 //FIXME: are we in this namespace?
30 using namespace android;
38 bool initialize(EGLClient_eglInterface *eglIface);
41 int getVersionMajor() const { return m_major; }
42 int getVersionMinor() const { return m_minor; }
43 bool initialized() const { return m_initialized; }
45 const char *queryString(EGLint name);
47 const EGLClient_glesInterface *gles_iface() const { return m_gles_iface; }
48 const EGLClient_glesInterface *gles2_iface() const { return m_gles2_iface; }
50 int getNumConfigs(){ return m_numConfigs; }
51 EGLBoolean getConfigAttrib(EGLConfig config, EGLint attrib, EGLint * value);
52 EGLBoolean setConfigAttrib(EGLConfig config, EGLint attrib, EGLint value);
53 EGLBoolean getConfigGLPixelFormat(EGLConfig config, GLenum * format);
54 EGLBoolean getConfigNativePixelFormat(EGLConfig config, PixelFormat * format);
56 void dumpConfig(EGLConfig config);
58 EGLClient_glesInterface *loadGLESClientAPI(const char *libName,
59 EGLClient_eglInterface *eglIface,
61 EGLBoolean getAttribValue(EGLConfig config, EGLint attribIdxi, EGLint * value);
62 EGLBoolean setAttribValue(EGLConfig config, EGLint attribIdxi, EGLint value);
63 void processConfigs();
66 pthread_mutex_t m_lock;
70 int m_hostRendererVersion;
72 int m_numConfigAttribs;
74 /* This is the mapping between an attribute name to it's index in any given config */
75 DefaultKeyedVector<EGLint, EGLint> m_attribs;
76 /* This is an array of all config's attributes values stored in the following sequencial fasion (read: v[c,a] = the value of attribute <a> of config <c>)
77 * v[0,0],..,v[0,m_numConfigAttribs-1],
79 * v[m_numConfigs-1,0],..,v[m_numConfigs-1,m_numConfigAttribs-1]
82 EGLClient_glesInterface *m_gles_iface;
83 EGLClient_glesInterface *m_gles2_iface;
84 char *m_versionString;
86 char *m_extensionString;