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 WL_bind_wayland_display
;
63 EGLBoolean KHR_image_base
;
64 EGLBoolean KHR_image_pixmap
;
65 EGLBoolean KHR_vg_parent_image
;
66 EGLBoolean KHR_gl_texture_2D_image
;
67 EGLBoolean KHR_gl_texture_cubemap_image
;
68 EGLBoolean KHR_gl_texture_3D_image
;
69 EGLBoolean KHR_gl_renderbuffer_image
;
71 EGLBoolean KHR_reusable_sync
;
72 EGLBoolean KHR_fence_sync
;
74 EGLBoolean KHR_surfaceless_gles1
;
75 EGLBoolean KHR_surfaceless_gles2
;
76 EGLBoolean KHR_surfaceless_opengl
;
78 EGLBoolean NOK_swap_region
;
79 EGLBoolean NOK_texture_from_pixmap
;
85 /* used to link displays */
90 _EGLPlatformType Platform
; /**< The type of the platform display */
91 void *PlatformDisplay
; /**< A pointer to the platform display */
93 _EGLDriver
*Driver
; /**< Matched driver of the display */
94 EGLBoolean Initialized
; /**< True if the display is initialized */
96 /* options that affect how the driver initializes the display */
98 EGLBoolean TestOnly
; /**< Driver should not set fields when true */
99 EGLBoolean UseFallback
; /**< Use fallback driver (sw or less features) */
102 /* these fields are set by the driver during init */
103 void *DriverData
; /**< Driver private data */
104 EGLint VersionMajor
; /**< EGL major version */
105 EGLint VersionMinor
; /**< EGL minor version */
106 EGLint ClientAPIs
; /**< Bitmask of APIs supported (EGL_xxx_BIT) */
107 _EGLExtensions Extensions
; /**< Extensions supported */
109 /* these fields are derived from above */
110 char VersionString
[1000]; /**< EGL_VERSION */
111 char ClientAPIsString
[1000]; /**< EGL_CLIENT_APIS */
112 char ExtensionsString
[_EGL_MAX_EXTENSIONS_LEN
]; /**< EGL_EXTENSIONS */
117 /* lists of resources */
118 _EGLResource
*ResourceLists
[_EGL_NUM_RESOURCES
];
122 extern _EGLPlatformType
123 _eglGetNativePlatform(void);
127 _eglFiniDisplay(void);
131 _eglFindDisplay(_EGLPlatformType plat
, void *plat_dpy
);
135 _eglReleaseDisplayResources(_EGLDriver
*drv
, _EGLDisplay
*dpy
);
139 _eglCleanupDisplay(_EGLDisplay
*disp
);
143 _eglCheckDisplayHandle(EGLDisplay dpy
);
147 _eglCheckResource(void *res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
151 * Lookup a handle to find the linked display.
152 * Return NULL if the handle has no corresponding linked display.
154 static INLINE _EGLDisplay
*
155 _eglLookupDisplay(EGLDisplay display
)
157 _EGLDisplay
*dpy
= (_EGLDisplay
*) display
;
158 if (!_eglCheckDisplayHandle(display
))
165 * Return the handle of a linked display, or EGL_NO_DISPLAY.
167 static INLINE EGLDisplay
168 _eglGetDisplayHandle(_EGLDisplay
*dpy
)
170 return (EGLDisplay
) ((dpy
) ? dpy
: EGL_NO_DISPLAY
);
175 _eglInitResource(_EGLResource
*res
, EGLint size
, _EGLDisplay
*dpy
);
179 _eglGetResource(_EGLResource
*res
);
183 _eglPutResource(_EGLResource
*res
);
187 _eglLinkResource(_EGLResource
*res
, _EGLResourceType type
);
191 _eglUnlinkResource(_EGLResource
*res
, _EGLResourceType type
);
195 * Return true if the resource is linked.
197 static INLINE EGLBoolean
198 _eglIsResourceLinked(_EGLResource
*res
)
200 return res
->IsLinked
;
204 #endif /* EGLDISPLAY_INCLUDED */