use the new frame scheduler (wlroots!4307)

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4307
This commit is contained in:
Leonardo Hernández Hernández 2023-12-17 15:26:52 -06:00
parent 38ade0e9b6
commit ea49db4090
No known key found for this signature in database
GPG Key ID: E538897EE11B9624
2 changed files with 11 additions and 9 deletions

View File

@ -11,12 +11,12 @@ DATADIR = $(PREFIX)/share
# Allow using an alternative wlroots installations
# This has to have all the includes required by wlroots, e.g:
# Assuming wlroots git repo is "${PWD}/wlroots" and you only ran "meson setup build && ninja -C build"
#WLR_INCS = -I/usr/include/pixman-1 -I/usr/include/elogind -I/usr/include/libdrm \
# -I$(PWD)/wlroots/include
WLR_INCS = -I/usr/include/pixman-1 -I/usr/include/elogind -I/usr/include/libdrm \
-I$(PWD)/wlroots/include
# Set -rpath to avoid using the system library.
#WLR_LIBS = -Wl,-rpath,$(PWD)/wlroots/build -L$(PWD)/wlroots/build -lwlroots-0.19
WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19`
WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19`
WLR_LIBS = -Wl,-rpath,$(PWD)/wlroots/build-new-frame-scheduler -L$(PWD)/wlroots/build-new-frame-scheduler -lwlroots
#WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19`
#WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19`
XWAYLAND =
XLIBS =

10
dwl.c
View File

@ -24,6 +24,7 @@
#include <wlr/types/wlr_drm.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_fractional_scale_v1.h>
#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_idle_notify_v1.h>
@ -1012,8 +1013,10 @@ createmon(struct wl_listener *listener, void *data)
* the user configure it. */
wlr_output_state_set_mode(&state, wlr_output_preferred_mode(wlr_output));
m->scene_output = wlr_scene_output_create(scene, wlr_output);
/* Set up event listeners */
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
LISTEN(&m->scene_output->frame_scheduler->events.frame, &m->frame, rendermon);
LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon);
LISTEN(&wlr_output->events.request_state, &m->request_state, requestmonstate);
@ -1042,7 +1045,6 @@ createmon(struct wl_listener *listener, void *data)
* display, which Wayland clients can see to find out information about the
* output (such as DPI, scale factor, manufacturer, etc).
*/
m->scene_output = wlr_scene_output_create(scene, wlr_output);
if (m->m.x == -1 && m->m.y == -1)
wlr_output_layout_add_auto(output_layout, wlr_output);
else
@ -2135,7 +2137,7 @@ rendermon(struct wl_listener *listener, void *data)
goto commit;
}
wlr_output_commit_state(m->wlr_output, &pending);
wlr_output_schedule_frame(m->wlr_output);
wlr_frame_scheduler_schedule_frame(m->scene_output->frame_scheduler);
} else {
commit:
wlr_scene_output_commit(m->scene_output, NULL);
@ -2349,7 +2351,7 @@ setgamma(struct wl_listener *listener, void *data)
if (!m)
return;
m->gamma_lut_changed = 1;
wlr_output_schedule_frame(m->wlr_output);
wlr_frame_scheduler_schedule_frame(m->scene_output->frame_scheduler);
}
void