examples: switch to new frame scheduling

This commit is contained in:
Rose Hudson 2023-07-29 11:26:39 +01:00
parent ea11856851
commit ef710e3fd4
11 changed files with 57 additions and 15 deletions

View file

@ -9,6 +9,7 @@
#include <wlr/backend.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/util/log.h>
@ -104,10 +105,11 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
struct output *output = calloc(1, sizeof(struct output));
output->wlr = wlr_output;
output->server = server;
output->frame.notify = output_handle_frame;
wl_signal_add(&wlr_output->events.frame, &output->frame);
output->scene_output = wlr_scene_output_create(server->scene, wlr_output);
output->scene_output->frame_scheduler = wlr_frame_scheduler_autocreate(wlr_output);
output->frame.notify = output_handle_frame;
wl_signal_add(&output->scene_output->frame_scheduler->frame, &output->frame);
struct wlr_output_state state;
wlr_output_state_init(&state);

View file

@ -10,6 +10,7 @@
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_fullscreen_shell_v1.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_output_layout.h>
@ -39,6 +40,7 @@ struct fullscreen_output {
struct wl_list link;
struct fullscreen_server *server;
struct wlr_output *wlr_output;
struct wlr_frame_scheduler *frame_scheduler;
struct wlr_surface *surface;
struct wl_listener surface_destroy;
@ -158,10 +160,12 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
calloc(1, sizeof(struct fullscreen_output));
output->wlr_output = wlr_output;
output->server = server;
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->frame, &output->frame);
wlr_output_layout_add_auto(server->output_layout, wlr_output);
wlr_output_create_global(wlr_output);

View file

@ -11,6 +11,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>
@ -57,6 +58,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;
@ -170,10 +172,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->frame, &output->frame);
struct wlr_output_state state;
wlr_output_state_init(&state);
wlr_output_state_set_enabled(&state, true);

View file

@ -13,6 +13,7 @@
#include <wlr/backend/session.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_input_device.h>
@ -39,6 +40,7 @@ struct sample_state {
struct sample_output {
struct sample_state *sample;
struct wlr_output *output;
struct wlr_frame_scheduler *frame_scheduler;
struct wl_listener frame;
struct wl_listener destroy;
};
@ -172,7 +174,8 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
wlr_output_layout_add_auto(sample->layout, output);
sample_output->output = output;
sample_output->sample = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
sample_output->frame_scheduler = wlr_frame_scheduler_autocreate(output);
wl_signal_add(&sample_output->frame_scheduler->frame, &sample_output->frame);
sample_output->frame.notify = output_frame_notify;
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;

View file

@ -12,6 +12,7 @@
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_output_layout.h>
@ -64,6 +65,7 @@ struct touch_point {
struct sample_output {
struct sample_state *state;
struct wlr_output *output;
struct wlr_frame_scheduler *frame_scheduler;
struct wl_listener frame;
struct wl_listener destroy;
};
@ -269,7 +271,8 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
sample_output->output = output;
sample_output->state = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
sample_output->frame_scheduler = wlr_frame_scheduler_autocreate(output);
wl_signal_add(&sample_output->frame_scheduler->frame, &sample_output->frame);
sample_output->frame.notify = output_frame_notify;
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;

View file

@ -12,6 +12,7 @@
#include <wlr/backend.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_input_device.h>
@ -35,6 +36,7 @@ struct sample_state {
struct sample_output {
struct sample_state *sample;
struct wlr_output *output;
struct wlr_frame_scheduler *frame_scheduler;
struct wl_listener frame;
struct wl_listener destroy;
float x_offs, y_offs;
@ -125,7 +127,8 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
sample_output->output = output;
sample_output->sample = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
sample_output->frame_scheduler = wlr_frame_scheduler_autocreate(output);
wl_signal_add(&sample_output->frame_scheduler->frame, &sample_output->frame);
sample_output->frame.notify = output_frame_notify;
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;

View file

@ -11,6 +11,7 @@
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_xdg_shell.h>
@ -76,10 +77,11 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
calloc(1, sizeof(struct output));
output->wlr = wlr_output;
output->server = server;
output->frame.notify = output_handle_frame;
wl_signal_add(&wlr_output->events.frame, &output->frame);
output->scene_output = wlr_scene_output_create(server->scene, wlr_output);
output->scene_output->frame_scheduler = wlr_frame_scheduler_autocreate(wlr_output);
output->frame.notify = output_handle_frame;
wl_signal_add(&output->scene_output->frame_scheduler->frame, &output->frame);
struct wlr_output_state state;
wlr_output_state_init(&state);

View file

@ -9,6 +9,7 @@
#include <wlr/backend/session.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
@ -29,6 +30,7 @@ struct sample_state {
struct sample_output {
struct sample_state *sample;
struct wlr_output *output;
struct wlr_frame_scheduler *frame_scheduler;
struct wl_listener frame;
struct wl_listener destroy;
};
@ -101,7 +103,9 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
calloc(1, sizeof(struct sample_output));
sample_output->output = output;
sample_output->sample = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
sample_output->frame_scheduler = wlr_frame_scheduler_autocreate(output);
wl_signal_add(&sample_output->frame_scheduler->frame, &sample_output->frame);
sample_output->frame.notify = output_frame_notify;
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;

View file

@ -10,6 +10,7 @@
#include <wlr/backend/session.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_input_device.h>
@ -66,6 +67,7 @@ struct tablet_pad_state {
struct sample_output {
struct sample_state *sample;
struct wlr_output *output;
struct wlr_frame_scheduler *frame_scheduler;
struct wl_listener frame;
struct wl_listener destroy;
};
@ -273,7 +275,9 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
sample_output->output = output;
sample_output->sample = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
sample_output->frame_scheduler = wlr_frame_scheduler_autocreate(output);
wl_signal_add(&sample_output->frame_scheduler->frame, &sample_output->frame);
sample_output->frame.notify = output_frame_notify;
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;

View file

@ -12,6 +12,7 @@
#include <wlr/backend/session.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_frame_scheduler.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
@ -54,6 +55,7 @@ struct touch_state {
struct sample_output {
struct sample_state *sample;
struct wlr_output *output;
struct wlr_frame_scheduler *frame_scheduler;
struct wl_listener frame;
struct wl_listener destroy;
};
@ -178,7 +180,9 @@ static void new_output_notify(struct wl_listener *listener, void *data) {
struct sample_output *sample_output = calloc(1, sizeof(struct sample_output));
sample_output->output = output;
sample_output->sample = sample;
wl_signal_add(&output->events.frame, &sample_output->frame);
sample_output->frame_scheduler = wlr_frame_scheduler_autocreate(output);
wl_signal_add(&sample_output->frame_scheduler->frame, &sample_output->frame);
sample_output->frame.notify = output_frame_notify;
wl_signal_add(&output->events.destroy, &sample_output->destroy);
sample_output->destroy.notify = output_remove_notify;