wlr_output: Introduce struct wlr_output_commit

This commit is contained in:
Alexander Orzechowski 2023-10-03 05:40:50 -04:00
parent 1b0694b794
commit c299c13d13
12 changed files with 145 additions and 49 deletions

View file

@ -133,6 +133,7 @@ struct wlr_drm_connector_state {
struct wlr_drm_connector {
struct wlr_output output; // only valid if status != DISCONNECTED
struct wlr_output_commit commit;
struct wlr_drm_backend *backend;
char name[24];
@ -175,7 +176,7 @@ void scan_drm_connectors(struct wlr_drm_backend *state,
void scan_drm_leases(struct wlr_drm_backend *drm);
int handle_drm_event(int fd, uint32_t mask, void *data);
void destroy_drm_connector(struct wlr_drm_connector *conn);
bool drm_connector_commit_state(struct wlr_drm_connector *conn,
struct wlr_output_commit *drm_connector_commit_state(struct wlr_drm_connector *conn,
const struct wlr_output_state *state);
bool drm_connector_is_cursor_visible(struct wlr_drm_connector *conn);
bool drm_connector_supports_vrr(struct wlr_drm_connector *conn);

View file

@ -16,6 +16,7 @@ struct wlr_headless_backend {
struct wlr_headless_output {
struct wlr_output wlr_output;
struct wlr_output_commit commit;
struct wlr_headless_backend *backend;
struct wl_list link;

View file

@ -62,8 +62,10 @@ struct wlr_wl_buffer {
};
struct wlr_wl_presentation_feedback {
struct wlr_output_commit commit;
struct wlr_wl_output *output;
struct wl_list link;
struct wl_list link; // wlr_wl_output.presentation_feedbacks
struct wp_presentation_feedback *feedback;
uint32_t commit_seq;
};
@ -80,8 +82,11 @@ struct wlr_wl_output_layer {
struct wlr_wl_output {
struct wlr_output wlr_output;
// commit used when output is disabled or presentation events are not supported
struct wlr_output_commit commit;
struct wlr_wl_backend *backend;
struct wl_list link;
struct wl_list link; // wlr_wl_backend.outputs
struct wl_surface *surface;
bool own_surface;
@ -89,7 +94,7 @@ struct wlr_wl_output {
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1;
struct wl_list presentation_feedbacks;
struct wl_list presentation_feedbacks; // wlr_wl_presentation_feedback.link
bool configured;
uint32_t enter_serial;

View file

@ -27,6 +27,12 @@
struct wlr_x11_backend;
struct wlr_x11_output_commit {
struct wl_list link; // wlr_x11_output::commits;
uint32_t serial;
struct wlr_output_commit commit;
};
struct wlr_x11_output {
struct wlr_output wlr_output;
struct wlr_x11_backend *x11;
@ -50,6 +56,8 @@ struct wlr_x11_output {
struct wlr_swapchain *swapchain;
xcb_render_picture_t pic;
} cursor;
struct wl_list commits; // wlr_x11_output_commit::link
};
struct wlr_x11_touchpoint {

View file

@ -21,6 +21,6 @@ bool output_cursor_set_texture(struct wlr_output_cursor *cursor,
int dst_width, int dst_height, enum wl_output_transform transform,
int32_t hotspot_x, int32_t hotspot_y);
void output_defer_present(struct wlr_output *output, struct wlr_output_event_present event);
void output_commit_defer_present(struct wlr_output_commit *commit);
#endif

View file

@ -65,7 +65,8 @@ struct wlr_output_impl {
*
* If a buffer has been attached, a frame event is scheduled.
*/
bool (*commit)(struct wlr_output *output, const struct wlr_output_state *state);
struct wlr_output_commit *(*commit)(struct wlr_output *output,
const struct wlr_output_state *state);
/**
* Get the maximum number of gamma LUT elements for each channel.
*

View file

@ -227,6 +227,7 @@ struct wlr_output_event_commit {
uint32_t committed; // bitmask of enum wlr_output_state_field
struct timespec *when;
struct wlr_buffer *buffer; // NULL if no buffer is committed
struct wlr_output_commit *commit;
};
enum wlr_output_present_flag {
@ -270,8 +271,20 @@ struct wlr_output_event_request_state {
const struct wlr_output_state *state;
};
struct wlr_output_commit {
struct wlr_output *output;
struct {
struct wl_signal present; // struct wlr_output_event_present
} events;
};
struct wlr_surface;
void wlr_output_commit_init(struct wlr_output_commit *commit,
struct wlr_output *output);
/**
* Enables or disables the output. A disabled output is turned off and doesn't
* emit `frame` events.