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
,
17 * A resource of a display.
27 * Optional EGL extensions info.
29 struct _egl_extensions
31 EGLBoolean MESA_screen_surface
;
32 EGLBoolean MESA_copy_context
;
34 char String
[_EGL_MAX_EXTENSIONS_LEN
];
40 /* used to link displays */
43 EGLNativeDisplayType NativeDisplay
;
46 void *DriverData
; /* private to driver */
48 int APImajor
, APIminor
; /**< as returned by eglInitialize() */
49 char Version
[1000]; /**< initialized from APImajor/minor, DriverName */
51 /** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
52 EGLint ClientAPIsMask
;
53 char ClientAPIs
[1000]; /**< updated by eglQueryString */
55 _EGLExtensions Extensions
;
60 _EGLScreen
**Screens
; /* array [NumScreens] */
64 _EGLConfig
**Configs
; /* array [NumConfigs] of ptr to _EGLConfig */
66 /* lists of resources */
67 _EGLResource
*ResourceLists
[_EGL_NUM_RESOURCES
];
72 _eglFiniDisplay(void);
76 _eglNewDisplay(NativeDisplayType displayName
);
80 _eglLinkDisplay(_EGLDisplay
*dpy
);
84 _eglUnlinkDisplay(_EGLDisplay
*dpy
);
88 _eglFindDisplay(NativeDisplayType nativeDisplay
);
92 _eglReleaseDisplayResources(_EGLDriver
*drv
, _EGLDisplay
*dpy
);
96 _eglCleanupDisplay(_EGLDisplay
*disp
);
99 #ifndef _EGL_SKIP_HANDLE_CHECK
103 _eglCheckDisplayHandle(EGLDisplay dpy
);
107 _eglCheckResource(_EGLResource
*res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
110 #else /* !_EGL_SKIP_HANDLE_CHECK */
112 /* Only do a quick check. This is NOT standard compliant. */
114 static INLINE EGLBoolean
115 _eglCheckDisplayHandle(EGLDisplay dpy
)
117 return ((_EGLDisplay
*) dpy
!= NULL
);
121 static INLINE EGLBoolean
122 _eglCheckResource(_EGLResource
*res
, _EGLResourceType type
, _EGLDisplay
*dpy
)
124 return (res
->Display
== dpy
);
128 #endif /* _EGL_SKIP_HANDLE_CHECK */
132 * Lookup a handle to find the linked display.
133 * Return NULL if the handle has no corresponding linked display.
135 static INLINE _EGLDisplay
*
136 _eglLookupDisplay(EGLDisplay display
)
138 _EGLDisplay
*dpy
= (_EGLDisplay
*) display
;
139 if (!_eglCheckDisplayHandle(display
))
146 * Return the handle of a linked display, or EGL_NO_DISPLAY.
148 static INLINE EGLDisplay
149 _eglGetDisplayHandle(_EGLDisplay
*dpy
)
151 return (EGLDisplay
) ((dpy
) ? dpy
: EGL_NO_DISPLAY
);
156 * Return true if the display is linked.
158 static INLINE EGLBoolean
159 _eglIsDisplayLinked(_EGLDisplay
*dpy
)
161 return (EGLBoolean
) (_eglGetDisplayHandle(dpy
) != EGL_NO_DISPLAY
);
166 _eglLinkResource(_EGLResource
*res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
170 _eglUnlinkResource(_EGLResource
*res
, _EGLResourceType type
);
174 * Return true if the resource is linked.
176 static INLINE EGLBoolean
177 _eglIsResourceLinked(_EGLResource
*res
)
179 return (res
->Display
!= NULL
);
183 #endif /* EGLDISPLAY_INCLUDED */