mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 22:55:58 +01:00
348f52b5fc
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
46 lines
1.8 KiB
C
46 lines
1.8 KiB
C
/*
|
|
* This an unstable interface of wlroots. No guarantees are made regarding the
|
|
* future consistency of this API.
|
|
*/
|
|
#ifndef WLR_USE_UNSTABLE
|
|
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
|
|
#endif
|
|
|
|
#ifndef WLR_INTERFACES_WLR_OUTPUT_H
|
|
#define WLR_INTERFACES_WLR_OUTPUT_H
|
|
|
|
#include <stdbool.h>
|
|
#include <wlr/backend.h>
|
|
#include <wlr/types/wlr_box.h>
|
|
#include <wlr/types/wlr_output.h>
|
|
|
|
struct wlr_output_impl {
|
|
bool (*set_cursor)(struct wlr_output *output, struct wlr_texture *texture,
|
|
int32_t scale, enum wl_output_transform transform,
|
|
int32_t hotspot_x, int32_t hotspot_y, bool update_texture);
|
|
bool (*move_cursor)(struct wlr_output *output, int x, int y);
|
|
void (*destroy)(struct wlr_output *output);
|
|
bool (*attach_render)(struct wlr_output *output, int *buffer_age);
|
|
bool (*commit)(struct wlr_output *output);
|
|
bool (*set_gamma)(struct wlr_output *output, size_t size,
|
|
const uint16_t *r, const uint16_t *g, const uint16_t *b);
|
|
size_t (*get_gamma_size)(struct wlr_output *output);
|
|
bool (*export_dmabuf)(struct wlr_output *output,
|
|
struct wlr_dmabuf_attributes *attribs);
|
|
bool (*attach_buffer)(struct wlr_output *output, struct wlr_buffer *buffer);
|
|
};
|
|
|
|
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
|
const struct wlr_output_impl *impl, struct wl_display *display);
|
|
void wlr_output_update_mode(struct wlr_output *output,
|
|
struct wlr_output_mode *mode);
|
|
void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
|
|
int32_t height, int32_t refresh);
|
|
void wlr_output_update_enabled(struct wlr_output *output, bool enabled);
|
|
void wlr_output_update_needs_frame(struct wlr_output *output);
|
|
void wlr_output_damage_whole(struct wlr_output *output);
|
|
void wlr_output_send_frame(struct wlr_output *output);
|
|
void wlr_output_send_present(struct wlr_output *output,
|
|
struct wlr_output_event_present *event);
|
|
|
|
#endif
|