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

John Kåre Alsaker john.kare.alsaker at gmail.com
Fri Nov 9 12:21:19 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         | 33 ------------------------------
 src/gl-renderer.h        | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/gles2-renderer.c     |  8 +++++++-
 src/matrix.c             |  1 -
 10 files changed, 65 insertions(+), 42 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 315d4a0..4e0b410 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 4df0c18..d3ebf23 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 104d81c..30684f5 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 eca8a28..f8d3662 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 1a08c43..84e7cc2 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 a5a7b59..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,33 +800,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;
-
-extern const EGLint gles2_opaque_attribs[];
-extern const EGLint gles2_alpha_attribs[];
-
-int
-gles2_renderer_init(struct weston_compositor *ec, EGLNativeDisplayType display,
-	const EGLint *attribs, const EGLint *visual_id);
-EGLDisplay
-gles2_renderer_display(struct weston_compositor *ec);
-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);
-EGLSurface
-gles2_renderer_output_state_surface(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);
-
 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..c8edfb5
--- /dev/null
+++ b/src/gl-renderer.h
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+extern const EGLint gles2_opaque_attribs[];
+extern const EGLint gles2_alpha_attribs[];
+
+int
+gles2_renderer_init(struct weston_compositor *ec, EGLNativeDisplayType display,
+	const EGLint *attribs, const EGLint *visual_id);
+EGLDisplay
+gles2_renderer_display(struct weston_compositor *ec);
+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);
+EGLSurface
+gles2_renderer_output_state_surface(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 bda9527..df0c9eb 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