eglsurface.h revision 4a49301e
14a49301eSmrg#ifndef EGLSURFACE_INCLUDED
24a49301eSmrg#define EGLSURFACE_INCLUDED
34a49301eSmrg
44a49301eSmrg
54a49301eSmrg#include "egltypedefs.h"
64a49301eSmrg
74a49301eSmrg
84a49301eSmrg/**
94a49301eSmrg * "Base" class for device driver surfaces.
104a49301eSmrg */
114a49301eSmrgstruct _egl_surface
124a49301eSmrg{
134a49301eSmrg   /* Managed by EGLDisplay for linking */
144a49301eSmrg   _EGLDisplay *Display;
154a49301eSmrg   _EGLSurface *Next;
164a49301eSmrg
174a49301eSmrg   /* The bound status of the surface */
184a49301eSmrg   _EGLContext *Binding;
194a49301eSmrg   EGLBoolean BoundToTexture;
204a49301eSmrg
214a49301eSmrg   _EGLConfig *Config;
224a49301eSmrg
234a49301eSmrg   EGLint Type; /* one of EGL_WINDOW_BIT, EGL_PIXMAP_BIT or EGL_PBUFFER_BIT */
244a49301eSmrg   EGLint Width, Height;
254a49301eSmrg   EGLint TextureFormat, TextureTarget;
264a49301eSmrg   EGLint MipmapTexture, MipmapLevel;
274a49301eSmrg   EGLint SwapInterval;
284a49301eSmrg
294a49301eSmrg   /* If type == EGL_SCREEN_BIT: */
304a49301eSmrg   EGLint VisibleRefCount; /* number of screens I'm displayed on */
314a49301eSmrg
324a49301eSmrg#ifdef EGL_VERSION_1_2
334a49301eSmrg   EGLint SwapBehavior; /* one of EGL_BUFFER_PRESERVED/DESTROYED */
344a49301eSmrg   EGLint HorizontalResolution, VerticalResolution;
354a49301eSmrg   EGLint AspectRatio;
364a49301eSmrg   EGLint RenderBuffer; /* EGL_BACK_BUFFER or EGL_SINGLE_BUFFER */
374a49301eSmrg   EGLint AlphaFormat; /* EGL_ALPHA_FORMAT_NONPRE or EGL_ALPHA_FORMAT_PRE */
384a49301eSmrg   EGLint Colorspace; /* EGL_COLORSPACE_sRGB or EGL_COLORSPACE_LINEAR */
394a49301eSmrg#endif /* EGL_VERSION_1_2 */
404a49301eSmrg};
414a49301eSmrg
424a49301eSmrg
434a49301eSmrgextern EGLBoolean
444a49301eSmrg_eglInitSurface(_EGLDriver *drv, _EGLSurface *surf, EGLint type,
454a49301eSmrg                _EGLConfig *config, const EGLint *attrib_list);
464a49301eSmrg
474a49301eSmrg
484a49301eSmrgextern EGLBoolean
494a49301eSmrg_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf);
504a49301eSmrg
514a49301eSmrg
524a49301eSmrgextern EGLBoolean
534a49301eSmrg_eglCopyBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, NativePixmapType target);
544a49301eSmrg
554a49301eSmrg
564a49301eSmrgextern EGLBoolean
574a49301eSmrg_eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint attribute, EGLint *value);
584a49301eSmrg
594a49301eSmrg
604a49301eSmrgextern _EGLSurface *
614a49301eSmrg_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativeWindowType window, const EGLint *attrib_list);
624a49301eSmrg
634a49301eSmrg
644a49301eSmrgextern _EGLSurface *
654a49301eSmrg_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativePixmapType pixmap, const EGLint *attrib_list);
664a49301eSmrg
674a49301eSmrg
684a49301eSmrgextern _EGLSurface *
694a49301eSmrg_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list);
704a49301eSmrg
714a49301eSmrg
724a49301eSmrgextern EGLBoolean
734a49301eSmrg_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf);
744a49301eSmrg
754a49301eSmrg
764a49301eSmrgextern EGLBoolean
774a49301eSmrg_eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint attribute, EGLint value);
784a49301eSmrg
794a49301eSmrg
804a49301eSmrgextern EGLBoolean
814a49301eSmrg_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint buffer);
824a49301eSmrg
834a49301eSmrg
844a49301eSmrgextern EGLBoolean
854a49301eSmrg_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint buffer);
864a49301eSmrg
874a49301eSmrg
884a49301eSmrgextern EGLBoolean
894a49301eSmrg_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval);
904a49301eSmrg
914a49301eSmrg
924a49301eSmrg#ifdef EGL_VERSION_1_2
934a49301eSmrg
944a49301eSmrgextern _EGLSurface *
954a49301eSmrg_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, _EGLDisplay *dpy,
964a49301eSmrg                                  EGLenum buftype, EGLClientBuffer buffer,
974a49301eSmrg                                  _EGLConfig *conf, const EGLint *attrib_list);
984a49301eSmrg
994a49301eSmrg#endif /* EGL_VERSION_1_2 */
1004a49301eSmrg
1014a49301eSmrg
1024a49301eSmrg/**
1034a49301eSmrg * Return true if the surface is bound to a thread.
1044a49301eSmrg * A surface bound to a texutre is not considered bound by
1054a49301eSmrg * this function.
1064a49301eSmrg */
1074a49301eSmrgstatic INLINE EGLBoolean
1084a49301eSmrg_eglIsSurfaceBound(_EGLSurface *surf)
1094a49301eSmrg{
1104a49301eSmrg   return (surf->Binding != NULL);
1114a49301eSmrg}
1124a49301eSmrg
1134a49301eSmrg
1144a49301eSmrg#endif /* EGLSURFACE_INCLUDED */
115