2011-07-02 17:57:30 +09:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
|
|
|
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
|
|
|
* Copyright 2010-2011 LunarG, Inc.
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sub license, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial portions
|
|
|
|
* of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
2005-04-22 21:09:39 +00:00
|
|
|
#ifndef EGLDISPLAY_INCLUDED
|
|
|
|
#define EGLDISPLAY_INCLUDED
|
|
|
|
|
2010-01-29 09:00:30 +08:00
|
|
|
|
2005-04-22 21:09:39 +00:00
|
|
|
#include "egltypedefs.h"
|
2009-08-13 13:38:24 +08:00
|
|
|
#include "egldefines.h"
|
2010-02-17 17:29:52 +08:00
|
|
|
#include "eglmutex.h"
|
2010-06-30 17:10:10 +08:00
|
|
|
#include "eglarray.h"
|
2009-08-13 13:38:24 +08:00
|
|
|
|
|
|
|
|
2010-06-17 17:14:03 +08:00
|
|
|
enum _egl_platform_type {
|
|
|
|
_EGL_PLATFORM_WINDOWS,
|
|
|
|
_EGL_PLATFORM_X11,
|
2011-02-04 12:22:58 +01:00
|
|
|
_EGL_PLATFORM_WAYLAND,
|
2010-06-17 17:14:03 +08:00
|
|
|
_EGL_PLATFORM_DRM,
|
|
|
|
_EGL_PLATFORM_FBDEV,
|
2010-10-11 16:09:52 +08:00
|
|
|
_EGL_PLATFORM_ANDROID,
|
2010-06-17 17:14:03 +08:00
|
|
|
|
|
|
|
_EGL_NUM_PLATFORMS,
|
|
|
|
_EGL_INVALID_PLATFORM = -1
|
|
|
|
};
|
|
|
|
typedef enum _egl_platform_type _EGLPlatformType;
|
|
|
|
|
|
|
|
|
2010-01-24 20:30:04 +08:00
|
|
|
enum _egl_resource_type {
|
|
|
|
_EGL_RESOURCE_CONTEXT,
|
|
|
|
_EGL_RESOURCE_SURFACE,
|
2009-08-15 22:58:13 +08:00
|
|
|
_EGL_RESOURCE_IMAGE,
|
2010-08-14 23:09:12 +08:00
|
|
|
_EGL_RESOURCE_SYNC,
|
2010-01-24 20:30:04 +08:00
|
|
|
|
|
|
|
_EGL_NUM_RESOURCES
|
|
|
|
};
|
2010-02-19 11:47:54 +08:00
|
|
|
/* this cannot and need not go into egltypedefs.h */
|
|
|
|
typedef enum _egl_resource_type _EGLResourceType;
|
2010-01-24 20:30:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A resource of a display.
|
|
|
|
*/
|
|
|
|
struct _egl_resource
|
|
|
|
{
|
2010-01-26 15:16:49 +08:00
|
|
|
/* which display the resource belongs to */
|
2010-01-24 20:30:04 +08:00
|
|
|
_EGLDisplay *Display;
|
2010-01-26 15:16:49 +08:00
|
|
|
EGLBoolean IsLinked;
|
2010-10-23 11:59:03 +08:00
|
|
|
EGLint RefCount;
|
2010-01-26 15:16:49 +08:00
|
|
|
|
|
|
|
/* used to link resources of the same type */
|
2010-01-24 20:30:04 +08:00
|
|
|
_EGLResource *Next;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-08-13 13:38:24 +08:00
|
|
|
/**
|
|
|
|
* Optional EGL extensions info.
|
|
|
|
*/
|
|
|
|
struct _egl_extensions
|
|
|
|
{
|
|
|
|
EGLBoolean MESA_screen_surface;
|
|
|
|
EGLBoolean MESA_copy_context;
|
2010-06-17 17:09:01 +08:00
|
|
|
EGLBoolean MESA_drm_display;
|
2010-06-04 14:28:59 -04:00
|
|
|
EGLBoolean MESA_drm_image;
|
2010-08-14 23:09:12 +08:00
|
|
|
|
2011-02-21 16:22:34 +01:00
|
|
|
EGLBoolean WL_bind_wayland_display;
|
|
|
|
|
2009-08-15 22:58:13 +08:00
|
|
|
EGLBoolean KHR_image_base;
|
|
|
|
EGLBoolean KHR_image_pixmap;
|
2010-01-31 17:34:02 +08:00
|
|
|
EGLBoolean KHR_vg_parent_image;
|
|
|
|
EGLBoolean KHR_gl_texture_2D_image;
|
|
|
|
EGLBoolean KHR_gl_texture_cubemap_image;
|
|
|
|
EGLBoolean KHR_gl_texture_3D_image;
|
|
|
|
EGLBoolean KHR_gl_renderbuffer_image;
|
2010-08-14 23:09:12 +08:00
|
|
|
|
|
|
|
EGLBoolean KHR_reusable_sync;
|
2010-08-15 17:09:48 +08:00
|
|
|
EGLBoolean KHR_fence_sync;
|
2010-08-14 23:09:12 +08:00
|
|
|
|
2010-06-02 22:48:06 -04:00
|
|
|
EGLBoolean KHR_surfaceless_gles1;
|
|
|
|
EGLBoolean KHR_surfaceless_gles2;
|
|
|
|
EGLBoolean KHR_surfaceless_opengl;
|
2010-08-14 23:09:12 +08:00
|
|
|
|
2010-05-06 22:01:35 -04:00
|
|
|
EGLBoolean NOK_swap_region;
|
2010-05-06 22:40:25 -04:00
|
|
|
EGLBoolean NOK_texture_from_pixmap;
|
2009-08-13 13:38:24 +08:00
|
|
|
};
|
2005-04-22 21:09:39 +00:00
|
|
|
|
|
|
|
|
2010-06-17 17:14:03 +08:00
|
|
|
struct _egl_display
|
2005-04-22 21:09:39 +00:00
|
|
|
{
|
2009-08-14 17:47:00 +08:00
|
|
|
/* used to link displays */
|
|
|
|
_EGLDisplay *Next;
|
|
|
|
|
2010-02-17 17:29:52 +08:00
|
|
|
_EGLMutex Mutex;
|
|
|
|
|
2011-01-13 16:53:13 +08:00
|
|
|
_EGLPlatformType Platform; /**< The type of the platform display */
|
|
|
|
void *PlatformDisplay; /**< A pointer to the platform display */
|
2009-08-13 13:38:24 +08:00
|
|
|
|
2011-01-13 16:53:13 +08:00
|
|
|
_EGLDriver *Driver; /**< Matched driver of the display */
|
|
|
|
EGLBoolean Initialized; /**< True if the display is initialized */
|
2009-08-13 13:38:24 +08:00
|
|
|
|
2011-01-13 00:27:45 +08:00
|
|
|
/* options that affect how the driver initializes the display */
|
|
|
|
struct {
|
|
|
|
EGLBoolean TestOnly; /**< Driver should not set fields when true */
|
2011-01-13 04:40:38 +08:00
|
|
|
EGLBoolean UseFallback; /**< Use fallback driver (sw or less features) */
|
2011-01-13 00:27:45 +08:00
|
|
|
} Options;
|
|
|
|
|
2011-01-13 16:53:13 +08:00
|
|
|
/* these fields are set by the driver during init */
|
|
|
|
void *DriverData; /**< Driver private data */
|
|
|
|
EGLint VersionMajor; /**< EGL major version */
|
|
|
|
EGLint VersionMinor; /**< EGL minor version */
|
|
|
|
EGLint ClientAPIs; /**< Bitmask of APIs supported (EGL_xxx_BIT) */
|
|
|
|
_EGLExtensions Extensions; /**< Extensions supported */
|
2009-08-13 13:38:24 +08:00
|
|
|
|
2011-01-13 16:53:13 +08:00
|
|
|
/* these fields are derived from above */
|
|
|
|
char VersionString[1000]; /**< EGL_VERSION */
|
|
|
|
char ClientAPIsString[1000]; /**< EGL_CLIENT_APIS */
|
|
|
|
char ExtensionsString[_EGL_MAX_EXTENSIONS_LEN]; /**< EGL_EXTENSIONS */
|
2009-08-13 13:38:24 +08:00
|
|
|
|
2010-06-30 18:02:23 +08:00
|
|
|
_EGLArray *Screens;
|
2010-06-30 17:10:10 +08:00
|
|
|
_EGLArray *Configs;
|
2008-05-27 16:48:23 -06:00
|
|
|
|
2010-01-24 20:32:34 +08:00
|
|
|
/* lists of resources */
|
2010-01-24 20:30:04 +08:00
|
|
|
_EGLResource *ResourceLists[_EGL_NUM_RESOURCES];
|
2005-04-22 21:09:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-06-17 23:45:41 +08:00
|
|
|
extern _EGLPlatformType
|
2011-08-09 14:23:18 +02:00
|
|
|
_eglGetNativePlatform(EGLNativeDisplayType nativeDisplay);
|
2010-06-17 23:45:41 +08:00
|
|
|
|
|
|
|
|
2009-08-14 17:47:00 +08:00
|
|
|
extern void
|
|
|
|
_eglFiniDisplay(void);
|
|
|
|
|
|
|
|
|
2005-04-22 21:09:39 +00:00
|
|
|
extern _EGLDisplay *
|
2010-06-17 17:14:03 +08:00
|
|
|
_eglFindDisplay(_EGLPlatformType plat, void *plat_dpy);
|
2009-07-16 21:21:56 -07:00
|
|
|
|
|
|
|
|
2010-01-05 21:39:15 +08:00
|
|
|
PUBLIC void
|
2009-08-11 17:09:39 +08:00
|
|
|
_eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *dpy);
|
2009-07-16 21:21:57 -07:00
|
|
|
|
|
|
|
|
2010-01-05 21:39:15 +08:00
|
|
|
PUBLIC void
|
2009-07-17 11:48:27 -06:00
|
|
|
_eglCleanupDisplay(_EGLDisplay *disp);
|
|
|
|
|
|
|
|
|
2009-08-14 18:02:38 +08:00
|
|
|
extern EGLBoolean
|
|
|
|
_eglCheckDisplayHandle(EGLDisplay dpy);
|
|
|
|
|
|
|
|
|
2010-01-26 15:10:18 +08:00
|
|
|
PUBLIC EGLBoolean
|
2010-01-25 11:39:44 +08:00
|
|
|
_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy);
|
2010-01-24 20:30:04 +08:00
|
|
|
|
|
|
|
|
2009-07-17 11:56:00 -06:00
|
|
|
/**
|
2009-08-14 18:05:19 +08:00
|
|
|
* Lookup a handle to find the linked display.
|
|
|
|
* Return NULL if the handle has no corresponding linked display.
|
|
|
|
*/
|
|
|
|
static INLINE _EGLDisplay *
|
|
|
|
_eglLookupDisplay(EGLDisplay display)
|
|
|
|
{
|
|
|
|
_EGLDisplay *dpy = (_EGLDisplay *) display;
|
2009-08-14 18:02:38 +08:00
|
|
|
if (!_eglCheckDisplayHandle(display))
|
|
|
|
dpy = NULL;
|
2009-08-14 18:05:19 +08:00
|
|
|
return dpy;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the handle of a linked display, or EGL_NO_DISPLAY.
|
|
|
|
*/
|
|
|
|
static INLINE EGLDisplay
|
|
|
|
_eglGetDisplayHandle(_EGLDisplay *dpy)
|
|
|
|
{
|
|
|
|
return (EGLDisplay) ((dpy) ? dpy : EGL_NO_DISPLAY);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-23 11:59:03 +08:00
|
|
|
extern void
|
|
|
|
_eglInitResource(_EGLResource *res, EGLint size, _EGLDisplay *dpy);
|
|
|
|
|
|
|
|
|
|
|
|
PUBLIC void
|
|
|
|
_eglGetResource(_EGLResource *res);
|
|
|
|
|
|
|
|
|
|
|
|
PUBLIC EGLBoolean
|
|
|
|
_eglPutResource(_EGLResource *res);
|
|
|
|
|
|
|
|
|
2010-01-24 20:30:04 +08:00
|
|
|
extern void
|
2010-10-23 00:37:19 +08:00
|
|
|
_eglLinkResource(_EGLResource *res, _EGLResourceType type);
|
2010-01-24 20:30:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
extern void
|
|
|
|
_eglUnlinkResource(_EGLResource *res, _EGLResourceType type);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the resource is linked.
|
|
|
|
*/
|
|
|
|
static INLINE EGLBoolean
|
|
|
|
_eglIsResourceLinked(_EGLResource *res)
|
|
|
|
{
|
2010-01-26 15:16:49 +08:00
|
|
|
return res->IsLinked;
|
2010-01-24 20:30:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-22 21:09:39 +00:00
|
|
|
#endif /* EGLDISPLAY_INCLUDED */
|