summaryrefslogtreecommitdiff
path: root/src/gl-renderer.h
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2013-10-14 15:57:11 +0300
committerKristian Høgsberg <krh@bitplanet.net>2013-10-14 15:02:20 -0700
commit97f2952bca46bba7ea8b17815d938833d1845809 (patch)
tree8c3ffd7c2eb228e4843ba45d5e82de2778e8716f /src/gl-renderer.h
parent70e2e684fab843f1c8e03f5151c363eb62e91b08 (diff)
downloadweston-97f2952bca46bba7ea8b17815d938833d1845809.tar.gz
gl-renderer: Build as a loadable module
The time spent loading EGL and GLES libraries from disk can be a considerable hit in some embedded use cases. If Weston is compiled with EGL support, the binary will depend on those libraries, even if a software renderer is in use. This patch splits the GL renderer into a separate loadable module, and moves the dependency on EGL and GLES to it. The backends still need the EGL headers for the native types and EGLint. The function load_module() is renamed to weston_load_module() and exported, so that it can be used by the backends. The gl renderer interface is changed so that there is only one symbol that needs to be dlsym()'d. This symbol contains pointers to all the functions and data necessary to interact with the renderer. As a side effect, this change simplifies gl-renderer.h a great deal.
Diffstat (limited to 'src/gl-renderer.h')
-rw-r--r--src/gl-renderer.h93
1 files changed, 27 insertions, 66 deletions
diff --git a/src/gl-renderer.h b/src/gl-renderer.h
index d16ade29..03421348 100644
--- a/src/gl-renderer.h
+++ b/src/gl-renderer.h
@@ -28,27 +28,6 @@
#include <EGL/egl.h>
-extern const EGLint gl_renderer_opaque_attribs[];
-extern const EGLint gl_renderer_alpha_attribs[];
-
-int
-gl_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
- const EGLint *attribs, const EGLint *visual_id);
-EGLDisplay
-gl_renderer_display(struct weston_compositor *ec);
-int
-gl_renderer_output_create(struct weston_output *output,
- EGLNativeWindowType window);
-void
-gl_renderer_output_destroy(struct weston_output *output);
-EGLSurface
-gl_renderer_output_surface(struct weston_output *output);
-void
-gl_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
- int32_t *edges);
-
-void
-gl_renderer_print_egl_error_state(void);
#else
typedef int EGLint;
@@ -58,49 +37,31 @@ typedef intptr_t EGLNativeDisplayType;
typedef intptr_t EGLNativeWindowType;
#define EGL_DEFAULT_DISPLAY NULL
-static const EGLint gl_renderer_opaque_attribs[];
-static const EGLint gl_renderer_alpha_attribs[];
-
-inline static int
-gl_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
- const EGLint *attribs, const EGLint *visual_id)
-{
- return -1;
-}
-
-inline static EGLDisplay
-gl_renderer_display(struct weston_compositor *ec)
-{
- return 0;
-}
-
-inline static int
-gl_renderer_output_create(struct weston_output *output,
- EGLNativeWindowType window)
-{
- return -1;
-}
-
-inline static void
-gl_renderer_output_destroy(struct weston_output *output)
-{
-}
-
-inline static EGLSurface
-gl_renderer_output_surface(struct weston_output *output)
-{
- return 0;
-}
-
-inline static void
-gl_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t height, void *data,
- int32_t *edges)
-{
-}
-
-inline static void
-gl_renderer_print_egl_error_state(void)
-{
-}
-
#endif
+
+struct gl_renderer_interface {
+ const EGLint *opaque_attribs;
+ const EGLint *alpha_attribs;
+
+ int (*create)(struct weston_compositor *ec,
+ EGLNativeDisplayType display,
+ const EGLint *attribs,
+ const EGLint *visual_id);
+
+ EGLDisplay (*display)(struct weston_compositor *ec);
+
+ int (*output_create)(struct weston_output *output,
+ EGLNativeWindowType window);
+
+ void (*output_destroy)(struct weston_output *output);
+
+ EGLSurface (*output_surface)(struct weston_output *output);
+
+ void (*set_border)(struct weston_compositor *ec,
+ int32_t width, int32_t height,
+ void *data, int32_t *edges);
+
+ void (*print_egl_error_state)(void);
+};
+
+struct gl_renderer_interface gl_renderer_interface;