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