aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-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
6 files changed, 29 insertions, 52 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");