mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
Remove wlr_create_renderer_func_t
This callback allowed compositors to customize the EGL config used by the renderer. However with renderer v6 EGL configs aren't used anymore. Instead, buffers are allocated via GBM and GL FBOs are rendered to. So customizing the EGL config is a no-op.
This commit is contained in:
parent
bec1e6b149
commit
4b03bdc3ab
20 changed files with 43 additions and 76 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue