mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
output: remove wlr_output_impl.schedule_frame
This function allowed backends to provide a custom function for frame scheduling. Before resuming the rendering loop, the DRM and Wayland backends would wait for vsync. There isn't a clear benefit of doing this. The only upside is that we get more stable timings: the delay between two repaints doesn't change too much and is close to a mutliple of the refresh rate. However this introduces latency, especially when a client misses a frame. For instance a fullscreen game missing vblank will need to wait more than a whole frame before being able to display new content. This worst case scenario happens as follows: - Client is still rendering its frame and cannot submit it in time - Deadline is reached - Compositor decides to stop the rendering loop since nothing changed on screen - Client finally manages to render its frame, submits it - Compositor calls wlr_output_schedule_frame - DRM backend waits for next vblank - The wlr_output frame event is fired, compositor draws new content on screen - On the second next vblank, the new content reaches the screen With this patch, the wlr_output frame event is fired immediately when the client submits its late frame. This change also makes it easier to support variable refresh rate, since VRR is all about being able to present too-late frames earlier. References: https://github.com/swaywm/wlroots/issues/1925
This commit is contained in:
parent
613f9c6f8d
commit
348f52b5fc
4 changed files with 2 additions and 63 deletions
|
|
@ -415,20 +415,6 @@ static bool output_move_cursor(struct wlr_output *_output, int x, int y) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool output_schedule_frame(struct wlr_output *wlr_output) {
|
||||
struct wlr_wl_output *output = get_wl_output_from_output(wlr_output);
|
||||
|
||||
if (output->frame_callback != NULL) {
|
||||
wlr_log(WLR_ERROR, "Skipping frame scheduling");
|
||||
return true;
|
||||
}
|
||||
|
||||
output->frame_callback = wl_surface_frame(output->surface);
|
||||
wl_callback_add_listener(output->frame_callback, &frame_listener, output);
|
||||
wl_surface_commit(output->surface);
|
||||
return true;
|
||||
}
|
||||
|
||||
static const struct wlr_output_impl output_impl = {
|
||||
.destroy = output_destroy,
|
||||
.attach_render = output_attach_render,
|
||||
|
|
@ -436,7 +422,6 @@ static const struct wlr_output_impl output_impl = {
|
|||
.commit = output_commit,
|
||||
.set_cursor = output_set_cursor,
|
||||
.move_cursor = output_move_cursor,
|
||||
.schedule_frame = output_schedule_frame,
|
||||
};
|
||||
|
||||
bool wlr_output_is_wl(struct wlr_output *wlr_output) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue