1 #ifndef EGLDISPLAY_INCLUDED
2 #define EGLDISPLAY_INCLUDED
5 #include "egltypedefs.h"
6 #include "egldefines.h"
10 enum _egl_resource_type
{
11 _EGL_RESOURCE_CONTEXT
,
12 _EGL_RESOURCE_SURFACE
,
17 /* this cannot and need not go into egltypedefs.h */
18 typedef enum _egl_resource_type _EGLResourceType
;
22 * A resource of a display.
26 /* which display the resource belongs to */
30 /* used to link resources of the same type */
36 * Optional EGL extensions info.
38 struct _egl_extensions
40 EGLBoolean MESA_screen_surface
;
41 EGLBoolean MESA_copy_context
;
42 EGLBoolean KHR_image_base
;
43 EGLBoolean KHR_image_pixmap
;
44 EGLBoolean KHR_vg_parent_image
;
45 EGLBoolean KHR_gl_texture_2D_image
;
46 EGLBoolean KHR_gl_texture_cubemap_image
;
47 EGLBoolean KHR_gl_texture_3D_image
;
48 EGLBoolean KHR_gl_renderbuffer_image
;
50 char String
[_EGL_MAX_EXTENSIONS_LEN
];
56 /* used to link displays */
61 EGLNativeDisplayType NativeDisplay
;
63 EGLBoolean Initialized
; /**< True if the display is initialized */
65 void *DriverData
; /* private to driver */
67 int APImajor
, APIminor
; /**< as returned by eglInitialize() */
68 char Version
[1000]; /**< initialized from APImajor/minor, DriverName */
70 /** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
71 EGLint ClientAPIsMask
;
72 char ClientAPIs
[1000]; /**< updated by eglQueryString */
74 _EGLExtensions Extensions
;
77 _EGLScreen
**Screens
; /* array [NumScreens] */
81 _EGLConfig
**Configs
; /* array [NumConfigs] of ptr to _EGLConfig */
83 /* lists of resources */
84 _EGLResource
*ResourceLists
[_EGL_NUM_RESOURCES
];
89 _eglFiniDisplay(void);
93 _eglFindDisplay(EGLNativeDisplayType displayName
);
97 _eglReleaseDisplayResources(_EGLDriver
*drv
, _EGLDisplay
*dpy
);
101 _eglCleanupDisplay(_EGLDisplay
*disp
);
104 #ifndef _EGL_SKIP_HANDLE_CHECK
108 _eglCheckDisplayHandle(EGLDisplay dpy
);
112 _eglCheckResource(void *res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
115 #else /* !_EGL_SKIP_HANDLE_CHECK */
117 /* Only do a quick check. This is NOT standard compliant. */
119 static INLINE EGLBoolean
120 _eglCheckDisplayHandle(EGLDisplay dpy
)
122 return ((_EGLDisplay
*) dpy
!= NULL
);
126 static INLINE EGLBoolean
127 _eglCheckResource(void *res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
129 return (((_EGLResource
*) res
)->Display
== dpy
);
133 #endif /* _EGL_SKIP_HANDLE_CHECK */
137 * Lookup a handle to find the linked display.
138 * Return NULL if the handle has no corresponding linked display.
140 static INLINE _EGLDisplay
*
141 _eglLookupDisplay(EGLDisplay display
)
143 _EGLDisplay
*dpy
= (_EGLDisplay
*) display
;
144 if (!_eglCheckDisplayHandle(display
))
151 * Return the handle of a linked display, or EGL_NO_DISPLAY.
153 static INLINE EGLDisplay
154 _eglGetDisplayHandle(_EGLDisplay
*dpy
)
156 return (EGLDisplay
) ((dpy
) ? dpy
: EGL_NO_DISPLAY
);
161 _eglLinkResource(_EGLResource
*res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
165 _eglUnlinkResource(_EGLResource
*res
, _EGLResourceType type
);
169 * Return true if the resource is linked.
171 static INLINE EGLBoolean
172 _eglIsResourceLinked(_EGLResource
*res
)
174 return res
->IsLinked
;
178 #endif /* EGLDISPLAY_INCLUDED */