output: fix attach_buffer semantics

This commit is contained in:
Simon Ser 2019-04-29 23:25:47 +03:00 committed by Drew DeVault
parent 1d222309b8
commit afe7b207d5
4 changed files with 52 additions and 40 deletions

View file

@ -404,6 +404,7 @@ bool wlr_output_attach_render(struct wlr_output *output, int *buffer_age) {
}
output->pending.committed |= WLR_OUTPUT_STATE_BUFFER;
output->pending.buffer_type = WLR_OUTPUT_STATE_BUFFER_RENDER;
return true;
}
@ -480,15 +481,6 @@ bool wlr_output_commit(struct wlr_output *output) {
bool wlr_output_attach_buffer(struct wlr_output *output,
struct wlr_buffer *buffer) {
if (output->frame_pending) {
wlr_log(WLR_ERROR, "Tried to swap buffers when a frame is pending");
return false;
}
if (output->idle_frame != NULL) {
wl_event_source_remove(output->idle_frame);
output->idle_frame = NULL;
}
if (!output->impl->attach_buffer) {
return false;
}
@ -496,9 +488,8 @@ bool wlr_output_attach_buffer(struct wlr_output *output,
return false;
}
output->frame_pending = true;
output->needs_frame = false;
pixman_region32_clear(&output->damage);
output->pending.committed |= WLR_OUTPUT_STATE_BUFFER;
output->pending.buffer_type = WLR_OUTPUT_STATE_BUFFER_SCANOUT;
return true;
}