diff --git a/cogl/winsys/cogl-winsys-egl-private.h b/cogl/winsys/cogl-winsys-egl-private.h index dd2df8e5b..a888aa5f6 100644 --- a/cogl/winsys/cogl-winsys-egl-private.h +++ b/cogl/winsys/cogl-winsys-egl-private.h @@ -27,6 +27,94 @@ #include "cogl-defines.h" #include "cogl-winsys-private.h" #include "cogl-context.h" +#include "cogl-winsys-kms.h" + +typedef enum _CoglEGLWinsysFeature +{ + COGL_EGL_WINSYS_FEATURE_SWAP_REGION =1L<<0, + COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_X11_PIXMAP =1L<<1, + COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_WAYLAND_BUFFER =1L<<2 +} CoglEGLWinsysFeature; + +typedef struct _CoglRendererEGL +{ +#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT + CoglXlibRenderer _parent; +#endif + + CoglEGLWinsysFeature private_features; + +#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT + struct wl_display *wayland_display; + struct wl_compositor *wayland_compositor; + struct wl_shell *wayland_shell; +#endif + + EGLDisplay edpy; + + EGLint egl_version_major; + EGLint egl_version_minor; + +#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT + gboolean gdl_initialized; +#endif +#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT + CoglRendererKMS kms_renderer; +#endif + + /* Function pointers for GLX specific extensions */ +#define COGL_WINSYS_FEATURE_BEGIN(a, b, c, d) + +#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) \ + ret (APIENTRY * pf_ ## name) args; + +#define COGL_WINSYS_FEATURE_END() + +#include "cogl-winsys-egl-feature-functions.h" + +#undef COGL_WINSYS_FEATURE_BEGIN +#undef COGL_WINSYS_FEATURE_FUNCTION +#undef COGL_WINSYS_FEATURE_END +} CoglRendererEGL; + +typedef struct _CoglDisplayEGL +{ +#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT + CoglXlibDisplay _parent; +#endif + + EGLContext egl_context; +#if defined (COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT) + EGLSurface dummy_surface; +#elif defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) + struct wl_surface *wayland_surface; + struct wl_egl_window *wayland_egl_native_window; + EGLSurface dummy_surface; +#elif defined (COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT) || \ + defined (COGL_HAS_EGL_PLATFORM_GDL_SUPPORT) || \ + defined (COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT) || \ + defined (COGL_HAS_EGL_PLATFORM_KMS_SUPPORT) +#ifndef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT + EGLSurface egl_surface; +#else + CoglDisplayKMS kms_display; +#endif + int egl_surface_width; + int egl_surface_height; + gboolean have_onscreen; +#else +#error "Unknown EGL platform" +#endif + + EGLConfig egl_config; + gboolean found_egl_config; + gboolean stencil_disabled; +} CoglDisplayEGL; + +typedef struct _CoglContextEGL +{ + EGLSurface current_surface; +} CoglContextEGL; const CoglWinsysVtable * _cogl_winsys_egl_get_vtable (void); diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c index fe998ccb6..922e74793 100644 --- a/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/winsys/cogl-winsys-egl.c @@ -82,93 +82,6 @@ #define MAX_EGL_CONFIG_ATTRIBS 30 -typedef enum _CoglEGLWinsysFeature -{ - COGL_EGL_WINSYS_FEATURE_SWAP_REGION =1L<<0, - COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_X11_PIXMAP =1L<<1, - COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_WAYLAND_BUFFER =1L<<2 -} CoglEGLWinsysFeature; - -typedef struct _CoglRendererEGL -{ -#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT - CoglXlibRenderer _parent; -#endif - - CoglEGLWinsysFeature private_features; - -#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT - struct wl_display *wayland_display; - struct wl_compositor *wayland_compositor; - struct wl_shell *wayland_shell; -#endif - - EGLDisplay edpy; - - EGLint egl_version_major; - EGLint egl_version_minor; - -#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT - gboolean gdl_initialized; -#endif -#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT - CoglRendererKMS kms_renderer; -#endif - - /* Function pointers for GLX specific extensions */ -#define COGL_WINSYS_FEATURE_BEGIN(a, b, c, d) - -#define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args) \ - ret (APIENTRY * pf_ ## name) args; - -#define COGL_WINSYS_FEATURE_END() - -#include "cogl-winsys-egl-feature-functions.h" - -#undef COGL_WINSYS_FEATURE_BEGIN -#undef COGL_WINSYS_FEATURE_FUNCTION -#undef COGL_WINSYS_FEATURE_END -} CoglRendererEGL; - -typedef struct _CoglDisplayEGL -{ -#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT - CoglXlibDisplay _parent; -#endif - - EGLContext egl_context; -#if defined (COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT) - EGLSurface dummy_surface; -#elif defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT) - struct wl_surface *wayland_surface; - struct wl_egl_window *wayland_egl_native_window; - EGLSurface dummy_surface; -#elif defined (COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT) || \ - defined (COGL_HAS_EGL_PLATFORM_GDL_SUPPORT) || \ - defined (COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT) || \ - defined (COGL_HAS_EGL_PLATFORM_KMS_SUPPORT) -#ifndef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT - EGLSurface egl_surface; -#else - CoglDisplayKMS kms_display; -#endif - int egl_surface_width; - int egl_surface_height; - gboolean have_onscreen; -#else -#error "Unknown EGL platform" -#endif - - EGLConfig egl_config; - gboolean found_egl_config; - gboolean stencil_disabled; -} CoglDisplayEGL; - -typedef struct _CoglContextEGL -{ - EGLSurface current_surface; -} CoglContextEGL; - #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT typedef struct _CoglOnscreenXlib {