|
|
|
@ -663,26 +663,13 @@ bool wlr_output_test_state(struct wlr_output *output,
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool wlr_output_commit_state(struct wlr_output *output,
|
|
|
|
|
const struct wlr_output_state *state) {
|
|
|
|
|
uint32_t unchanged = output_compare_state(output, state);
|
|
|
|
|
|
|
|
|
|
// Create a shallow copy of the state with only the fields which have been
|
|
|
|
|
// changed and potentially a new buffer.
|
|
|
|
|
struct wlr_output_state pending = *state;
|
|
|
|
|
pending.committed &= ~unchanged;
|
|
|
|
|
|
|
|
|
|
if (!output_basic_test(output, &pending)) {
|
|
|
|
|
bool output_prepare_commit(struct wlr_output *output, const struct wlr_output_state *state) {
|
|
|
|
|
if (!output_basic_test(output, state)) {
|
|
|
|
|
wlr_log(WLR_ERROR, "Basic output test failed for %s", output->name);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool new_back_buffer = false;
|
|
|
|
|
if (!output_ensure_buffer(output, &pending, &new_back_buffer)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((pending.committed & WLR_OUTPUT_STATE_BUFFER) &&
|
|
|
|
|
if ((state->committed & WLR_OUTPUT_STATE_BUFFER) &&
|
|
|
|
|
output->idle_frame != NULL) {
|
|
|
|
|
wl_event_source_remove(output->idle_frame);
|
|
|
|
|
output->idle_frame = NULL;
|
|
|
|
@ -694,17 +681,14 @@ bool wlr_output_commit_state(struct wlr_output *output,
|
|
|
|
|
struct wlr_output_event_precommit pre_event = {
|
|
|
|
|
.output = output,
|
|
|
|
|
.when = &now,
|
|
|
|
|
.state = &pending,
|
|
|
|
|
.state = state,
|
|
|
|
|
};
|
|
|
|
|
wl_signal_emit_mutable(&output->events.precommit, &pre_event);
|
|
|
|
|
|
|
|
|
|
if (!output->impl->commit(output, &pending)) {
|
|
|
|
|
if (new_back_buffer) {
|
|
|
|
|
wlr_buffer_unlock(pending.buffer);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void output_apply_commit(struct wlr_output *output, const struct wlr_output_state *state) {
|
|
|
|
|
output->commit_seq++;
|
|
|
|
|
|
|
|
|
|
if (output_pending_enabled(output, state)) {
|
|
|
|
@ -712,14 +696,49 @@ bool wlr_output_commit_state(struct wlr_output *output,
|
|
|
|
|
output->needs_frame = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
output_apply_state(output, &pending);
|
|
|
|
|
output_apply_state(output, state);
|
|
|
|
|
|
|
|
|
|
struct timespec now;
|
|
|
|
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
|
|
|
|
struct wlr_output_event_commit event = {
|
|
|
|
|
.output = output,
|
|
|
|
|
.when = &now,
|
|
|
|
|
.state = &pending,
|
|
|
|
|
.state = state,
|
|
|
|
|
};
|
|
|
|
|
wl_signal_emit_mutable(&output->events.commit, &event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool wlr_output_commit_state(struct wlr_output *output,
|
|
|
|
|
const struct wlr_output_state *state) {
|
|
|
|
|
uint32_t unchanged = output_compare_state(output, state);
|
|
|
|
|
|
|
|
|
|
// Create a shallow copy of the state with only the fields which have been
|
|
|
|
|
// changed and potentially a new buffer.
|
|
|
|
|
struct wlr_output_state pending = *state;
|
|
|
|
|
pending.committed &= ~unchanged;
|
|
|
|
|
|
|
|
|
|
if (!output_basic_test(output, &pending)) {
|
|
|
|
|
wlr_log(WLR_ERROR, "Basic output test failed for %s", output->name);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool new_back_buffer = false;
|
|
|
|
|
if (!output_ensure_buffer(output, &pending, &new_back_buffer)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!output_prepare_commit(output, &pending)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!output->impl->commit(output, &pending)) {
|
|
|
|
|
if (new_back_buffer) {
|
|
|
|
|
wlr_buffer_unlock(pending.buffer);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
output_apply_commit(output, &pending);
|
|
|
|
|
|
|
|
|
|
if (new_back_buffer) {
|
|
|
|
|
wlr_buffer_unlock(pending.buffer);
|
|
|
|
|