1 #ifndef EGLDISPLAY_INCLUDED
2 #define EGLDISPLAY_INCLUDED
5 #include "egltypedefs.h"
6 #include "egldefines.h"
9 enum _egl_resource_type
{
10 _EGL_RESOURCE_CONTEXT
,
11 _EGL_RESOURCE_SURFACE
,
19 * A resource of a display.
23 /* which display the resource belongs to */
27 /* used to link resources of the same type */
33 * Optional EGL extensions info.
35 struct _egl_extensions
37 EGLBoolean MESA_screen_surface
;
38 EGLBoolean MESA_copy_context
;
39 EGLBoolean KHR_image_base
;
40 EGLBoolean KHR_image_pixmap
;
41 EGLBoolean KHR_vg_parent_image
;
42 EGLBoolean KHR_gl_texture_2D_image
;
43 EGLBoolean KHR_gl_texture_cubemap_image
;
44 EGLBoolean KHR_gl_texture_3D_image
;
45 EGLBoolean KHR_gl_renderbuffer_image
;
47 char String
[_EGL_MAX_EXTENSIONS_LEN
];
53 /* used to link displays */
56 EGLNativeDisplayType NativeDisplay
;
58 EGLBoolean Initialized
; /**< True if the display is initialized */
60 void *DriverData
; /* private to driver */
62 int APImajor
, APIminor
; /**< as returned by eglInitialize() */
63 char Version
[1000]; /**< initialized from APImajor/minor, DriverName */
65 /** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
66 EGLint ClientAPIsMask
;
67 char ClientAPIs
[1000]; /**< updated by eglQueryString */
69 _EGLExtensions Extensions
;
72 _EGLScreen
**Screens
; /* array [NumScreens] */
76 _EGLConfig
**Configs
; /* array [NumConfigs] of ptr to _EGLConfig */
78 /* lists of resources */
79 _EGLResource
*ResourceLists
[_EGL_NUM_RESOURCES
];
84 _eglFiniDisplay(void);
88 _eglNewDisplay(EGLNativeDisplayType displayName
);
92 _eglLinkDisplay(_EGLDisplay
*dpy
);
96 _eglUnlinkDisplay(_EGLDisplay
*dpy
);
100 _eglFindDisplay(EGLNativeDisplayType nativeDisplay
);
104 _eglReleaseDisplayResources(_EGLDriver
*drv
, _EGLDisplay
*dpy
);
108 _eglCleanupDisplay(_EGLDisplay
*disp
);
111 #ifndef _EGL_SKIP_HANDLE_CHECK
115 _eglCheckDisplayHandle(EGLDisplay dpy
);
119 _eglCheckResource(void *res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
122 #else /* !_EGL_SKIP_HANDLE_CHECK */
124 /* Only do a quick check. This is NOT standard compliant. */
126 static INLINE EGLBoolean
127 _eglCheckDisplayHandle(EGLDisplay dpy
)
129 return ((_EGLDisplay
*) dpy
!= NULL
);
133 static INLINE EGLBoolean
134 _eglCheckResource(void *res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
136 return (((_EGLResource
*) res
)->Display
== dpy
);
140 #endif /* _EGL_SKIP_HANDLE_CHECK */
144 * Lookup a handle to find the linked display.
145 * Return NULL if the handle has no corresponding linked display.
147 static INLINE _EGLDisplay
*
148 _eglLookupDisplay(EGLDisplay display
)
150 _EGLDisplay
*dpy
= (_EGLDisplay
*) display
;
151 if (!_eglCheckDisplayHandle(display
))
158 * Return the handle of a linked display, or EGL_NO_DISPLAY.
160 static INLINE EGLDisplay
161 _eglGetDisplayHandle(_EGLDisplay
*dpy
)
163 return (EGLDisplay
) ((dpy
) ? dpy
: EGL_NO_DISPLAY
);
168 * Return true if the display is linked.
170 static INLINE EGLBoolean
171 _eglIsDisplayLinked(_EGLDisplay
*dpy
)
173 return (EGLBoolean
) (_eglGetDisplayHandle(dpy
) != EGL_NO_DISPLAY
);
178 _eglLinkResource(_EGLResource
*res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
182 _eglUnlinkResource(_EGLResource
*res
, _EGLResourceType type
);
186 * Return true if the resource is linked.
188 static INLINE EGLBoolean
189 _eglIsResourceLinked(_EGLResource
*res
)
191 return res
->IsLinked
;
195 #endif /* EGLDISPLAY_INCLUDED */