aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/gles2/meson.build9
-rw-r--r--render/meson.build19
-rw-r--r--render/pixman/meson.build1
-rw-r--r--render/wlr_renderer.c18
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) {