1 #ifndef EGLCONFIG_INCLUDED
2 #define EGLCONFIG_INCLUDED
6 #include "egltypedefs.h"
9 #define _EGL_CONFIG_FIRST_ATTRIB EGL_BUFFER_SIZE
10 #define _EGL_CONFIG_LAST_ATTRIB EGL_CONFORMANT
11 #define _EGL_CONFIG_NUM_ATTRIBS \
12 (_EGL_CONFIG_LAST_ATTRIB - _EGL_CONFIG_FIRST_ATTRIB + 1)
14 #define _EGL_CONFIG_STORAGE_SIZE _EGL_CONFIG_NUM_ATTRIBS
20 EGLint Storage
[_EGL_CONFIG_STORAGE_SIZE
];
25 * Macros for source level compatibility.
27 #define SET_CONFIG_ATTRIB(CONF, ATTR, VAL) _eglSetConfigKey(CONF, ATTR, VAL)
28 #define GET_CONFIG_ATTRIB(CONF, ATTR) _eglGetConfigKey(CONF, ATTR)
32 * Given a key, return an index into the storage of the config.
33 * Return -1 if the key is invalid.
36 _eglIndexConfig(const _EGLConfig
*conf
, EGLint key
)
39 if (key
>= _EGL_CONFIG_FIRST_ATTRIB
&&
40 key
< _EGL_CONFIG_FIRST_ATTRIB
+ _EGL_CONFIG_NUM_ATTRIBS
)
41 return key
- _EGL_CONFIG_FIRST_ATTRIB
;
48 * Reset all keys in the config to a given value.
51 _eglResetConfigKeys(_EGLConfig
*conf
, EGLint val
)
54 for (i
= 0; i
< _EGL_CONFIG_NUM_ATTRIBS
; i
++)
55 conf
->Storage
[i
] = val
;
60 * Update a config for a given key.
62 * Note that a valid key is not necessarily a valid attribute. There are gaps
63 * in the attribute enums. The separation is to catch application errors.
64 * Drivers should never set a key that is an invalid attribute.
67 _eglSetConfigKey(_EGLConfig
*conf
, EGLint key
, EGLint val
)
69 EGLint idx
= _eglIndexConfig(conf
, key
);
71 conf
->Storage
[idx
] = val
;
76 * Return the value for a given key.
79 _eglGetConfigKey(const _EGLConfig
*conf
, EGLint key
)
81 EGLint idx
= _eglIndexConfig(conf
, key
);
83 return conf
->Storage
[idx
];
88 _eglInitConfig(_EGLConfig
*config
, _EGLDisplay
*dpy
, EGLint id
);
92 _eglAddConfig(_EGLDisplay
*dpy
, _EGLConfig
*conf
);
96 _eglCheckConfigHandle(EGLConfig config
, _EGLDisplay
*dpy
);
100 * Lookup a handle to find the linked config.
101 * Return NULL if the handle has no corresponding linked config.
103 static INLINE _EGLConfig
*
104 _eglLookupConfig(EGLConfig config
, _EGLDisplay
*dpy
)
106 _EGLConfig
*conf
= (_EGLConfig
*) config
;
107 if (!_eglCheckConfigHandle(config
, dpy
))
114 * Return the handle of a linked config, or NULL.
116 static INLINE EGLConfig
117 _eglGetConfigHandle(_EGLConfig
*conf
)
119 return (EGLConfig
) ((conf
&& conf
->Display
) ? conf
: NULL
);
124 _eglValidateConfig(const _EGLConfig
*conf
, EGLBoolean for_matching
);
128 _eglMatchConfig(const _EGLConfig
*conf
, const _EGLConfig
*criteria
);
132 _eglParseConfigAttribList(_EGLConfig
*conf
, const EGLint
*attrib_list
);
136 _eglCompareConfigs(const _EGLConfig
*conf1
, const _EGLConfig
*conf2
,
137 const _EGLConfig
*criteria
, EGLBoolean compare_id
);
141 _eglSortConfigs(const _EGLConfig
**configs
, EGLint count
,
142 EGLint (*compare
)(const _EGLConfig
*, const _EGLConfig
*,
148 _eglChooseConfig(_EGLDriver
*drv
, _EGLDisplay
*dpy
, const EGLint
*attrib_list
, EGLConfig
*configs
, EGLint config_size
, EGLint
*num_config
);
152 _eglGetConfigAttrib(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLConfig
*conf
, EGLint attribute
, EGLint
*value
);
156 _eglGetConfigs(_EGLDriver
*drv
, _EGLDisplay
*dpy
, EGLConfig
*configs
, EGLint config_size
, EGLint
*num_config
);
159 #endif /* EGLCONFIG_INCLUDED */