[PATCH v4 10/10] Move EGL and GL includes to a gles2-renderer header.

John Kåre Alsaker john.kare.alsaker at gmail.com
Mon Oct 29 14:17:18 PDT 2012


---
 src/Makefile.am          |  1 +
 src/compositor-android.c |  2 +-
 src/compositor-drm.c     |  1 +
 src/compositor-wayland.c |  4 +---
 src/compositor-x11.c     |  4 +---
 src/compositor.h         | 29 -----------------------------
 src/gl-renderer.h        | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/gles2-renderer.c     |  8 +++++++-
 src/matrix.c             |  1 -
 9 files changed, 60 insertions(+), 38 deletions(-)
 create mode 100644 src/gl-renderer.h

diff --git a/src/Makefile.am b/src/Makefile.am
index acc2415..04b32d9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,6 +35,7 @@ weston_SOURCES =				\
 	matrix.c				\
 	matrix.h				\
 	gles2-renderer.c			\
+	gl-renderer.h				\
 	weston-launch.h				\
 	weston-egl-ext.h
 
diff --git a/src/compositor-android.c b/src/compositor-android.c
index 41933be..a9565d3 100644
--- a/src/compositor-android.c
+++ b/src/compositor-android.c
@@ -33,9 +33,9 @@
 #include <unistd.h>
 
 #include <EGL/egl.h>
-#include <GLES2/gl2.h>
 
 #include "compositor.h"
+#include "gl-renderer.h"
 #include "android-framebuffer.h"
 #include "evdev.h"
 
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index e226b90..574fd0e 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -40,6 +40,7 @@
 #include <libudev.h>
 
 #include "compositor.h"
+#include "gl-renderer.h"
 #include "evdev.h"
 #include "launcher-util.h"
 
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 919b4bd..556975f 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -36,10 +36,8 @@
 #include <wayland-client.h>
 #include <wayland-egl.h>
 
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
 #include "compositor.h"
+#include "gl-renderer.h"
 
 struct wayland_compositor {
 	struct weston_compositor	 base;
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index e0d366c..2d6186a 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -45,10 +45,8 @@
 
 #include <xkbcommon/xkbcommon.h>
 
-#include <GLES2/gl2.h>
-#include <EGL/egl.h>
-
 #include "compositor.h"
+#include "gl-renderer.h"
 #include "../shared/config-parser.h"
 
 #define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int(10)
diff --git a/src/compositor.h b/src/compositor.h
index 1f6a38f..4122e6f 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -28,14 +28,8 @@
 #include <xkbcommon/xkbcommon.h>
 #include <wayland-server.h>
 
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
 #include "matrix.h"
 #include "../shared/config-parser.h"
-#include "weston-egl-ext.h"
 
 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
 
@@ -793,29 +787,6 @@ weston_surface_destroy(struct weston_surface *surface);
 int
 weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode);
 
-struct gles2_output_state;
-
-typedef int (*gles2_renderer_choose_config_t)(void *data, EGLDisplay display,
-	EGLConfig *config);
-
-int
-gles2_renderer_init(struct weston_compositor *ec, EGLNativeDisplayType display,
-	gles2_renderer_choose_config_t choose_config, void *data);
-void
-gles2_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
-			  int32_t *edges);
-struct gles2_output_state *
-gles2_renderer_output_state_create(struct weston_compositor *ec,
-				   EGLNativeWindowType window);
-void
-gles2_renderer_output_state_destroy(struct weston_compositor *ec,
-				    struct gles2_output_state *go);
-void
-gles2_renderer_output_bind(struct weston_output *output,
-			   struct gles2_output_state *go);
-void
-gles2_renderer_destroy(struct weston_compositor *ec);
-
 struct weston_compositor *
 backend_init(struct wl_display *display, int argc, char *argv[],
 	    const char *config_file);
diff --git a/src/gl-renderer.h b/src/gl-renderer.h
new file mode 100644
index 0000000..f161423
--- /dev/null
+++ b/src/gl-renderer.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2012 John Kåre Alsaker
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission.  The copyright holders make
+ * no representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include  "compositor.h"
+
+#include <EGL/egl.h>
+
+struct gles2_output_state;
+
+typedef int (*gles2_renderer_choose_config_t)(void *data, EGLDisplay display,
+	EGLConfig *config);
+
+int
+gles2_renderer_init(struct weston_compositor *ec, EGLNativeDisplayType display,
+	gles2_renderer_choose_config_t choose_config, void *data);
+void
+gles2_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
+			  int32_t *edges);
+struct gles2_output_state *
+gles2_renderer_output_state_create(struct weston_compositor *ec,
+				   EGLNativeWindowType window);
+void
+gles2_renderer_output_state_destroy(struct weston_compositor *ec,
+				    struct gles2_output_state *go);
+void
+gles2_renderer_output_bind(struct weston_output *output,
+			   struct gles2_output_state *go);
+void
+gles2_renderer_destroy(struct weston_compositor *ec);
diff --git a/src/gles2-renderer.c b/src/gles2-renderer.c
index f389b11..ecf4504 100644
--- a/src/gles2-renderer.c
+++ b/src/gles2-renderer.c
@@ -22,13 +22,19 @@
 
 #define _GNU_SOURCE
 
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include <float.h>
 #include <assert.h>
 
-#include "compositor.h"
+#include "gl-renderer.h"
+
+#include <EGL/eglext.h>
+#include "weston-egl-ext.h"
 
 struct gles2_shader {
 	GLuint program;
diff --git a/src/matrix.c b/src/matrix.c
index 961fec9..91acdd3 100644
--- a/src/matrix.c
+++ b/src/matrix.c
@@ -24,7 +24,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <math.h>
-#include <GLES2/gl2.h>
 #include <wayland-server.h>
 
 #include "matrix.h"
-- 
1.7.12.4



More information about the wayland-devel mailing list