1 #ifndef EGLDISPLAY_INCLUDED
2 #define EGLDISPLAY_INCLUDED
5 #include "egltypedefs.h"
6 #include "egldefines.h"
11 enum _egl_platform_type
{
12 _EGL_PLATFORM_WINDOWS
,
14 _EGL_PLATFORM_WAYLAND
,
19 _EGL_INVALID_PLATFORM
= -1
21 typedef enum _egl_platform_type _EGLPlatformType
;
24 enum _egl_resource_type
{
25 _EGL_RESOURCE_CONTEXT
,
26 _EGL_RESOURCE_SURFACE
,
32 /* this cannot and need not go into egltypedefs.h */
33 typedef enum _egl_resource_type _EGLResourceType
;
37 * A resource of a display.
41 /* which display the resource belongs to */
46 /* used to link resources of the same type */
52 * Optional EGL extensions info.
54 struct _egl_extensions
56 EGLBoolean MESA_screen_surface
;
57 EGLBoolean MESA_copy_context
;
58 EGLBoolean MESA_drm_display
;
59 EGLBoolean MESA_drm_image
;
61 EGLBoolean KHR_image_base
;
62 EGLBoolean KHR_image_pixmap
;
63 EGLBoolean KHR_vg_parent_image
;
64 EGLBoolean KHR_gl_texture_2D_image
;
65 EGLBoolean KHR_gl_texture_cubemap_image
;
66 EGLBoolean KHR_gl_texture_3D_image
;
67 EGLBoolean KHR_gl_renderbuffer_image
;
69 EGLBoolean KHR_reusable_sync
;
70 EGLBoolean KHR_fence_sync
;
72 EGLBoolean KHR_surfaceless_gles1
;
73 EGLBoolean KHR_surfaceless_gles2
;
74 EGLBoolean KHR_surfaceless_opengl
;
76 EGLBoolean NOK_swap_region
;
77 EGLBoolean NOK_texture_from_pixmap
;
83 /* used to link displays */
88 _EGLPlatformType Platform
; /**< The type of the platform display */
89 void *PlatformDisplay
; /**< A pointer to the platform display */
91 _EGLDriver
*Driver
; /**< Matched driver of the display */
92 EGLBoolean Initialized
; /**< True if the display is initialized */
94 /* options that affect how the driver initializes the display */
96 EGLBoolean TestOnly
; /**< Driver should not set fields when true */
97 EGLBoolean UseFallback
; /**< Use fallback driver (sw or less features) */
100 /* these fields are set by the driver during init */
101 void *DriverData
; /**< Driver private data */
102 EGLint VersionMajor
; /**< EGL major version */
103 EGLint VersionMinor
; /**< EGL minor version */
104 EGLint ClientAPIs
; /**< Bitmask of APIs supported (EGL_xxx_BIT) */
105 _EGLExtensions Extensions
; /**< Extensions supported */
107 /* these fields are derived from above */
108 char VersionString
[1000]; /**< EGL_VERSION */
109 char ClientAPIsString
[1000]; /**< EGL_CLIENT_APIS */
110 char ExtensionsString
[_EGL_MAX_EXTENSIONS_LEN
]; /**< EGL_EXTENSIONS */
115 /* lists of resources */
116 _EGLResource
*ResourceLists
[_EGL_NUM_RESOURCES
];
120 extern _EGLPlatformType
121 _eglGetNativePlatform(void);
125 _eglFiniDisplay(void);
129 _eglFindDisplay(_EGLPlatformType plat
, void *plat_dpy
);
133 _eglReleaseDisplayResources(_EGLDriver
*drv
, _EGLDisplay
*dpy
);
137 _eglCleanupDisplay(_EGLDisplay
*disp
);
141 _eglCheckDisplayHandle(EGLDisplay dpy
);
145 _eglCheckResource(void *res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
149 * Lookup a handle to find the linked display.
150 * Return NULL if the handle has no corresponding linked display.
152 static INLINE _EGLDisplay
*
153 _eglLookupDisplay(EGLDisplay display
)
155 _EGLDisplay
*dpy
= (_EGLDisplay
*) display
;
156 if (!_eglCheckDisplayHandle(display
))
163 * Return the handle of a linked display, or EGL_NO_DISPLAY.
165 static INLINE EGLDisplay
166 _eglGetDisplayHandle(_EGLDisplay
*dpy
)
168 return (EGLDisplay
) ((dpy
) ? dpy
: EGL_NO_DISPLAY
);
173 _eglInitResource(_EGLResource
*res
, EGLint size
, _EGLDisplay
*dpy
);
177 _eglGetResource(_EGLResource
*res
);
181 _eglPutResource(_EGLResource
*res
);
185 _eglLinkResource(_EGLResource
*res
, _EGLResourceType type
);
189 _eglUnlinkResource(_EGLResource
*res
, _EGLResourceType type
);
193 * Return true if the resource is linked.
195 static INLINE EGLBoolean
196 _eglIsResourceLinked(_EGLResource
*res
)
198 return res
->IsLinked
;
202 #endif /* EGLDISPLAY_INCLUDED */