mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
scene: Use wlr_output_state_copy for direct scanout path
This commit is contained in:
parent
4b7c526578
commit
b5eaa47049
1 changed files with 12 additions and 8 deletions
|
@ -1534,22 +1534,26 @@ static bool scene_buffer_can_consider_direct_scanout(struct wlr_scene_buffer *bu
|
||||||
|
|
||||||
static bool scene_buffer_try_direct_scanout(struct wlr_scene_buffer *buffer,
|
static bool scene_buffer_try_direct_scanout(struct wlr_scene_buffer *buffer,
|
||||||
struct wlr_scene_output *scene_output, struct wlr_output_state *state) {
|
struct wlr_scene_output *scene_output, struct wlr_output_state *state) {
|
||||||
wlr_output_state_set_buffer(state, buffer->buffer);
|
struct wlr_output_state pending = {0};
|
||||||
|
if (!wlr_output_state_copy(&pending, state)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_output_state_set_buffer(&pending, buffer->buffer);
|
||||||
|
|
||||||
pixman_region32_t frame_damage;
|
pixman_region32_t frame_damage;
|
||||||
get_frame_damage(scene_output, &frame_damage);
|
get_frame_damage(scene_output, &frame_damage);
|
||||||
wlr_output_state_set_damage(state, &frame_damage);
|
wlr_output_state_set_damage(&pending, &frame_damage);
|
||||||
pixman_region32_fini(&frame_damage);
|
pixman_region32_fini(&frame_damage);
|
||||||
|
|
||||||
if (!wlr_output_test_state(scene_output->output, state)) {
|
if (!wlr_output_test_state(scene_output->output, &pending)) {
|
||||||
// reset buffer and damage
|
wlr_output_state_finish(&pending);
|
||||||
state->committed &= ~(WLR_OUTPUT_STATE_BUFFER | WLR_OUTPUT_STATE_DAMAGE);
|
|
||||||
wlr_buffer_unlock(state->buffer);
|
|
||||||
pixman_region32_fini(&state->damage);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wlr_output_state_copy(state, &pending);
|
||||||
|
wlr_output_state_finish(&pending);
|
||||||
|
|
||||||
wl_signal_emit_mutable(&buffer->events.output_present, scene_output);
|
wl_signal_emit_mutable(&buffer->events.output_present, scene_output);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue