scene: filter frame_done primary output in surface handler

This lets the surface handler decide which output to send frame
callbacks from. The output_sample event already works this way.

Introduce wlr_scene_surface_send_frame_done() as a replacement for
wlr_scene_buffer_send_frame_done() when a compositor doesn't have
an output at hand.
This commit is contained in:
Simon Ser 2025-06-05 12:11:01 +02:00 committed by Kenny Levinsen
parent 8713ac72fb
commit 51d051497d
3 changed files with 32 additions and 10 deletions

View file

@ -152,6 +152,11 @@ struct wlr_scene_output_sample_event {
bool direct_scanout;
};
struct wlr_scene_frame_done_event {
struct wlr_scene_output *output;
struct timespec when;
};
/** A scene-graph node displaying a buffer */
struct wlr_scene_buffer {
struct wlr_scene_node node;
@ -164,7 +169,7 @@ struct wlr_scene_buffer {
struct wl_signal output_enter; // struct wlr_scene_output
struct wl_signal output_leave; // struct wlr_scene_output
struct wl_signal output_sample; // struct wlr_scene_output_sample_event
struct wl_signal frame_done; // struct timespec
struct wl_signal frame_done; // struct wlr_scene_frame_done_event
} events;
// May be NULL
@ -416,6 +421,12 @@ struct wlr_scene_rect *wlr_scene_rect_from_node(struct wlr_scene_node *node);
struct wlr_scene_surface *wlr_scene_surface_try_from_buffer(
struct wlr_scene_buffer *scene_buffer);
/**
* Call wlr_surface_send_frame_done() if the surface is visible.
*/
void wlr_scene_surface_send_frame_done(struct wlr_scene_surface *scene_surface,
const struct timespec *when);
/**
* Add a node displaying a solid-colored rectangle to the scene-graph.
*
@ -531,7 +542,7 @@ void wlr_scene_buffer_set_filter_mode(struct wlr_scene_buffer *scene_buffer,
* Calls the buffer's frame_done signal.
*/
void wlr_scene_buffer_send_frame_done(struct wlr_scene_buffer *scene_buffer,
struct timespec *now);
struct wlr_scene_frame_done_event *event);
/**
* Add a viewport for the specified output to the scene-graph.