|
|
@ -663,26 +663,13 @@ bool wlr_output_test_state(struct wlr_output *output,
|
|
|
|
return success;
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool wlr_output_commit_state(struct wlr_output *output,
|
|
|
|
bool output_prepare_commit(struct wlr_output *output, const struct wlr_output_state *state) {
|
|
|
|
const struct wlr_output_state *state) {
|
|
|
|
if (!output_basic_test(output, 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);
|
|
|
|
wlr_log(WLR_ERROR, "Basic output test failed for %s", output->name);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool new_back_buffer = false;
|
|
|
|
if ((state->committed & WLR_OUTPUT_STATE_BUFFER) &&
|
|
|
|
if (!output_ensure_buffer(output, &pending, &new_back_buffer)) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((pending.committed & WLR_OUTPUT_STATE_BUFFER) &&
|
|
|
|
|
|
|
|
output->idle_frame != NULL) {
|
|
|
|
output->idle_frame != NULL) {
|
|
|
|
wl_event_source_remove(output->idle_frame);
|
|
|
|
wl_event_source_remove(output->idle_frame);
|
|
|
|
output->idle_frame = NULL;
|
|
|
|
output->idle_frame = NULL;
|
|
|
@ -694,17 +681,14 @@ bool wlr_output_commit_state(struct wlr_output *output,
|
|
|
|
struct wlr_output_event_precommit pre_event = {
|
|
|
|
struct wlr_output_event_precommit pre_event = {
|
|
|
|
.output = output,
|
|
|
|
.output = output,
|
|
|
|
.when = &now,
|
|
|
|
.when = &now,
|
|
|
|
.state = &pending,
|
|
|
|
.state = state,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
wl_signal_emit_mutable(&output->events.precommit, &pre_event);
|
|
|
|
wl_signal_emit_mutable(&output->events.precommit, &pre_event);
|
|
|
|
|
|
|
|
|
|
|
|
if (!output->impl->commit(output, &pending)) {
|
|
|
|
return true;
|
|
|
|
if (new_back_buffer) {
|
|
|
|
}
|
|
|
|
wlr_buffer_unlock(pending.buffer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void output_apply_commit(struct wlr_output *output, const struct wlr_output_state *state) {
|
|
|
|
output->commit_seq++;
|
|
|
|
output->commit_seq++;
|
|
|
|
|
|
|
|
|
|
|
|
if (output_pending_enabled(output, state)) {
|
|
|
|
if (output_pending_enabled(output, state)) {
|
|
|
@ -712,14 +696,49 @@ bool wlr_output_commit_state(struct wlr_output *output,
|
|
|
|
output->needs_frame = false;
|
|
|
|
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 = {
|
|
|
|
struct wlr_output_event_commit event = {
|
|
|
|
.output = output,
|
|
|
|
.output = output,
|
|
|
|
.when = &now,
|
|
|
|
.when = &now,
|
|
|
|
.state = &pending,
|
|
|
|
.state = state,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
wl_signal_emit_mutable(&output->events.commit, &event);
|
|
|
|
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) {
|
|
|
|
if (new_back_buffer) {
|
|
|
|
wlr_buffer_unlock(pending.buffer);
|
|
|
|
wlr_buffer_unlock(pending.buffer);
|
|
|
|