mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-17 06:46:39 -04:00
scene: Use wlr_swapchain_acquire_from_damage_ring()
This commit is contained in:
parent
551340a39e
commit
f96fbf674b
1 changed files with 13 additions and 13 deletions
|
|
@ -2096,7 +2096,9 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
|
||||||
swapchain = output->swapchain;
|
swapchain = output->swapchain;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_buffer *buffer = wlr_swapchain_acquire(swapchain);
|
pixman_region32_init(&render_data.damage);
|
||||||
|
struct wlr_buffer *buffer = wlr_swapchain_acquire_from_damage_ring(swapchain,
|
||||||
|
&scene_output->damage_ring, &render_data.damage);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2121,16 +2123,11 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
|
||||||
.signal_point = scene_output->in_point,
|
.signal_point = scene_output->in_point,
|
||||||
});
|
});
|
||||||
if (render_pass == NULL) {
|
if (render_pass == NULL) {
|
||||||
wlr_buffer_unlock(buffer);
|
goto fail;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render_data.render_pass = render_pass;
|
render_data.render_pass = render_pass;
|
||||||
|
|
||||||
pixman_region32_init(&render_data.damage);
|
|
||||||
wlr_damage_ring_rotate_buffer(&scene_output->damage_ring, buffer,
|
|
||||||
&render_data.damage);
|
|
||||||
|
|
||||||
pixman_region32_t background;
|
pixman_region32_t background;
|
||||||
pixman_region32_init(&background);
|
pixman_region32_init(&background);
|
||||||
pixman_region32_copy(&background, &render_data.damage);
|
pixman_region32_copy(&background, &render_data.damage);
|
||||||
|
|
@ -2212,12 +2209,7 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
|
||||||
pixman_region32_fini(&render_data.damage);
|
pixman_region32_fini(&render_data.damage);
|
||||||
|
|
||||||
if (!wlr_render_pass_submit(render_pass)) {
|
if (!wlr_render_pass_submit(render_pass)) {
|
||||||
wlr_buffer_unlock(buffer);
|
goto fail;
|
||||||
|
|
||||||
// if we failed to render the buffer, it will have undefined contents
|
|
||||||
// Trash the damage ring
|
|
||||||
wlr_damage_ring_add_whole(&scene_output->damage_ring);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_output_state_set_buffer(state, buffer);
|
wlr_output_state_set_buffer(state, buffer);
|
||||||
|
|
@ -2231,6 +2223,14 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
|
||||||
scene_output_state_attempt_gamma(scene_output, state);
|
scene_output_state_attempt_gamma(scene_output, state);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
wlr_buffer_unlock(buffer);
|
||||||
|
|
||||||
|
// if we failed to render the buffer, it will have undefined contents
|
||||||
|
// Trash the damage ring
|
||||||
|
wlr_damage_ring_add_whole(&scene_output->damage_ring);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t wlr_scene_timer_get_duration_ns(struct wlr_scene_timer *timer) {
|
int64_t wlr_scene_timer_get_duration_ns(struct wlr_scene_timer *timer) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue