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
,
20 * A resource of a display.
24 /* which display the resource belongs to */
28 /* used to link resources of the same type */
34 * Optional EGL extensions info.
36 struct _egl_extensions
38 EGLBoolean MESA_screen_surface
;
39 EGLBoolean MESA_copy_context
;
40 EGLBoolean KHR_image_base
;
41 EGLBoolean KHR_image_pixmap
;
42 EGLBoolean KHR_vg_parent_image
;
43 EGLBoolean KHR_gl_texture_2D_image
;
44 EGLBoolean KHR_gl_texture_cubemap_image
;
45 EGLBoolean KHR_gl_texture_3D_image
;
46 EGLBoolean KHR_gl_renderbuffer_image
;
48 char String
[_EGL_MAX_EXTENSIONS_LEN
];
54 /* used to link displays */
59 EGLNativeDisplayType NativeDisplay
;
61 EGLBoolean Initialized
; /**< True if the display is initialized */
63 void *DriverData
; /* private to driver */
65 int APImajor
, APIminor
; /**< as returned by eglInitialize() */
66 char Version
[1000]; /**< initialized from APImajor/minor, DriverName */
68 /** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
69 EGLint ClientAPIsMask
;
70 char ClientAPIs
[1000]; /**< updated by eglQueryString */
72 _EGLExtensions Extensions
;
75 _EGLScreen
**Screens
; /* array [NumScreens] */
79 _EGLConfig
**Configs
; /* array [NumConfigs] of ptr to _EGLConfig */
81 /* lists of resources */
82 _EGLResource
*ResourceLists
[_EGL_NUM_RESOURCES
];
87 _eglFiniDisplay(void);
91 _eglFindDisplay(EGLNativeDisplayType displayName
);
95 _eglReleaseDisplayResources(_EGLDriver
*drv
, _EGLDisplay
*dpy
);
99 _eglCleanupDisplay(_EGLDisplay
*disp
);
102 #ifndef _EGL_SKIP_HANDLE_CHECK
106 _eglCheckDisplayHandle(EGLDisplay dpy
);
110 _eglCheckResource(void *res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
113 #else /* !_EGL_SKIP_HANDLE_CHECK */
115 /* Only do a quick check. This is NOT standard compliant. */
117 static INLINE EGLBoolean
118 _eglCheckDisplayHandle(EGLDisplay dpy
)
120 return ((_EGLDisplay
*) dpy
!= NULL
);
124 static INLINE EGLBoolean
125 _eglCheckResource(void *res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
127 return (((_EGLResource
*) res
)->Display
== dpy
);
131 #endif /* _EGL_SKIP_HANDLE_CHECK */
135 * Lookup a handle to find the linked display.
136 * Return NULL if the handle has no corresponding linked display.
138 static INLINE _EGLDisplay
*
139 _eglLookupDisplay(EGLDisplay display
)
141 _EGLDisplay
*dpy
= (_EGLDisplay
*) display
;
142 if (!_eglCheckDisplayHandle(display
))
149 * Return the handle of a linked display, or EGL_NO_DISPLAY.
151 static INLINE EGLDisplay
152 _eglGetDisplayHandle(_EGLDisplay
*dpy
)
154 return (EGLDisplay
) ((dpy
) ? dpy
: EGL_NO_DISPLAY
);
159 _eglLinkResource(_EGLResource
*res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
163 _eglUnlinkResource(_EGLResource
*res
, _EGLResourceType type
);
167 * Return true if the resource is linked.
169 static INLINE EGLBoolean
170 _eglIsResourceLinked(_EGLResource
*res
)
172 return res
->IsLinked
;
176 #endif /* EGLDISPLAY_INCLUDED */