aboutsummaryrefslogtreecommitdiff
path: root/backend/x11
diff options
context:
space:
mode:
authorIlia Bozhinov <ammen99@gmail.com>2018-05-25 13:14:35 +0300
committerIlia Bozhinov <ammen99@gmail.com>2018-05-25 14:56:52 +0300
commit24cf70ae9691d605e4a1f7e9d8dc59ec72401bd0 (patch)
tree93d550e437722bdeabca5605ada5c0b4d41128cf /backend/x11
parenta0eb37e2ea4ad96b4f6e98fddbc5c31d0bd0f293 (diff)
backends: implement custom EGL and renderer initialization
Compositors now have more control over how the backend creates its renderer. Currently all backends create an EGL/GLES2 renderer, so the necessary attributes for creating the context are passed to a user-provided callback function. It is responsible for initializing provided wlr_egl and to return a renderer. On fail, return 0. Fixes #987
Diffstat (limited to 'backend/x11')
-rw-r--r--backend/x11/backend.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 845495e7..d4793b9c 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -232,7 +232,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
}
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
- const char *x11_display) {
+ const char *x11_display, wlr_renderer_create_func_t create_renderer_func) {
struct wlr_x11_backend *x11 = calloc(1, sizeof(*x11));
if (!x11) {
return NULL;
@@ -267,15 +267,16 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
x11->screen = xcb_setup_roots_iterator(xcb_get_setup(x11->xcb_conn)).data;
- if (!wlr_egl_init(&x11->egl, EGL_PLATFORM_X11_KHR, x11->xlib_conn, NULL,
- x11->screen->root_visual)) {
- goto error_event;
+ if (!create_renderer_func) {
+ create_renderer_func = wlr_renderer_autocreate;
}
- x11->renderer = wlr_gles2_renderer_create(&x11->egl);
+ x11->renderer = create_renderer_func(&x11->egl, EGL_PLATFORM_X11_KHR,
+ x11->xlib_conn, NULL, x11->screen->root_visual);
+
if (x11->renderer == NULL) {
wlr_log(L_ERROR, "Failed to create renderer");
- goto error_egl;
+ goto error_event;
}
wlr_input_device_init(&x11->keyboard_dev, WLR_INPUT_DEVICE_KEYBOARD,
@@ -288,8 +289,6 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
return &x11->backend;
-error_egl:
- wlr_egl_finish(&x11->egl);
error_event:
wl_event_source_remove(x11->event_source);
error_x11: