aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorSimon Zeni <simon@bl4ckb0ne.ca>2021-01-07 00:10:10 -0500
committerSimon Ser <contact@emersion.fr>2021-01-07 17:11:22 +0100
commitb899a412e3eb7be76df495883de9aa2bdb3be06f (patch)
tree0858d2aedf0c252d40ab0964642f286fd1ccb931 /render
parent5773794baff0f1cf843f5585322834d050dd231b (diff)
backend: remove wlr_egl from all backends
Diffstat (limited to 'render')
-rw-r--r--render/gles2/renderer.c1
-rw-r--r--render/wlr_renderer.c15
2 files changed, 14 insertions, 2 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 76114278..6ae5e843 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -674,6 +674,7 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) {
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
+ wlr_egl_finish(renderer->egl);
struct wlr_gles2_buffer *buffer, *buffer_tmp;
wl_list_for_each_safe(buffer, buffer_tmp, &renderer->buffers, link) {
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index e77c41d9..69cc0363 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -247,13 +247,24 @@ bool wlr_renderer_init_wl_display(struct wlr_renderer *r,
return true;
}
-struct wlr_renderer *wlr_renderer_autocreate(struct wlr_egl *egl,
- EGLenum platform, void *remote_display) {
+struct wlr_renderer *wlr_renderer_autocreate(EGLenum platform,
+ void *remote_display) {
+ struct wlr_egl *egl = calloc(1, sizeof(*egl));
+ if (egl == NULL) {
+ wlr_log_errno(WLR_ERROR, "Allocation failed");
+ return NULL;
+ }
+
if (!wlr_egl_init(egl, platform, remote_display, NULL, 0)) {
wlr_log(WLR_ERROR, "Could not initialize EGL");
return NULL;
}
+ /*
+ * wlr_renderer becomes the owner of the previously wlr_egl, and will
+ * take care of freeing the allocated memory
+ * TODO: move the wlr_egl logic to wlr_gles2_renderer
+ */
struct wlr_renderer *renderer = wlr_gles2_renderer_create(egl);
if (!renderer) {
wlr_egl_finish(egl);