1 #ifndef EGLDISPLAY_INCLUDED
2 #define EGLDISPLAY_INCLUDED
4 #include "egltypedefs.h"
5 #include "egldefines.h"
8 enum _egl_resource_type
{
10 _EGL_RESOURCE_SURFACE
,
18 * A resource of a display.
22 /* which display the resource belongs to */
26 /* used to link resources of the same type */
32 * Optional EGL extensions info.
34 struct _egl_extensions
36 EGLBoolean MESA_screen_surface
;
37 EGLBoolean MESA_copy_context
;
38 EGLBoolean KHR_image_base
;
39 EGLBoolean KHR_image_pixmap
;
41 char String
[_EGL_MAX_EXTENSIONS_LEN
];
47 /* used to link displays */
50 EGLNativeDisplayType NativeDisplay
;
53 void *DriverData
; /* private to driver */
55 int APImajor
, APIminor
; /**< as returned by eglInitialize() */
56 char Version
[1000]; /**< initialized from APImajor/minor, DriverName */
58 /** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
59 EGLint ClientAPIsMask
;
60 char ClientAPIs
[1000]; /**< updated by eglQueryString */
62 _EGLExtensions Extensions
;
67 _EGLScreen
**Screens
; /* array [NumScreens] */
71 _EGLConfig
**Configs
; /* array [NumConfigs] of ptr to _EGLConfig */
73 /* lists of resources */
74 _EGLResource
*ResourceLists
[_EGL_NUM_RESOURCES
];
79 _eglFiniDisplay(void);
83 _eglNewDisplay(EGLNativeDisplayType displayName
);
87 _eglLinkDisplay(_EGLDisplay
*dpy
);
91 _eglUnlinkDisplay(_EGLDisplay
*dpy
);
95 _eglFindDisplay(EGLNativeDisplayType nativeDisplay
);
99 _eglReleaseDisplayResources(_EGLDriver
*drv
, _EGLDisplay
*dpy
);
103 _eglCleanupDisplay(_EGLDisplay
*disp
);
106 #ifndef _EGL_SKIP_HANDLE_CHECK
110 _eglCheckDisplayHandle(EGLDisplay dpy
);
114 _eglCheckResource(void *res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
117 #else /* !_EGL_SKIP_HANDLE_CHECK */
119 /* Only do a quick check. This is NOT standard compliant. */
121 static INLINE EGLBoolean
122 _eglCheckDisplayHandle(EGLDisplay dpy
)
124 return ((_EGLDisplay
*) dpy
!= NULL
);
128 static INLINE EGLBoolean
129 _eglCheckResource(void *res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
131 return (((_EGLResource
*) res
)->Display
== dpy
);
135 #endif /* _EGL_SKIP_HANDLE_CHECK */
139 * Lookup a handle to find the linked display.
140 * Return NULL if the handle has no corresponding linked display.
142 static INLINE _EGLDisplay
*
143 _eglLookupDisplay(EGLDisplay display
)
145 _EGLDisplay
*dpy
= (_EGLDisplay
*) display
;
146 if (!_eglCheckDisplayHandle(display
))
153 * Return the handle of a linked display, or EGL_NO_DISPLAY.
155 static INLINE EGLDisplay
156 _eglGetDisplayHandle(_EGLDisplay
*dpy
)
158 return (EGLDisplay
) ((dpy
) ? dpy
: EGL_NO_DISPLAY
);
163 * Return true if the display is linked.
165 static INLINE EGLBoolean
166 _eglIsDisplayLinked(_EGLDisplay
*dpy
)
168 return (EGLBoolean
) (_eglGetDisplayHandle(dpy
) != EGL_NO_DISPLAY
);
173 _eglLinkResource(_EGLResource
*res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
177 _eglUnlinkResource(_EGLResource
*res
, _EGLResourceType type
);
181 * Return true if the resource is linked.
183 static INLINE EGLBoolean
184 _eglIsResourceLinked(_EGLResource
*res
)
186 return res
->IsLinked
;
190 #endif /* EGLDISPLAY_INCLUDED */