mirror of
https://github.com/swaywm/sway.git
synced 2025-10-28 05:40:16 -04:00
Stop using wlr_scene_buffer_send_frame_done()
That function now takes the output as input. We don't always have the output at hand, so use the function operating on a wlr_scene_surface instead.
This commit is contained in:
parent
25ea1a0af2
commit
eb8acfd7b1
2 changed files with 18 additions and 7 deletions
|
|
@ -97,11 +97,11 @@ struct buffer_timer {
|
|||
};
|
||||
|
||||
static int handle_buffer_timer(void *data) {
|
||||
struct wlr_scene_buffer *buffer = data;
|
||||
struct wlr_scene_surface *scene_surface = data;
|
||||
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
wlr_scene_buffer_send_frame_done(buffer, &now);
|
||||
wlr_scene_surface_send_frame_done(scene_surface, &now);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +114,9 @@ static void handle_buffer_timer_destroy(struct wl_listener *listener,
|
|||
free(timer);
|
||||
}
|
||||
|
||||
static struct buffer_timer *buffer_timer_get_or_create(struct wlr_scene_buffer *buffer) {
|
||||
static struct buffer_timer *buffer_timer_get_or_create(struct wlr_scene_surface *scene_surface) {
|
||||
struct wlr_scene_buffer *buffer = scene_surface->buffer;
|
||||
|
||||
struct buffer_timer *timer =
|
||||
scene_descriptor_try_get(&buffer->node, SWAY_SCENE_DESC_BUFFER_TIMER);
|
||||
if (timer) {
|
||||
|
|
@ -127,7 +129,7 @@ static struct buffer_timer *buffer_timer_get_or_create(struct wlr_scene_buffer *
|
|||
}
|
||||
|
||||
timer->frame_done_timer = wl_event_loop_add_timer(server.wl_event_loop,
|
||||
handle_buffer_timer, buffer);
|
||||
handle_buffer_timer, scene_surface);
|
||||
if (!timer->frame_done_timer) {
|
||||
free(timer);
|
||||
return NULL;
|
||||
|
|
@ -151,6 +153,11 @@ static void send_frame_done_iterator(struct wlr_scene_buffer *buffer,
|
|||
return;
|
||||
}
|
||||
|
||||
struct wlr_scene_surface *scene_surface = wlr_scene_surface_try_from_buffer(buffer);
|
||||
if (scene_surface == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_scene_node *current = &buffer->node;
|
||||
while (true) {
|
||||
struct sway_view *view = scene_descriptor_try_get(current,
|
||||
|
|
@ -173,13 +180,13 @@ static void send_frame_done_iterator(struct wlr_scene_buffer *buffer,
|
|||
struct buffer_timer *timer = NULL;
|
||||
|
||||
if (output->max_render_time != 0 && view_max_render_time != 0 && delay > 0) {
|
||||
timer = buffer_timer_get_or_create(buffer);
|
||||
timer = buffer_timer_get_or_create(scene_surface);
|
||||
}
|
||||
|
||||
if (timer) {
|
||||
wl_event_source_timer_update(timer->frame_done_timer, delay);
|
||||
} else {
|
||||
wlr_scene_buffer_send_frame_done(buffer, &data->when);
|
||||
wlr_scene_surface_send_frame_done(scene_surface, &data->when);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1242,7 +1242,11 @@ bool view_can_tear(struct sway_view *view) {
|
|||
static void send_frame_done_iterator(struct wlr_scene_buffer *scene_buffer,
|
||||
int x, int y, void *data) {
|
||||
struct timespec *when = data;
|
||||
wl_signal_emit_mutable(&scene_buffer->events.frame_done, when);
|
||||
struct wlr_scene_surface *scene_surface = wlr_scene_surface_try_from_buffer(scene_buffer);
|
||||
if (scene_surface == NULL) {
|
||||
return;
|
||||
}
|
||||
wlr_scene_surface_send_frame_done(scene_surface, when);
|
||||
}
|
||||
|
||||
void view_send_frame_done(struct sway_view *view) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue