From 038285d49671a30750ee06fb24b923ccca29cca5 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 26 Nov 2020 11:13:52 +0100 Subject: [PATCH] backend/wayland: stop rendering black frame on init Instead of rendering a black frame, schedule a frame event to ask the compositor to render a proper frame. --- backend/wayland/output.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 87b06808..77412056 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -565,25 +565,6 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) { wl_display_roundtrip(output->backend->remote_display); - // start rendering loop per callbacks by rendering first frame - if (!wlr_egl_make_current(&output->backend->egl, output->egl_surface, - NULL)) { - goto error; - } - - wlr_renderer_begin(backend->renderer, wlr_output->width, wlr_output->height); - wlr_renderer_clear(backend->renderer, (float[]){ 1.0, 1.0, 1.0, 1.0 }); - wlr_renderer_end(backend->renderer); - - output->frame_callback = wl_surface_frame(output->surface); - wl_callback_add_listener(output->frame_callback, &frame_listener, output); - - if (!wlr_egl_swap_buffers(&output->backend->egl, output->egl_surface, - NULL)) { - goto error; - } - wlr_output->frame_pending = true; - wl_list_insert(&backend->outputs, &output->link); wlr_output_update_enabled(wlr_output, true); @@ -596,6 +577,9 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) { } } + // Start the rendering loop by requesting the compositor to render a frame + wlr_output_schedule_frame(wlr_output); + return wlr_output; error: