aboutsummaryrefslogtreecommitdiff
path: root/backend/headless
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-05-25 08:38:44 -0400
committerGitHub <noreply@github.com>2018-05-25 08:38:44 -0400
commit35b31dcfb7f54c08301c4eb352325bb852b1bece (patch)
tree93d550e437722bdeabca5605ada5c0b4d41128cf /backend/headless
parenta0eb37e2ea4ad96b4f6e98fddbc5c31d0bd0f293 (diff)
parent24cf70ae9691d605e4a1f7e9d8dc59ec72401bd0 (diff)
Merge pull request #1000 from ammen99/custom-renderer-initialization
[RFC] backends: implement custom EGL and renderer initialization
Diffstat (limited to 'backend/headless')
-rw-r--r--backend/headless/backend.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/backend/headless/backend.c b/backend/headless/backend.c
index 1d29e12a..7015099e 100644
--- a/backend/headless/backend.c
+++ b/backend/headless/backend.c
@@ -78,7 +78,8 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
backend_destroy(&backend->backend);
}
-struct wlr_backend *wlr_headless_backend_create(struct wl_display *display) {
+struct wlr_backend *wlr_headless_backend_create(struct wl_display *display,
+ wlr_renderer_create_func_t create_renderer_func) {
wlr_log(L_INFO, "Creating headless backend");
struct wlr_headless_backend *backend =
@@ -101,16 +102,18 @@ struct wlr_backend *wlr_headless_backend_create(struct wl_display *display) {
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE,
};
- bool ok = wlr_egl_init(&backend->egl, EGL_PLATFORM_SURFACELESS_MESA, NULL,
- (EGLint *)config_attribs, 0);
- if (!ok) {
- free(backend);
- return NULL;
+
+ if (!create_renderer_func) {
+ create_renderer_func = wlr_renderer_autocreate;
}
- backend->renderer = wlr_gles2_renderer_create(&backend->egl);
- if (backend->renderer == NULL) {
+ backend->renderer = create_renderer_func(&backend->egl, EGL_PLATFORM_SURFACELESS_MESA,
+ NULL, (EGLint*)config_attribs, 0);
+
+ if (!backend->renderer) {
wlr_log(L_ERROR, "Failed to create renderer");
+ free(backend);
+ return NULL;
}
backend->display_destroy.notify = handle_display_destroy;