llvmpipe: twoside for specular color also
[mesa.git] / src / egl / main / egldisplay.h
1 #ifndef EGLDISPLAY_INCLUDED
2 #define EGLDISPLAY_INCLUDED
3
4
5 #include "egltypedefs.h"
6 #include "egldefines.h"
7 #include "eglmutex.h"
8 #include "eglarray.h"
9
10
11 enum _egl_platform_type {
12 _EGL_PLATFORM_WINDOWS,
13 _EGL_PLATFORM_X11,
14 _EGL_PLATFORM_DRM,
15 _EGL_PLATFORM_FBDEV,
16
17 _EGL_NUM_PLATFORMS,
18 _EGL_INVALID_PLATFORM = -1
19 };
20 typedef enum _egl_platform_type _EGLPlatformType;
21
22
23 enum _egl_resource_type {
24 _EGL_RESOURCE_CONTEXT,
25 _EGL_RESOURCE_SURFACE,
26 _EGL_RESOURCE_IMAGE,
27 _EGL_RESOURCE_SYNC,
28
29 _EGL_NUM_RESOURCES
30 };
31 /* this cannot and need not go into egltypedefs.h */
32 typedef enum _egl_resource_type _EGLResourceType;
33
34
35 /**
36 * A resource of a display.
37 */
38 struct _egl_resource
39 {
40 /* which display the resource belongs to */
41 _EGLDisplay *Display;
42 EGLBoolean IsLinked;
43
44 /* used to link resources of the same type */
45 _EGLResource *Next;
46 };
47
48
49 /**
50 * Optional EGL extensions info.
51 */
52 struct _egl_extensions
53 {
54 EGLBoolean MESA_screen_surface;
55 EGLBoolean MESA_copy_context;
56 EGLBoolean MESA_drm_display;
57 EGLBoolean MESA_drm_image;
58
59 EGLBoolean KHR_image_base;
60 EGLBoolean KHR_image_pixmap;
61 EGLBoolean KHR_vg_parent_image;
62 EGLBoolean KHR_gl_texture_2D_image;
63 EGLBoolean KHR_gl_texture_cubemap_image;
64 EGLBoolean KHR_gl_texture_3D_image;
65 EGLBoolean KHR_gl_renderbuffer_image;
66
67 EGLBoolean KHR_reusable_sync;
68 EGLBoolean KHR_fence_sync;
69
70 EGLBoolean KHR_surfaceless_gles1;
71 EGLBoolean KHR_surfaceless_gles2;
72 EGLBoolean KHR_surfaceless_opengl;
73
74 EGLBoolean NOK_swap_region;
75 EGLBoolean NOK_texture_from_pixmap;
76
77 char String[_EGL_MAX_EXTENSIONS_LEN];
78 };
79
80
81 struct _egl_display
82 {
83 /* used to link displays */
84 _EGLDisplay *Next;
85
86 _EGLMutex Mutex;
87
88 _EGLPlatformType Platform;
89 void *PlatformDisplay;
90
91 EGLBoolean Initialized; /**< True if the display is initialized */
92 _EGLDriver *Driver;
93 void *DriverData; /* private to driver */
94
95 int APImajor, APIminor; /**< as returned by eglInitialize() */
96 char Version[1000]; /**< initialized from APImajor/minor, DriverName */
97
98 /** Bitmask of supported APIs (EGL_xx_BIT) set by the driver during init */
99 EGLint ClientAPIsMask;
100 char ClientAPIs[1000]; /**< updated by eglQueryString */
101
102 _EGLExtensions Extensions;
103
104 _EGLArray *Screens;
105 _EGLArray *Configs;
106
107 /* lists of resources */
108 _EGLResource *ResourceLists[_EGL_NUM_RESOURCES];
109 };
110
111
112 extern _EGLPlatformType
113 _eglGetNativePlatform(void);
114
115
116 extern void
117 _eglFiniDisplay(void);
118
119
120 extern _EGLDisplay *
121 _eglFindDisplay(_EGLPlatformType plat, void *plat_dpy);
122
123
124 PUBLIC void
125 _eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *dpy);
126
127
128 PUBLIC void
129 _eglCleanupDisplay(_EGLDisplay *disp);
130
131
132 extern EGLBoolean
133 _eglCheckDisplayHandle(EGLDisplay dpy);
134
135
136 PUBLIC EGLBoolean
137 _eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy);
138
139
140 /**
141 * Lookup a handle to find the linked display.
142 * Return NULL if the handle has no corresponding linked display.
143 */
144 static INLINE _EGLDisplay *
145 _eglLookupDisplay(EGLDisplay display)
146 {
147 _EGLDisplay *dpy = (_EGLDisplay *) display;
148 if (!_eglCheckDisplayHandle(display))
149 dpy = NULL;
150 return dpy;
151 }
152
153
154 /**
155 * Return the handle of a linked display, or EGL_NO_DISPLAY.
156 */
157 static INLINE EGLDisplay
158 _eglGetDisplayHandle(_EGLDisplay *dpy)
159 {
160 return (EGLDisplay) ((dpy) ? dpy : EGL_NO_DISPLAY);
161 }
162
163
164 extern void
165 _eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy);
166
167
168 extern void
169 _eglUnlinkResource(_EGLResource *res, _EGLResourceType type);
170
171
172 /**
173 * Return true if the resource is linked.
174 */
175 static INLINE EGLBoolean
176 _eglIsResourceLinked(_EGLResource *res)
177 {
178 return res->IsLinked;
179 }
180
181
182 #endif /* EGLDISPLAY_INCLUDED */