diff options
author | ayaka <ayaka@soulik.info> | 2021-04-09 10:48:01 +0800 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-04-17 16:39:40 +0200 |
commit | ed1924800de905f5462c8cc6e36fbc60b69d3030 (patch) | |
tree | bb2f6b13a1b30905a8e5ba301bb331fd2299fc43 /render | |
parent | 122d6c6988a992a7f41f5b1389d0ac6b49f11888 (diff) |
render: make GLES2 renderer optional
Allow selecting whether the GLES2 renderer gets enabled.
Co-authored-by: Simon Ser <contact@emersion.fr>
Diffstat (limited to 'render')
-rw-r--r-- | render/gles2/meson.build | 9 | ||||
-rw-r--r-- | render/meson.build | 19 | ||||
-rw-r--r-- | render/pixman/meson.build | 1 | ||||
-rw-r--r-- | render/wlr_renderer.c | 18 |
4 files changed, 42 insertions, 5 deletions
diff --git a/render/gles2/meson.build b/render/gles2/meson.build index d4d62c64..f2cd5fba 100644 --- a/render/gles2/meson.build +++ b/render/gles2/meson.build @@ -1,3 +1,12 @@ +glesv2 = dependency('glesv2', required: 'gles2' in renderers) + +if not (glesv2.found() and egl.found()) + subdir_done() +endif + +features += { 'gles2-renderer': true } +wlr_deps += glesv2 + wlr_files += files( 'pixel_format.c', 'renderer.c', diff --git a/render/meson.build b/render/meson.build index ab0c4424..0a53acdd 100644 --- a/render/meson.build +++ b/render/meson.build @@ -1,7 +1,13 @@ +renderers = get_option('renderers') +if 'auto' in renderers and get_option('auto_features').enabled() + renderers = ['gles2'] +elif 'auto' in renderers and get_option('auto_features').disabled() + renderers = [] +endif + wlr_files += files( 'allocator.c', 'dmabuf.c', - 'egl.c', 'drm_format_set.c', 'gbm_allocator.c', 'pixel_format.c', @@ -11,5 +17,14 @@ wlr_files += files( 'wlr_texture.c', ) -subdir('gles2') +egl = dependency('egl', required: 'gles2' in renderers) +if egl.found() + wlr_deps += egl + wlr_files += files('egl.c') +endif + +if 'gles2' in renderers or 'auto' in renderers + subdir('gles2') +endif + subdir('pixman') diff --git a/render/pixman/meson.build b/render/pixman/meson.build index eb7a0d3a..484cda46 100644 --- a/render/pixman/meson.build +++ b/render/pixman/meson.build @@ -1,4 +1,5 @@ pixman = dependency('pixman-1') + wlr_deps += pixman wlr_files += files( diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index d520475d..77be3018 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -2,13 +2,19 @@ #include <stdbool.h> #include <stdlib.h> #include <gbm.h> -#include <wlr/render/egl.h> -#include <wlr/render/gles2.h> -#include <wlr/render/pixman.h> #include <wlr/render/interface.h> +#include <wlr/render/pixman.h> #include <wlr/render/wlr_renderer.h> #include <wlr/types/wlr_matrix.h> #include <wlr/util/log.h> + +#include <wlr/config.h> + +#if WLR_HAS_GLES2_RENDERER +#include <wlr/render/egl.h> +#include <wlr/render/gles2.h> +#endif + #include "util/signal.h" #include "render/pixel_format.h" #include "render/wlr_renderer.h" @@ -222,6 +228,7 @@ bool wlr_renderer_init_wl_display(struct wlr_renderer *r, } struct wlr_renderer *wlr_renderer_autocreate_with_drm_fd(int drm_fd) { +#if WLR_HAS_GLES2_RENDERER struct gbm_device *gbm_device = gbm_create_device(drm_fd); if (!gbm_device) { wlr_log(WLR_ERROR, "Failed to create GBM device"); @@ -241,9 +248,14 @@ struct wlr_renderer *wlr_renderer_autocreate_with_drm_fd(int drm_fd) { if (!renderer) { wlr_log(WLR_ERROR, "Failed to create GLES2 renderer"); wlr_egl_destroy(egl); + return NULL; } return renderer; +#endif + + wlr_log(WLR_ERROR, "Failed to initialize any renderer"); + return NULL; } struct wlr_renderer *wlr_renderer_autocreate(struct wlr_backend *backend) { |