Skip to content

Instantly share code, notes, and snippets.

@Nogesma
Created March 15, 2024 12:38
Show Gist options
  • Save Nogesma/5ce59439fee0e8d7fc5454ce47d678f8 to your computer and use it in GitHub Desktop.
Save Nogesma/5ce59439fee0e8d7fc5454ce47d678f8 to your computer and use it in GitHub Desktop.
Sway use wlr_frame_scheduler patch
From 89fa2da6fa16320511c97c00947758012294961e Mon Sep 17 00:00:00 2001
From: Mano Segransan <mano.segransan@protonmail.com>
Date: Fri, 15 Mar 2024 13:36:55 +0100
Subject: [PATCH] Use wlr_frame_scheduler
Update for https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4307
---
sway/desktop/output.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index b8f2d32d..fab5e5fa 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -8,6 +8,7 @@
#include <wlr/render/swapchain.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_buffer.h>
+#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_output_layout.h>
@@ -239,8 +240,6 @@ static int output_repaint_timer_handler(void *data) {
return 0;
}
- output->wlr_output->frame_pending = false;
-
output_configure_scene(output, &root->root_scene->tree.node, 1.0f);
if (output->gamma_lut_changed) {
@@ -325,7 +324,6 @@ static void handle_frame(struct wl_listener *listener, void *user_data) {
if (delay < 1) {
output_repaint_timer_handler(output);
} else {
- output->wlr_output->frame_pending = true;
wl_event_source_timer_update(output->repaint_timer, delay);
}
@@ -509,7 +507,7 @@ void handle_new_output(struct wl_listener *listener, void *data) {
output->commit.notify = handle_commit;
wl_signal_add(&wlr_output->events.present, &output->present);
output->present.notify = handle_present;
- wl_signal_add(&wlr_output->events.frame, &output->frame);
+ wl_signal_add(&output->scene_output->frame_scheduler->events.frame, &output->frame);
output->frame.notify = handle_frame;
wl_signal_add(&wlr_output->events.request_state, &output->request_state);
output->request_state.notify = handle_request_state;
@@ -549,7 +547,7 @@ void handle_gamma_control_set_gamma(struct wl_listener *listener, void *data) {
}
output->gamma_lut_changed = true;
- wlr_output_schedule_frame(output->wlr_output);
+ wlr_frame_scheduler_schedule_frame(output->scene_output->frame_scheduler);
}
static void output_manager_apply(struct sway_server *server,
--
2.44.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment