[PATCH v6 11/12] Move EGL and GL includes to a gles2-renderer header.

John Kåre Alsaker john.kare.alsaker at gmail.com
Tue Nov 13 10:10:28 PST 2012


---
 src/Makefile.am          |  1 +
 src/compositor-android.c |  2 +-
 src/compositor-drm.c     |  1 +
 src/compositor-rpi.c     |  1 +
 src/compositor-wayland.c |  4 +---
 src/compositor-x11.c     |  4 +---
 src/compositor.h         | 27 ---------------------------
 src/gl-renderer.h        | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 src/gles2-renderer.c     |  8 +++++++-
 src/matrix.c             |  1 -
 10 files changed, 59 insertions(+), 36 deletions(-)
 create mode 100644 src/gl-renderer.h

diff --git a/src/Makefile.am b/src/Makefile.am
index fb5f8fc..a41c3d0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,6 +34,7 @@ weston_SOURCES =				\
 	util.c					\
 	matrix.c				\
 	matrix.h				\
+	gl-renderer.h				\
 	gles2-renderer.c			\
 	noop-renderer.c				\
 	weston-launch.h				\
diff --git a/src/compositor-android.c b/src/compositor-android.c
index cced65d..1262683 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 42546ff..6eac8e7 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-rpi.c b/src/compositor-rpi.c
index 56119a6..f812b35 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -44,6 +44,7 @@
 #endif
 
 #include "compositor.h"
+#include "gl-renderer.h"
 #include "evdev.h"
 
 /*
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 4a70f99..d8169b9 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 145e424..6e051ce 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 2f701c5..e5c579b 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])
 
@@ -806,27 +800,6 @@ weston_surface_destroy(struct weston_surface *surface);
 int
 weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode);
 
-extern const EGLint gles2_renderer_opaque_attribs[];
-extern const EGLint gles2_renderer_alpha_attribs[];
-
-int
-gles2_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
-	const EGLint *attribs, const EGLint *visual_id);
-EGLDisplay
-gles2_renderer_display(struct weston_compositor *ec);
-int
-gles2_renderer_output_create(struct weston_output *output,
-				    EGLNativeWindowType window);
-void
-gles2_renderer_output_destroy(struct weston_output *output);
-EGLSurface
-gles2_renderer_output_surface(struct weston_output *output);
-void
-gles2_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
-			  int32_t *edges);
-void
-gles2_renderer_destroy(struct weston_compositor *ec);
-
 int
 noop_renderer_init(struct weston_compositor *ec);
 void
diff --git a/src/gl-renderer.h b/src/gl-renderer.h
new file mode 100644
index 0000000..1c5ed09
--- /dev/null
+++ b/src/gl-renderer.h
@@ -0,0 +1,46 @@
+/*
+ * 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>
+
+extern const EGLint gles2_renderer_opaque_attribs[];
+extern const EGLint gles2_renderer_alpha_attribs[];
+
+int
+gles2_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
+	const EGLint *attribs, const EGLint *visual_id);
+EGLDisplay
+gles2_renderer_display(struct weston_compositor *ec);
+int
+gles2_renderer_output_create(struct weston_output *output,
+				    EGLNativeWindowType window);
+void
+gles2_renderer_output_destroy(struct weston_output *output);
+EGLSurface
+gles2_renderer_output_surface(struct weston_output *output);
+void
+gles2_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
+			  int32_t *edges);
+void
+gles2_renderer_destroy(struct weston_compositor *ec);
diff --git a/src/gles2-renderer.c b/src/gles2-renderer.c
index 4f08a0c..c12d671 100644
--- a/src/gles2-renderer.c
+++ b/src/gles2-renderer.c
@@ -22,6 +22,9 @@
 
 #define _GNU_SOURCE
 
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
@@ -29,7 +32,10 @@
 #include <assert.h>
 #include <linux/input.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.8.0



More information about the wayland-devel mailing list