Merge branch 'mesa_7_5_branch'
[mesa.git] / src / egl / main / eglsurface.h
1 #ifndef EGLSURFACE_INCLUDED
2 #define EGLSURFACE_INCLUDED
3
4
5 #include "egltypedefs.h"
6
7
8 /**
9 * "Base" class for device driver surfaces.
10 */
11 struct _egl_surface
12 {
13 /* Managed by EGLDisplay for linking */
14 _EGLDisplay *Display;
15 _EGLSurface *Next;
16 EGLSurface Handle;
17
18 /* The bound status of the surface */
19 _EGLContext *Binding;
20 EGLBoolean BoundToTexture;
21
22 _EGLConfig *Config;
23
24 EGLint Type; /* one of EGL_WINDOW_BIT, EGL_PIXMAP_BIT or EGL_PBUFFER_BIT */
25 EGLint Width, Height;
26 EGLint TextureFormat, TextureTarget;
27 EGLint MipmapTexture, MipmapLevel;
28 EGLint SwapInterval;
29
30 /* If type == EGL_SCREEN_BIT: */
31 EGLint VisibleRefCount; /* number of screens I'm displayed on */
32
33 #ifdef EGL_VERSION_1_2
34 EGLint SwapBehavior; /* one of EGL_BUFFER_PRESERVED/DESTROYED */
35 EGLint HorizontalResolution, VerticalResolution;
36 EGLint AspectRatio;
37 EGLint RenderBuffer; /* EGL_BACK_BUFFER or EGL_SINGLE_BUFFER */
38 EGLint AlphaFormat; /* EGL_ALPHA_FORMAT_NONPRE or EGL_ALPHA_FORMAT_PRE */
39 EGLint Colorspace; /* EGL_COLORSPACE_sRGB or EGL_COLORSPACE_LINEAR */
40 #endif /* EGL_VERSION_1_2 */
41 };
42
43
44 extern EGLBoolean
45 _eglInitSurface(_EGLDriver *drv, _EGLSurface *surf, EGLint type,
46 _EGLConfig *config, const EGLint *attrib_list);
47
48
49 extern EGLBoolean
50 _eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw);
51
52
53 extern EGLBoolean
54 _eglCopyBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
55
56
57 extern EGLBoolean
58 _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
59
60
61 extern EGLSurface
62 _eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
63
64
65 extern EGLSurface
66 _eglCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
67
68
69 extern EGLSurface
70 _eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
71
72
73 extern EGLBoolean
74 _eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface);
75
76
77 extern EGLBoolean
78 _eglSurfaceAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
79
80
81 extern EGLBoolean
82 _eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
83
84
85 extern EGLBoolean
86 _eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
87
88
89 extern EGLBoolean
90 _eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
91
92
93 #ifdef EGL_VERSION_1_2
94
95 extern EGLSurface
96 _eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
97 EGLenum buftype, EGLClientBuffer buffer,
98 EGLConfig config, const EGLint *attrib_list);
99
100 #endif /* EGL_VERSION_1_2 */
101
102
103 /**
104 * Return true if the surface is bound to a thread.
105 * A surface bound to a texutre is not considered bound by
106 * this function.
107 */
108 static INLINE EGLBoolean
109 _eglIsSurfaceBound(_EGLSurface *surf)
110 {
111 return (surf->Binding != NULL);
112 }
113
114
115 #endif /* EGLSURFACE_INCLUDED */