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.
28 * Optional EGL extensions info.
30 struct _egl_extensions
32 EGLBoolean MESA_screen_surface
;
33 EGLBoolean MESA_copy_context
;
34 EGLBoolean KHR_image_base
;
35 EGLBoolean KHR_image_pixmap
;
37 char String
[_EGL_MAX_EXTENSIONS_LEN
];
43 /* used to link displays */
46 EGLNativeDisplayType NativeDisplay
;
49 void *DriverData
; /* private to driver */
51 int APImajor
, APIminor
; /**< as returned by eglInitialize() */
52 char Version
[1000]; /**< initialized from APImajor/minor, DriverName */
54 /** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
55 EGLint ClientAPIsMask
;
56 char ClientAPIs
[1000]; /**< updated by eglQueryString */
58 _EGLExtensions Extensions
;
63 _EGLScreen
**Screens
; /* array [NumScreens] */
67 _EGLConfig
**Configs
; /* array [NumConfigs] of ptr to _EGLConfig */
69 /* lists of resources */
70 _EGLResource
*ResourceLists
[_EGL_NUM_RESOURCES
];
75 _eglFiniDisplay(void);
79 _eglNewDisplay(NativeDisplayType displayName
);
83 _eglLinkDisplay(_EGLDisplay
*dpy
);
87 _eglUnlinkDisplay(_EGLDisplay
*dpy
);
91 _eglFindDisplay(NativeDisplayType nativeDisplay
);
95 _eglReleaseDisplayResources(_EGLDriver
*drv
, _EGLDisplay
*dpy
);
99 _eglCleanupDisplay(_EGLDisplay
*disp
);
102 #ifndef _EGL_SKIP_HANDLE_CHECK
106 _eglCheckDisplayHandle(EGLDisplay dpy
);
110 _eglCheckResource(_EGLResource
*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(_EGLResource
*res
, _EGLResourceType type
, _EGLDisplay
*dpy
)
127 return (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 * Return true if the display is linked.
161 static INLINE EGLBoolean
162 _eglIsDisplayLinked(_EGLDisplay
*dpy
)
164 return (EGLBoolean
) (_eglGetDisplayHandle(dpy
) != EGL_NO_DISPLAY
);
169 _eglLinkResource(_EGLResource
*res
, _EGLResourceType type
, _EGLDisplay
*dpy
);
173 _eglUnlinkResource(_EGLResource
*res
, _EGLResourceType type
);
177 * Return true if the resource is linked.
179 static INLINE EGLBoolean
180 _eglIsResourceLinked(_EGLResource
*res
)
182 return (res
->Display
!= NULL
);
186 #endif /* EGLDISPLAY_INCLUDED */