From 30d2b1fd4b97f2671646ee9d4ef526f7d3e8a5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Tue, 13 Nov 2012 19:10:28 +0100 Subject: [PATCH] Move EGL and GL includes to a gles2-renderer header. --- 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 fb5f8fc6..a41c3d05 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 cced65de..1262683c 100644 --- a/src/compositor-android.c +++ b/src/compositor-android.c @@ -33,9 +33,9 @@ #include #include -#include #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 42546fff..6eac8e7f 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -40,6 +40,7 @@ #include #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 56119a6d..f812b35f 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 4a70f99d..d8169b99 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -36,10 +36,8 @@ #include #include -#include -#include - #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 145e4240..6e051cec 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -45,10 +45,8 @@ #include -#include -#include - #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 2f701c5a..e5c579b4 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -28,14 +28,8 @@ #include #include -#include -#include -#include -#include - #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 00000000..1c5ed091 --- /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 + +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 4f08a0ca..c12d671a 100644 --- a/src/gles2-renderer.c +++ b/src/gles2-renderer.c @@ -22,6 +22,9 @@ #define _GNU_SOURCE +#include +#include + #include #include #include @@ -29,7 +32,10 @@ #include #include -#include "compositor.h" +#include "gl-renderer.h" + +#include +#include "weston-egl-ext.h" struct gles2_shader { GLuint program; diff --git a/src/matrix.c b/src/matrix.c index 961fec97..91acdd3d 100644 --- a/src/matrix.c +++ b/src/matrix.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "matrix.h"