[cogl/wip/runtime-egl-platform: 1/2] Add a separate winsys vtable for each EGL platform



commit f8dca8c5d2c35254ff84b1da0943d6e7fbd12be3
Author: Neil Roberts <neil linux intel com>
Date:   Thu Dec 8 17:24:40 2011 +0000

    Add a separate winsys vtable for each EGL platform
    
    Instead of just having an "EGL" renderer, there is now a separate
    winsys for each platform. Currently they just directly copy the vtable
    for the EGL platform so it is still only possible to have one EGL
    platform compiled into Cogl. However the intention is that the
    winsys-specific code for each platform will be moved into override
    functions in the corresponding platform winsys.

 cogl/Makefile.am                              |   27 ++++++++++++-
 cogl/cogl-renderer.c                          |   41 ++++++++++++++++--
 cogl/cogl-renderer.h                          |    7 +++-
 cogl/winsys/cogl-winsys-egl-android-private.h |   32 ++++++++++++++
 cogl/winsys/cogl-winsys-egl-android.c         |   55 +++++++++++++++++++++++++
 cogl/winsys/cogl-winsys-egl-gdl-private.h     |   32 ++++++++++++++
 cogl/winsys/cogl-winsys-egl-gdl.c             |   55 +++++++++++++++++++++++++
 cogl/winsys/cogl-winsys-egl-kms-private.h     |   32 ++++++++++++++
 cogl/winsys/cogl-winsys-egl-kms.c             |   55 +++++++++++++++++++++++++
 cogl/winsys/cogl-winsys-egl-null-private.h    |   32 ++++++++++++++
 cogl/winsys/cogl-winsys-egl-null.c            |   55 +++++++++++++++++++++++++
 cogl/winsys/cogl-winsys-egl-wayland-private.h |   32 ++++++++++++++
 cogl/winsys/cogl-winsys-egl-wayland.c         |   55 +++++++++++++++++++++++++
 cogl/winsys/cogl-winsys-egl-x11-private.h     |   32 ++++++++++++++
 cogl/winsys/cogl-winsys-egl-x11.c             |   55 +++++++++++++++++++++++++
 cogl/winsys/cogl-winsys-egl.c                 |    5 +-
 16 files changed, 593 insertions(+), 9 deletions(-)
---
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index 2f732bc..b62a2a5 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -376,11 +376,36 @@ endif
 if SUPPORT_EGL_PLATFORM_WAYLAND
 cogl_public_h += \
 	$(srcdir)/cogl-wayland-renderer.h
+cogl_sources_c += \
+	$(srcdir)/winsys/cogl-winsys-egl-wayland.c \
+	$(srcdir)/winsys/cogl-winsys-egl-wayland-private.h
 endif
 if SUPPORT_EGL_PLATFORM_KMS
 cogl_sources_c += \
 	$(srcdir)/winsys/cogl-winsys-kms.c \
-	$(srcdir)/winsys/cogl-winsys-kms.h
+	$(srcdir)/winsys/cogl-winsys-kms.h \
+	$(srcdir)/winsys/cogl-winsys-egl-kms.c \
+	$(srcdir)/winsys/cogl-winsys-egl-kms-private.h
+endif
+if SUPPORT_EGL_PLATFORM_POWERVR_X11
+cogl_sources_c += \
+	$(srcdir)/winsys/cogl-winsys-egl-x11.c \
+	$(srcdir)/winsys/cogl-winsys-egl-x11-private.h
+endif
+if SUPPORT_EGL_PLATFORM_POWERVR_NULL
+cogl_sources_c += \
+	$(srcdir)/winsys/cogl-winsys-egl-null.c \
+	$(srcdir)/winsys/cogl-winsys-egl-null-private.h
+endif
+if SUPPORT_EGL_PLATFORM_GDL
+cogl_sources_c += \
+	$(srcdir)/winsys/cogl-winsys-egl-gdl.c \
+	$(srcdir)/winsys/cogl-winsys-egl-gdl-private.h
+endif
+if SUPPORT_EGL_PLATFORM_ANDROID
+cogl_sources_c += \
+	$(srcdir)/winsys/cogl-winsys-egl-android.c \
+	$(srcdir)/winsys/cogl-winsys-egl-android-private.h
 endif
 if SUPPORT_EGL
 cogl_sources_c += \
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
index 2e27209..aed8dc9 100644
--- a/cogl/cogl-renderer.c
+++ b/cogl/cogl-renderer.c
@@ -43,11 +43,27 @@
 #include "cogl-display-private.h"
 #include "cogl-winsys-private.h"
 #include "cogl-winsys-stub-private.h"
-#ifdef COGL_HAS_EGL_SUPPORT
-#include "cogl-winsys-egl-private.h"
-#endif
 #include "cogl-config-private.h"
 
+#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
+#include "cogl-winsys-egl-x11-private.h"
+#endif
+#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT
+#include "cogl-winsys-egl-wayland-private.h"
+#endif
+#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT
+#include "cogl-winsys-egl-kms-private.h"
+#endif
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+#include "cogl-winsys-egl-gdl-private.h"
+#endif
+#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT
+#include "cogl-winsys-egl-android-private.h"
+#endif
+#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT
+#include "cogl-winsys-egl-null-private.h"
+#endif
+
 #if COGL_HAS_XLIB_SUPPORT
 #include "cogl-xlib-renderer.h"
 #endif
@@ -66,8 +82,23 @@ static CoglWinsysVtableGetter _cogl_winsys_vtable_getters[] =
 #ifdef COGL_HAS_GLX_SUPPORT
   _cogl_winsys_glx_get_vtable,
 #endif
-#ifdef COGL_HAS_EGL_SUPPORT
-  _cogl_winsys_egl_get_vtable,
+#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
+  _cogl_winsys_egl_x11_get_vtable,
+#endif
+#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT
+  _cogl_winsys_egl_wayland_get_vtable,
+#endif
+#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT
+  _cogl_winsys_egl_kms_get_vtable,
+#endif
+#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
+  _cogl_winsys_egl_gdl_get_vtable,
+#endif
+#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT
+  _cogl_winsys_egl_android_get_vtable,
+#endif
+#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT
+  _cogl_winsys_egl_null_get_vtable,
 #endif
 #ifdef COGL_HAS_WGL_SUPPORT
   _cogl_winsys_wgl_get_vtable,
diff --git a/cogl/cogl-renderer.h b/cogl/cogl-renderer.h
index 15c0ff4..9f225f2 100644
--- a/cogl/cogl-renderer.h
+++ b/cogl/cogl-renderer.h
@@ -77,7 +77,12 @@ typedef enum
   COGL_WINSYS_ID_ANY,
   COGL_WINSYS_ID_STUB,
   COGL_WINSYS_ID_GLX,
-  COGL_WINSYS_ID_EGL,
+  COGL_WINSYS_ID_EGL_X11,
+  COGL_WINSYS_ID_EGL_NULL,
+  COGL_WINSYS_ID_EGL_GDL,
+  COGL_WINSYS_ID_EGL_WAYLAND,
+  COGL_WINSYS_ID_EGL_KMS,
+  COGL_WINSYS_ID_EGL_ANDROID,
   COGL_WINSYS_ID_WGL
 } CoglWinsysID;
 
diff --git a/cogl/winsys/cogl-winsys-egl-android-private.h b/cogl/winsys/cogl-winsys-egl-android-private.h
new file mode 100644
index 0000000..571e74d
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-android-private.h
@@ -0,0 +1,32 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __COGL_WINSYS_EGL_ANDROID_PRIVATE_H
+#define __COGL_WINSYS_EGL_ANDROID_PRIVATE_H
+
+#include "cogl-winsys-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_android_get_vtable (void);
+
+#endif /* __COGL_WINSYS_EGL_ANDROID_PRIVATE_H */
diff --git a/cogl/winsys/cogl-winsys-egl-android.c b/cogl/winsys/cogl-winsys-egl-android.c
new file mode 100644
index 0000000..e4bdea5
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-android.c
@@ -0,0 +1,55 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *
+ * Authors:
+ *   Robert Bragg <robert linux intel com>
+ *   Neil Roberts <neil linux intel com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl-winsys-egl-android-private.h"
+#include "cogl-winsys-egl-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_android_get_vtable (void)
+{
+  static gboolean vtable_inited = FALSE;
+  static CoglWinsysVtable vtable;
+
+  if (!vtable_inited)
+    {
+      /* The EGL_ANDROID winsys is a subclass of the EGL winsys so we
+         start by copying its vtable */
+
+      vtable = *_cogl_winsys_egl_get_vtable ();
+
+      vtable.id = COGL_WINSYS_ID_EGL_ANDROID;
+      vtable.name = "EGL_ANDROID";
+
+      vtable_inited = TRUE;
+    }
+
+  return &vtable;
+}
diff --git a/cogl/winsys/cogl-winsys-egl-gdl-private.h b/cogl/winsys/cogl-winsys-egl-gdl-private.h
new file mode 100644
index 0000000..8db5804
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-gdl-private.h
@@ -0,0 +1,32 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __COGL_WINSYS_EGL_GDL_PRIVATE_H
+#define __COGL_WINSYS_EGL_GDL_PRIVATE_H
+
+#include "cogl-winsys-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_gdl_get_vtable (void);
+
+#endif /* __COGL_WINSYS_EGL_GDL_PRIVATE_H */
diff --git a/cogl/winsys/cogl-winsys-egl-gdl.c b/cogl/winsys/cogl-winsys-egl-gdl.c
new file mode 100644
index 0000000..4075035
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-gdl.c
@@ -0,0 +1,55 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *
+ * Authors:
+ *   Robert Bragg <robert linux intel com>
+ *   Neil Roberts <neil linux intel com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl-winsys-egl-gdl-private.h"
+#include "cogl-winsys-egl-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_gdl_get_vtable (void)
+{
+  static gboolean vtable_inited = FALSE;
+  static CoglWinsysVtable vtable;
+
+  if (!vtable_inited)
+    {
+      /* The EGL_GDL winsys is a subclass of the EGL winsys so we
+         start by copying its vtable */
+
+      vtable = *_cogl_winsys_egl_get_vtable ();
+
+      vtable.id = COGL_WINSYS_ID_EGL_GDL;
+      vtable.name = "EGL_GDL";
+
+      vtable_inited = TRUE;
+    }
+
+  return &vtable;
+}
diff --git a/cogl/winsys/cogl-winsys-egl-kms-private.h b/cogl/winsys/cogl-winsys-egl-kms-private.h
new file mode 100644
index 0000000..0dec2d9
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-kms-private.h
@@ -0,0 +1,32 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __COGL_WINSYS_EGL_KMS_PRIVATE_H
+#define __COGL_WINSYS_EGL_KMS_PRIVATE_H
+
+#include "cogl-winsys-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_kms_get_vtable (void);
+
+#endif /* __COGL_WINSYS_EGL_KMS_PRIVATE_H */
diff --git a/cogl/winsys/cogl-winsys-egl-kms.c b/cogl/winsys/cogl-winsys-egl-kms.c
new file mode 100644
index 0000000..0229e0f
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-kms.c
@@ -0,0 +1,55 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *
+ * Authors:
+ *   Robert Bragg <robert linux intel com>
+ *   Neil Roberts <neil linux intel com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl-winsys-egl-kms-private.h"
+#include "cogl-winsys-egl-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_kms_get_vtable (void)
+{
+  static gboolean vtable_inited = FALSE;
+  static CoglWinsysVtable vtable;
+
+  if (!vtable_inited)
+    {
+      /* The EGL_KMS winsys is a subclass of the EGL winsys so we
+         start by copying its vtable */
+
+      vtable = *_cogl_winsys_egl_get_vtable ();
+
+      vtable.id = COGL_WINSYS_ID_EGL_KMS;
+      vtable.name = "EGL_KMS";
+
+      vtable_inited = TRUE;
+    }
+
+  return &vtable;
+}
diff --git a/cogl/winsys/cogl-winsys-egl-null-private.h b/cogl/winsys/cogl-winsys-egl-null-private.h
new file mode 100644
index 0000000..c125236
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-null-private.h
@@ -0,0 +1,32 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __COGL_WINSYS_EGL_NULL_PRIVATE_H
+#define __COGL_WINSYS_EGL_NULL_PRIVATE_H
+
+#include "cogl-winsys-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_null_get_vtable (void);
+
+#endif /* __COGL_WINSYS_EGL_NULL_PRIVATE_H */
diff --git a/cogl/winsys/cogl-winsys-egl-null.c b/cogl/winsys/cogl-winsys-egl-null.c
new file mode 100644
index 0000000..a3c1f79
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-null.c
@@ -0,0 +1,55 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *
+ * Authors:
+ *   Robert Bragg <robert linux intel com>
+ *   Neil Roberts <neil linux intel com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl-winsys-egl-null-private.h"
+#include "cogl-winsys-egl-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_null_get_vtable (void)
+{
+  static gboolean vtable_inited = FALSE;
+  static CoglWinsysVtable vtable;
+
+  if (!vtable_inited)
+    {
+      /* The EGL_NULL winsys is a subclass of the EGL winsys so we
+         start by copying its vtable */
+
+      vtable = *_cogl_winsys_egl_get_vtable ();
+
+      vtable.id = COGL_WINSYS_ID_EGL_NULL;
+      vtable.name = "EGL_NULL";
+
+      vtable_inited = TRUE;
+    }
+
+  return &vtable;
+}
diff --git a/cogl/winsys/cogl-winsys-egl-wayland-private.h b/cogl/winsys/cogl-winsys-egl-wayland-private.h
new file mode 100644
index 0000000..870047c
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-wayland-private.h
@@ -0,0 +1,32 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __COGL_WINSYS_EGL_WAYLAND_PRIVATE_H
+#define __COGL_WINSYS_EGL_WAYLAND_PRIVATE_H
+
+#include "cogl-winsys-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_wayland_get_vtable (void);
+
+#endif /* __COGL_WINSYS_EGL_WAYLAND_PRIVATE_H */
diff --git a/cogl/winsys/cogl-winsys-egl-wayland.c b/cogl/winsys/cogl-winsys-egl-wayland.c
new file mode 100644
index 0000000..cb4766e
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-wayland.c
@@ -0,0 +1,55 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *
+ * Authors:
+ *   Robert Bragg <robert linux intel com>
+ *   Neil Roberts <neil linux intel com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl-winsys-egl-wayland-private.h"
+#include "cogl-winsys-egl-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_wayland_get_vtable (void)
+{
+  static gboolean vtable_inited = FALSE;
+  static CoglWinsysVtable vtable;
+
+  if (!vtable_inited)
+    {
+      /* The EGL_WAYLAND winsys is a subclass of the EGL winsys so we
+         start by copying its vtable */
+
+      vtable = *_cogl_winsys_egl_get_vtable ();
+
+      vtable.id = COGL_WINSYS_ID_EGL_WAYLAND;
+      vtable.name = "EGL_WAYLAND";
+
+      vtable_inited = TRUE;
+    }
+
+  return &vtable;
+}
diff --git a/cogl/winsys/cogl-winsys-egl-x11-private.h b/cogl/winsys/cogl-winsys-egl-x11-private.h
new file mode 100644
index 0000000..8438a9f
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-x11-private.h
@@ -0,0 +1,32 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __COGL_WINSYS_EGL_X11_PRIVATE_H
+#define __COGL_WINSYS_EGL_X11_PRIVATE_H
+
+#include "cogl-winsys-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_x11_get_vtable (void);
+
+#endif /* __COGL_WINSYS_EGL_X11_PRIVATE_H */
diff --git a/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/winsys/cogl-winsys-egl-x11.c
new file mode 100644
index 0000000..c8991ba
--- /dev/null
+++ b/cogl/winsys/cogl-winsys-egl-x11.c
@@ -0,0 +1,55 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *
+ * Authors:
+ *   Robert Bragg <robert linux intel com>
+ *   Neil Roberts <neil linux intel com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl-winsys-egl-x11-private.h"
+#include "cogl-winsys-egl-private.h"
+
+const CoglWinsysVtable *
+_cogl_winsys_egl_x11_get_vtable (void)
+{
+  static gboolean vtable_inited = FALSE;
+  static CoglWinsysVtable vtable;
+
+  if (!vtable_inited)
+    {
+      /* The EGL_X11 winsys is a subclass of the EGL winsys so we
+         start by copying its vtable */
+
+      vtable = *_cogl_winsys_egl_get_vtable ();
+
+      vtable.id = COGL_WINSYS_ID_EGL_X11;
+      vtable.name = "EGL_X11";
+
+      vtable_inited = TRUE;
+    }
+
+  return &vtable;
+}
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index 895a8d8..15f9e2e 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -1774,8 +1774,9 @@ _cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
 
 static CoglWinsysVtable _cogl_winsys_vtable =
   {
-    .id = COGL_WINSYS_ID_EGL,
-    .name = "EGL",
+    /* This winsys is only used as a base for the EGL-platform
+       winsys's so it does not have an ID or a name */
+
     .renderer_get_proc_address = _cogl_winsys_renderer_get_proc_address,
     .renderer_connect = _cogl_winsys_renderer_connect,
     .renderer_disconnect = _cogl_winsys_renderer_disconnect,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]