aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/backend.c42
-rw-r--r--backend/drm/backend.c5
-rw-r--r--backend/drm/renderer.c8
-rw-r--r--backend/headless/backend.c9
-rw-r--r--backend/wayland/backend.c8
-rw-r--r--backend/x11/backend.c9
-rw-r--r--examples/fullscreen-shell.c2
-rw-r--r--examples/multi-pointer.c2
-rw-r--r--examples/output-layout.c2
-rw-r--r--examples/pointer.c2
-rw-r--r--examples/rotation.c2
-rw-r--r--examples/simple.c2
-rw-r--r--examples/tablet.c2
-rw-r--r--examples/touch.c2
-rw-r--r--include/backend/drm/renderer.h2
-rw-r--r--include/wlr/backend.h10
-rw-r--r--include/wlr/backend/drm.h3
-rw-r--r--include/wlr/backend/headless.h3
-rw-r--r--include/wlr/backend/wayland.h2
-rw-r--r--include/wlr/backend/x11.h2
20 files changed, 43 insertions, 76 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 7df1cfbd..8163e203 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -87,9 +87,8 @@ static size_t parse_outputs_env(const char *name) {
return outputs;
}
-static struct wlr_backend *attempt_wl_backend(struct wl_display *display,
- wlr_renderer_create_func_t create_renderer_func) {
- struct wlr_backend *backend = wlr_wl_backend_create(display, NULL, create_renderer_func);
+static struct wlr_backend *attempt_wl_backend(struct wl_display *display) {
+ struct wlr_backend *backend = wlr_wl_backend_create(display, NULL);
if (backend == NULL) {
return NULL;
}
@@ -104,8 +103,8 @@ static struct wlr_backend *attempt_wl_backend(struct wl_display *display,
#if WLR_HAS_X11_BACKEND
static struct wlr_backend *attempt_x11_backend(struct wl_display *display,
- const char *x11_display, wlr_renderer_create_func_t create_renderer_func) {
- struct wlr_backend *backend = wlr_x11_backend_create(display, x11_display, create_renderer_func);
+ const char *x11_display) {
+ struct wlr_backend *backend = wlr_x11_backend_create(display, x11_display);
if (backend == NULL) {
return NULL;
}
@@ -120,8 +119,8 @@ static struct wlr_backend *attempt_x11_backend(struct wl_display *display,
#endif
static struct wlr_backend *attempt_headless_backend(
- struct wl_display *display, wlr_renderer_create_func_t create_renderer_func) {
- struct wlr_backend *backend = wlr_headless_backend_create(display, create_renderer_func);
+ struct wl_display *display) {
+ struct wlr_backend *backend = wlr_headless_backend_create(display);
if (backend == NULL) {
return NULL;
}
@@ -149,8 +148,7 @@ static struct wlr_backend *attempt_noop_backend(struct wl_display *display) {
}
static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
- struct wlr_backend *backend, struct wlr_session *session,
- wlr_renderer_create_func_t create_renderer_func) {
+ struct wlr_backend *backend, struct wlr_session *session) {
struct wlr_device *gpus[8];
size_t num_gpus = wlr_session_find_gpus(session, 8, gpus);
struct wlr_backend *primary_drm = NULL;
@@ -158,7 +156,7 @@ static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
for (size_t i = 0; i < num_gpus; ++i) {
struct wlr_backend *drm = wlr_drm_backend_create(display, session,
- gpus[i], primary_drm, create_renderer_func);
+ gpus[i], primary_drm);
if (!drm) {
wlr_log(WLR_ERROR, "Failed to create DRM backend");
continue;
@@ -176,15 +174,15 @@ static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
struct wlr_backend *backend, struct wlr_session **session,
- const char *name, wlr_renderer_create_func_t create_renderer_func) {
+ const char *name) {
if (strcmp(name, "wayland") == 0) {
- return attempt_wl_backend(display, create_renderer_func);
+ return attempt_wl_backend(display);
#if WLR_HAS_X11_BACKEND
} else if (strcmp(name, "x11") == 0) {
- return attempt_x11_backend(display, NULL, create_renderer_func);
+ return attempt_x11_backend(display, NULL);
#endif
} else if (strcmp(name, "headless") == 0) {
- return attempt_headless_backend(display, create_renderer_func);
+ return attempt_headless_backend(display);
} else if (strcmp(name, "noop") == 0) {
return attempt_noop_backend(display);
} else if (strcmp(name, "drm") == 0 || strcmp(name, "libinput") == 0) {
@@ -200,7 +198,7 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
if (strcmp(name, "libinput") == 0) {
return wlr_libinput_backend_create(display, *session);
} else {
- return attempt_drm_backend(display, backend, *session, create_renderer_func);
+ return attempt_drm_backend(display, backend, *session);
}
}
@@ -208,8 +206,7 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
return NULL;
}
-struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
- wlr_renderer_create_func_t create_renderer_func) {
+struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
struct wlr_backend *backend = wlr_multi_backend_create(display);
struct wlr_multi_backend *multi = (struct wlr_multi_backend *)backend;
if (!backend) {
@@ -230,7 +227,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
char *name = strtok_r(names, ",", &saveptr);
while (name != NULL) {
struct wlr_backend *subbackend = attempt_backend_by_name(display,
- backend, &multi->session, name, create_renderer_func);
+ backend, &multi->session, name);
if (subbackend == NULL) {
wlr_log(WLR_ERROR, "failed to start backend '%s'", name);
wlr_session_destroy(multi->session);
@@ -255,8 +252,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
}
if (getenv("WAYLAND_DISPLAY") || getenv("WAYLAND_SOCKET")) {
- struct wlr_backend *wl_backend = attempt_wl_backend(display,
- create_renderer_func);
+ struct wlr_backend *wl_backend = attempt_wl_backend(display);
if (!wl_backend) {
goto error;
}
@@ -269,7 +265,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
const char *x11_display = getenv("DISPLAY");
if (x11_display) {
struct wlr_backend *x11_backend =
- attempt_x11_backend(display, x11_display, create_renderer_func);
+ attempt_x11_backend(display, x11_display);
if (!x11_backend) {
goto error;
}
@@ -297,8 +293,8 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
}
wlr_multi_backend_add(backend, libinput);
- struct wlr_backend *primary_drm = attempt_drm_backend(display, backend,
- multi->session, create_renderer_func);
+ struct wlr_backend *primary_drm =
+ attempt_drm_backend(display, backend, multi->session);
if (!primary_drm) {
wlr_log(WLR_ERROR, "Failed to open any DRM device");
wlr_backend_destroy(libinput);
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index 5e0f9bcb..27f9d045 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -128,8 +128,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
struct wlr_session *session, struct wlr_device *dev,
- struct wlr_backend *parent,
- wlr_renderer_create_func_t create_renderer_func) {
+ struct wlr_backend *parent) {
assert(display && session && dev);
assert(!parent || wlr_backend_is_drm(parent));
@@ -179,7 +178,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
goto error_event;
}
- if (!init_drm_renderer(drm, &drm->renderer, create_renderer_func)) {
+ if (!init_drm_renderer(drm, &drm->renderer)) {
wlr_log(WLR_ERROR, "Failed to initialize renderer");
goto error_event;
}
diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c
index dd991dce..ebba3bb6 100644
--- a/backend/drm/renderer.c
+++ b/backend/drm/renderer.c
@@ -21,7 +21,7 @@
#include "render/wlr_renderer.h"
bool init_drm_renderer(struct wlr_drm_backend *drm,
- struct wlr_drm_renderer *renderer, wlr_renderer_create_func_t create_renderer_func) {
+ struct wlr_drm_renderer *renderer) {
renderer->backend = drm;
renderer->gbm = gbm_create_device(drm->fd);
@@ -30,11 +30,7 @@ bool init_drm_renderer(struct wlr_drm_backend *drm,
return false;
}
- if (!create_renderer_func) {
- create_renderer_func = wlr_renderer_autocreate;
- }
-
- renderer->wlr_rend = create_renderer_func(&renderer->egl,
+ renderer->wlr_rend = wlr_renderer_autocreate(&renderer->egl,
EGL_PLATFORM_GBM_KHR, renderer->gbm, NULL, 0);
if (!renderer->wlr_rend) {
wlr_log(WLR_ERROR, "Failed to create EGL/WLR renderer");
diff --git a/backend/headless/backend.c b/backend/headless/backend.c
index fe893ddf..6380b6a5 100644
--- a/backend/headless/backend.c
+++ b/backend/headless/backend.c
@@ -184,8 +184,7 @@ out:
return fd;
}
-struct wlr_backend *wlr_headless_backend_create(struct wl_display *display,
- wlr_renderer_create_func_t create_renderer_func) {
+struct wlr_backend *wlr_headless_backend_create(struct wl_display *display) {
wlr_log(WLR_INFO, "Creating headless backend");
int drm_fd = open_drm_render_node();
@@ -207,11 +206,7 @@ struct wlr_backend *wlr_headless_backend_create(struct wl_display *display,
goto error_backend;
}
- if (!create_renderer_func) {
- create_renderer_func = wlr_renderer_autocreate;
- }
-
- struct wlr_renderer *renderer = create_renderer_func(&backend->priv_egl,
+ struct wlr_renderer *renderer = wlr_renderer_autocreate(&backend->priv_egl,
EGL_PLATFORM_GBM_KHR, gbm_alloc->gbm_device, NULL, 0);
if (!renderer) {
wlr_log(WLR_ERROR, "Failed to create renderer");
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
index 11b769bf..ea966d0c 100644
--- a/backend/wayland/backend.c
+++ b/backend/wayland/backend.c
@@ -260,7 +260,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
}
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
- const char *remote, wlr_renderer_create_func_t create_renderer_func) {
+ const char *remote) {
wlr_log(WLR_INFO, "Creating wayland backend");
struct wlr_wl_backend *wl = calloc(1, sizeof(*wl));
@@ -315,11 +315,7 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
}
wl_event_source_check(wl->remote_display_src);
- if (!create_renderer_func) {
- create_renderer_func = wlr_renderer_autocreate;
- }
-
- wl->renderer = create_renderer_func(&wl->egl, EGL_PLATFORM_WAYLAND_EXT,
+ wl->renderer = wlr_renderer_autocreate(&wl->egl, EGL_PLATFORM_WAYLAND_EXT,
wl->remote_display, NULL, 0);
if (!wl->renderer) {
wlr_log(WLR_ERROR, "Could not create renderer");
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 2d09eebe..11cc4fa9 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -322,8 +322,7 @@ static bool query_dri3_formats(struct wlr_x11_backend *x11) {
}
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
- const char *x11_display,
- wlr_renderer_create_func_t create_renderer_func) {
+ const char *x11_display) {
struct wlr_x11_backend *x11 = calloc(1, sizeof(*x11));
if (!x11) {
return NULL;
@@ -512,11 +511,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
}
x11->allocator = &gbm_alloc->base;
- if (!create_renderer_func) {
- create_renderer_func = wlr_renderer_autocreate;
- }
-
- x11->renderer = create_renderer_func(&x11->egl, EGL_PLATFORM_GBM_KHR,
+ x11->renderer = wlr_renderer_autocreate(&x11->egl, EGL_PLATFORM_GBM_KHR,
gbm_alloc->gbm_device, NULL, 0);
if (x11->renderer == NULL) {
wlr_log(WLR_ERROR, "Failed to create renderer");
diff --git a/examples/fullscreen-shell.c b/examples/fullscreen-shell.c
index 9b722c05..9a2f7d7d 100644
--- a/examples/fullscreen-shell.c
+++ b/examples/fullscreen-shell.c
@@ -203,7 +203,7 @@ int main(int argc, char *argv[]) {
struct fullscreen_server server = {0};
server.wl_display = wl_display_create();
- server.backend = wlr_backend_autocreate(server.wl_display, NULL);
+ server.backend = wlr_backend_autocreate(server.wl_display);
server.renderer = wlr_backend_get_renderer(server.backend);
wlr_renderer_init_wl_display(server.renderer, server.wl_display);
diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c
index a48f5888..2445e2ff 100644
--- a/examples/multi-pointer.c
+++ b/examples/multi-pointer.c
@@ -271,7 +271,7 @@ int main(int argc, char *argv[]) {
.clear_color = { 0.25f, 0.25f, 0.25f, 1 },
.display = display,
};
- struct wlr_backend *wlr = wlr_backend_autocreate(display, NULL);
+ struct wlr_backend *wlr = wlr_backend_autocreate(display);
if (!wlr) {
exit(1);
}
diff --git a/examples/output-layout.c b/examples/output-layout.c
index b3fff419..0c86abcc 100644
--- a/examples/output-layout.c
+++ b/examples/output-layout.c
@@ -267,7 +267,7 @@ int main(int argc, char *argv[]) {
state.layout = wlr_output_layout_create();
clock_gettime(CLOCK_MONOTONIC, &state.ts_last);
- struct wlr_backend *wlr = wlr_backend_autocreate(display, NULL);
+ struct wlr_backend *wlr = wlr_backend_autocreate(display);
if (!wlr) {
exit(1);
}
diff --git a/examples/pointer.c b/examples/pointer.c
index 92a5934e..64815804 100644
--- a/examples/pointer.c
+++ b/examples/pointer.c
@@ -333,7 +333,7 @@ int main(int argc, char *argv[]) {
.display = display
};
- struct wlr_backend *wlr = wlr_backend_autocreate(display, NULL);
+ struct wlr_backend *wlr = wlr_backend_autocreate(display);
if (!wlr) {
exit(1);
}
diff --git a/examples/rotation.c b/examples/rotation.c
index edd100e9..4eb600d9 100644
--- a/examples/rotation.c
+++ b/examples/rotation.c
@@ -241,7 +241,7 @@ int main(int argc, char *argv[]) {
};
wl_list_init(&state.outputs);
- struct wlr_backend *wlr = wlr_backend_autocreate(display, NULL);
+ struct wlr_backend *wlr = wlr_backend_autocreate(display);
if (!wlr) {
exit(1);
}
diff --git a/examples/simple.c b/examples/simple.c
index ce58dfa9..34ca46c7 100644
--- a/examples/simple.c
+++ b/examples/simple.c
@@ -173,7 +173,7 @@ int main(void) {
.last_frame = { 0 },
.display = display
};
- struct wlr_backend *backend = wlr_backend_autocreate(display, NULL);
+ struct wlr_backend *backend = wlr_backend_autocreate(display);
if (!backend) {
exit(1);
}
diff --git a/examples/tablet.c b/examples/tablet.c
index 59bf6979..af21ad2e 100644
--- a/examples/tablet.c
+++ b/examples/tablet.c
@@ -356,7 +356,7 @@ int main(int argc, char *argv[]) {
};
wl_list_init(&state.tablet_pads);
wl_list_init(&state.tablet_tools);
- struct wlr_backend *wlr = wlr_backend_autocreate(display, NULL);
+ struct wlr_backend *wlr = wlr_backend_autocreate(display);
if (!wlr) {
exit(1);
}
diff --git a/examples/touch.c b/examples/touch.c
index 7f8980e1..c0053075 100644
--- a/examples/touch.c
+++ b/examples/touch.c
@@ -249,7 +249,7 @@ int main(int argc, char *argv[]) {
wl_list_init(&state.touch_points);
wl_list_init(&state.touch);
- struct wlr_backend *wlr = wlr_backend_autocreate(display, NULL);
+ struct wlr_backend *wlr = wlr_backend_autocreate(display);
if (!wlr) {
exit(1);
}
diff --git a/include/backend/drm/renderer.h b/include/backend/drm/renderer.h
index bafc4ad0..a22cc56a 100644
--- a/include/backend/drm/renderer.h
+++ b/include/backend/drm/renderer.h
@@ -41,7 +41,7 @@ struct wlr_drm_fb {
};
bool init_drm_renderer(struct wlr_drm_backend *drm,
- struct wlr_drm_renderer *renderer, wlr_renderer_create_func_t create_render);
+ struct wlr_drm_renderer *renderer);
void finish_drm_renderer(struct wlr_drm_renderer *renderer);
bool drm_surface_make_current(struct wlr_drm_surface *surf, int *buffer_age);
diff --git a/include/wlr/backend.h b/include/wlr/backend.h
index 3337e51c..edccc665 100644
--- a/include/wlr/backend.h
+++ b/include/wlr/backend.h
@@ -28,20 +28,12 @@ struct wlr_backend {
} events;
};
-typedef struct wlr_renderer *(*wlr_renderer_create_func_t)(struct wlr_egl *egl, EGLenum platform,
- void *remote_display, EGLint *config_attribs, EGLint visual_id);
/**
* Automatically initializes the most suitable backend given the environment.
* Will always return a multibackend. The backend is created but not started.
* Returns NULL on failure.
- *
- * The compositor can request to initialize the backend's renderer by setting
- * the create_render_func. The callback must initialize the given wlr_egl and
- * return a valid wlr_renderer, or NULL if it has failed to initiaze it.
- * Pass NULL as create_renderer_func to use the backend's default renderer.
*/
-struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
- wlr_renderer_create_func_t create_renderer_func);
+struct wlr_backend *wlr_backend_autocreate(struct wl_display *display);
/**
* Start the backend. This may signal new_input or new_output immediately, but
* may also wait until the display's event loop begins. Returns false on
diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h
index cd0f3405..0a307166 100644
--- a/include/wlr/backend/drm.h
+++ b/include/wlr/backend/drm.h
@@ -23,8 +23,7 @@
*/
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
struct wlr_session *session, struct wlr_device *dev,
- struct wlr_backend *parent,
- wlr_renderer_create_func_t create_renderer_func);
+ struct wlr_backend *parent);
bool wlr_backend_is_drm(struct wlr_backend *backend);
bool wlr_output_is_drm(struct wlr_output *output);
diff --git a/include/wlr/backend/headless.h b/include/wlr/backend/headless.h
index f9481228..3eb1677d 100644
--- a/include/wlr/backend/headless.h
+++ b/include/wlr/backend/headless.h
@@ -17,8 +17,7 @@
* Creates a headless backend. A headless backend has no outputs or inputs by
* default.
*/
-struct wlr_backend *wlr_headless_backend_create(struct wl_display *display,
- wlr_renderer_create_func_t create_renderer_func);
+struct wlr_backend *wlr_headless_backend_create(struct wl_display *display);
/**
* Creates a headless backend with an existing renderer.
*/
diff --git a/include/wlr/backend/wayland.h b/include/wlr/backend/wayland.h
index e424e37a..a32a682a 100644
--- a/include/wlr/backend/wayland.h
+++ b/include/wlr/backend/wayland.h
@@ -16,7 +16,7 @@
* default)
*/
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
- const char *remote, wlr_renderer_create_func_t create_renderer_func);
+ const char *remote);
/**
* Returns the remote wl_display used by the Wayland backend.
diff --git a/include/wlr/backend/x11.h b/include/wlr/backend/x11.h
index 5a6f050b..90918f3f 100644
--- a/include/wlr/backend/x11.h
+++ b/include/wlr/backend/x11.h
@@ -17,7 +17,7 @@
* to NULL for the default behaviour of XOpenDisplay.
*/
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
- const char *x11_display, wlr_renderer_create_func_t create_renderer_func);
+ const char *x11_display);
/**
* Adds a new output to this backend. You may remove outputs by destroying them.