scene: Add wlr_scene_output_set_frame_scheduler

This allows the compositor to replace frame schedulers for a given scene
output at runtime.
This commit is contained in:
Kenny Levinsen 2026-04-05 16:29:01 +00:00
parent d99ee40a1d
commit d560a30adc
2 changed files with 16 additions and 0 deletions

View file

@ -592,6 +592,13 @@ void wlr_scene_output_destroy(struct wlr_scene_output *scene_output);
*/
void wlr_scene_output_set_position(struct wlr_scene_output *scene_output,
int lx, int ly);
/**
* Replace the frame scheduler for this scene output, destroying the previous
* scheduler. If scene output currently needs a new frame, a frame will be
* scheduled on the new frame scheduler.
*/
void wlr_scene_output_set_frame_scheduler(struct wlr_scene_output *scene_output,
struct wlr_frame_scheduler *scheduler);
struct wlr_scene_output_state_options {
struct wlr_scene_timer *timer;

View file

@ -1790,6 +1790,15 @@ static void highlight_region_destroy(struct highlight_region *damage) {
free(damage);
}
void wlr_scene_output_set_frame_scheduler(struct wlr_scene_output *scene_output,
struct wlr_frame_scheduler *scheduler) {
wlr_frame_scheduler_destroy(scene_output->frame_scheduler);
scene_output->frame_scheduler = scheduler;
if (wlr_scene_output_needs_frame(scene_output)) {
wlr_frame_scheduler_schedule_frame(scheduler);
}
}
void wlr_scene_output_destroy(struct wlr_scene_output *scene_output) {
if (scene_output == NULL) {
return;