mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
examples: switch to new frame scheduling
This commit is contained in:
parent
b2550a88ff
commit
812eeaa9c7
7 changed files with 67 additions and 8 deletions
|
|
@ -10,6 +10,7 @@
|
|||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/types/wlr_drm.h>
|
||||
#include <wlr/types/wlr_frame_scheduler.h>
|
||||
#include <wlr/types/wlr_linux_dmabuf_v1.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wlr/types/wlr_output_layer.h>
|
||||
|
|
@ -56,6 +57,7 @@ struct output {
|
|||
struct wl_list link;
|
||||
struct server *server;
|
||||
struct wlr_output *wlr_output;
|
||||
struct wlr_frame_scheduler *frame_scheduler;
|
||||
struct wl_list surfaces;
|
||||
|
||||
struct wl_listener frame;
|
||||
|
|
@ -155,6 +157,8 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
wl_array_release(&layers_arr);
|
||||
|
||||
wlr_frame_scheduler_schedule_frame(output->frame_scheduler);
|
||||
}
|
||||
|
||||
static void server_handle_new_output(struct wl_listener *listener, void *data) {
|
||||
|
|
@ -167,10 +171,12 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
|
|||
output->wlr_output = wlr_output;
|
||||
output->server = server;
|
||||
wl_list_init(&output->surfaces);
|
||||
output->frame.notify = output_handle_frame;
|
||||
wl_signal_add(&wlr_output->events.frame, &output->frame);
|
||||
wl_list_insert(&server->outputs, &output->link);
|
||||
|
||||
output->frame_scheduler = wlr_frame_scheduler_autocreate(wlr_output);
|
||||
output->frame.notify = output_handle_frame;
|
||||
wl_signal_add(&output->frame_scheduler->events.frame, &output->frame);
|
||||
|
||||
struct wlr_output_state state;
|
||||
wlr_output_state_init(&state);
|
||||
wlr_output_state_set_enabled(&state, true);
|
||||
|
|
@ -181,6 +187,8 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
|
|||
wlr_output_commit_state(wlr_output, &state);
|
||||
wlr_output_state_finish(&state);
|
||||
|
||||
wlr_frame_scheduler_schedule_frame(output->frame_scheduler);
|
||||
|
||||
wlr_output_create_global(wlr_output, server->wl_display);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue