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.
This commit is contained in:
Simon Ser 2020-11-26 11:13:52 +01:00
parent 768131e488
commit 038285d496
1 changed files with 3 additions and 19 deletions

View File

@ -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: