2005-04-22 22:09:39 +01:00
|
|
|
#ifndef EGLCONFIG_INCLUDED
|
|
|
|
#define EGLCONFIG_INCLUDED
|
|
|
|
|
|
|
|
|
2009-09-25 15:54:34 +01:00
|
|
|
#include <assert.h>
|
2005-04-22 22:09:39 +01:00
|
|
|
#include "egltypedefs.h"
|
|
|
|
|
|
|
|
|
2009-09-25 15:54:34 +01:00
|
|
|
#define _EGL_CONFIG_FIRST_ATTRIB EGL_BUFFER_SIZE
|
|
|
|
#define _EGL_CONFIG_LAST_ATTRIB EGL_CONFORMANT
|
2010-05-07 03:40:25 +01:00
|
|
|
#define _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS \
|
2009-09-25 15:54:34 +01:00
|
|
|
(_EGL_CONFIG_LAST_ATTRIB - _EGL_CONFIG_FIRST_ATTRIB + 1)
|
|
|
|
|
2010-05-07 03:40:25 +01:00
|
|
|
/* Attributes outside the contiguous block:
|
|
|
|
*
|
|
|
|
* EGL_Y_INVERTED_NOK
|
|
|
|
*/
|
|
|
|
#define _EGL_CONFIG_FIRST_EXTRA_ATTRIB _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS
|
|
|
|
#define _EGL_CONFIG_NUM_EXTRA_ATTRIBS 1
|
|
|
|
|
|
|
|
#define _EGL_CONFIG_NUM_ATTRIBS \
|
|
|
|
_EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS + _EGL_CONFIG_NUM_EXTRA_ATTRIBS
|
2005-04-22 22:09:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
struct _egl_config
|
|
|
|
{
|
2009-09-25 16:43:49 +01:00
|
|
|
_EGLDisplay *Display;
|
2010-05-07 03:40:25 +01:00
|
|
|
EGLint Storage[_EGL_CONFIG_NUM_ATTRIBS];
|
2005-04-22 22:09:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-02-05 05:33:55 +00:00
|
|
|
/**
|
|
|
|
* Macros for source level compatibility.
|
|
|
|
*/
|
2009-09-25 15:54:34 +01:00
|
|
|
#define SET_CONFIG_ATTRIB(CONF, ATTR, VAL) _eglSetConfigKey(CONF, ATTR, VAL)
|
|
|
|
#define GET_CONFIG_ATTRIB(CONF, ATTR) _eglGetConfigKey(CONF, ATTR)
|
2008-07-07 21:34:30 +01:00
|
|
|
|
|
|
|
|
2009-09-25 15:54:34 +01:00
|
|
|
/**
|
|
|
|
* Given a key, return an index into the storage of the config.
|
|
|
|
* Return -1 if the key is invalid.
|
|
|
|
*/
|
|
|
|
static INLINE EGLint
|
|
|
|
_eglIndexConfig(const _EGLConfig *conf, EGLint key)
|
|
|
|
{
|
|
|
|
(void) conf;
|
|
|
|
if (key >= _EGL_CONFIG_FIRST_ATTRIB &&
|
2010-05-07 03:40:25 +01:00
|
|
|
key < _EGL_CONFIG_FIRST_ATTRIB + _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS)
|
2009-09-25 15:54:34 +01:00
|
|
|
return key - _EGL_CONFIG_FIRST_ATTRIB;
|
2010-05-07 03:40:25 +01:00
|
|
|
|
|
|
|
switch (key) {
|
|
|
|
case EGL_Y_INVERTED_NOK:
|
|
|
|
return _EGL_CONFIG_FIRST_EXTRA_ATTRIB;
|
|
|
|
default:
|
2009-09-25 15:54:34 +01:00
|
|
|
return -1;
|
2010-05-07 03:40:25 +01:00
|
|
|
}
|
2009-09-25 15:54:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reset all keys in the config to a given value.
|
|
|
|
*/
|
|
|
|
static INLINE void
|
|
|
|
_eglResetConfigKeys(_EGLConfig *conf, EGLint val)
|
|
|
|
{
|
|
|
|
EGLint i;
|
|
|
|
for (i = 0; i < _EGL_CONFIG_NUM_ATTRIBS; i++)
|
|
|
|
conf->Storage[i] = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update a config for a given key.
|
2010-02-05 05:33:55 +00:00
|
|
|
*
|
|
|
|
* Note that a valid key is not necessarily a valid attribute. There are gaps
|
|
|
|
* in the attribute enums. The separation is to catch application errors.
|
|
|
|
* Drivers should never set a key that is an invalid attribute.
|
2009-09-25 15:54:34 +01:00
|
|
|
*/
|
|
|
|
static INLINE void
|
|
|
|
_eglSetConfigKey(_EGLConfig *conf, EGLint key, EGLint val)
|
|
|
|
{
|
|
|
|
EGLint idx = _eglIndexConfig(conf, key);
|
|
|
|
assert(idx >= 0);
|
|
|
|
conf->Storage[idx] = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the value for a given key.
|
|
|
|
*/
|
|
|
|
static INLINE EGLint
|
|
|
|
_eglGetConfigKey(const _EGLConfig *conf, EGLint key)
|
|
|
|
{
|
|
|
|
EGLint idx = _eglIndexConfig(conf, key);
|
|
|
|
assert(idx >= 0);
|
|
|
|
return conf->Storage[idx];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-05 13:39:15 +00:00
|
|
|
PUBLIC void
|
2010-01-31 06:32:31 +00:00
|
|
|
_eglInitConfig(_EGLConfig *config, _EGLDisplay *dpy, EGLint id);
|
2005-04-22 22:09:39 +01:00
|
|
|
|
|
|
|
|
2010-01-05 13:39:15 +00:00
|
|
|
PUBLIC EGLConfig
|
2009-09-25 16:43:49 +01:00
|
|
|
_eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf);
|
2008-05-27 21:33:54 +01:00
|
|
|
|
|
|
|
|
2009-09-25 16:43:49 +01:00
|
|
|
extern EGLBoolean
|
|
|
|
_eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lookup a handle to find the linked config.
|
|
|
|
* Return NULL if the handle has no corresponding linked config.
|
|
|
|
*/
|
|
|
|
static INLINE _EGLConfig *
|
|
|
|
_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy)
|
|
|
|
{
|
|
|
|
_EGLConfig *conf = (_EGLConfig *) config;
|
2010-09-09 17:02:47 +01:00
|
|
|
if (!dpy || !_eglCheckConfigHandle(config, dpy))
|
2009-09-25 16:43:49 +01:00
|
|
|
conf = NULL;
|
|
|
|
return conf;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the handle of a linked config, or NULL.
|
|
|
|
*/
|
|
|
|
static INLINE EGLConfig
|
|
|
|
_eglGetConfigHandle(_EGLConfig *conf)
|
|
|
|
{
|
|
|
|
return (EGLConfig) ((conf && conf->Display) ? conf : NULL);
|
|
|
|
}
|
2005-05-04 04:33:21 +01:00
|
|
|
|
|
|
|
|
2010-01-05 13:39:15 +00:00
|
|
|
PUBLIC EGLBoolean
|
2009-09-25 16:24:03 +01:00
|
|
|
_eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching);
|
|
|
|
|
|
|
|
|
2010-01-05 13:39:15 +00:00
|
|
|
PUBLIC EGLBoolean
|
2009-09-25 16:24:03 +01:00
|
|
|
_eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria);
|
|
|
|
|
|
|
|
|
2010-01-05 13:39:15 +00:00
|
|
|
PUBLIC EGLBoolean
|
2009-09-25 16:24:03 +01:00
|
|
|
_eglParseConfigAttribList(_EGLConfig *conf, const EGLint *attrib_list);
|
|
|
|
|
|
|
|
|
2010-01-05 13:39:15 +00:00
|
|
|
PUBLIC EGLint
|
2009-09-25 16:24:03 +01:00
|
|
|
_eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
|
|
|
|
const _EGLConfig *criteria, EGLBoolean compare_id);
|
|
|
|
|
|
|
|
|
2010-01-05 13:39:15 +00:00
|
|
|
PUBLIC void
|
2009-09-25 16:24:03 +01:00
|
|
|
_eglSortConfigs(const _EGLConfig **configs, EGLint count,
|
|
|
|
EGLint (*compare)(const _EGLConfig *, const _EGLConfig *,
|
|
|
|
void *),
|
|
|
|
void *priv_data);
|
2005-04-22 22:09:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
extern EGLBoolean
|
2009-08-11 10:09:39 +01:00
|
|
|
_eglChooseConfig(_EGLDriver *drv, _EGLDisplay *dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
2005-04-22 22:09:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
extern EGLBoolean
|
2009-08-11 10:09:39 +01:00
|
|
|
_eglGetConfigAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, EGLint attribute, EGLint *value);
|
2005-04-22 22:09:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
extern EGLBoolean
|
2009-08-11 10:09:39 +01:00
|
|
|
_eglGetConfigs(_EGLDriver *drv, _EGLDisplay *dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
2005-04-22 22:09:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* EGLCONFIG_INCLUDED */
|