output: attach buffer to state in output_ensure_buffer()

master
Simon Ser 2 years ago committed by Alexander Orzechowski
parent 2ac31fc630
commit b625a13156

@ -12,7 +12,7 @@ bool output_pick_format(struct wlr_output *output,
struct wlr_drm_format *format, uint32_t fmt);
void output_clear_back_buffer(struct wlr_output *output);
bool output_ensure_buffer(struct wlr_output *output,
const struct wlr_output_state *state, bool *new_back_buffer);
struct wlr_output_state *state, bool *new_back_buffer);
bool output_cursor_set_texture(struct wlr_output_cursor *cursor,
struct wlr_texture *texture, bool own_texture, float scale,

@ -684,14 +684,10 @@ bool wlr_output_test_state(struct wlr_output *output,
if (!output_ensure_buffer(output, &copy, &new_back_buffer)) {
return false;
}
if (new_back_buffer) {
assert((copy.committed & WLR_OUTPUT_STATE_BUFFER) == 0);
copy.committed |= WLR_OUTPUT_STATE_BUFFER;
copy.buffer = output->back_buffer;
}
bool success = output->impl->test(output, &copy);
if (new_back_buffer) {
wlr_buffer_unlock(copy.buffer);
output_clear_back_buffer(output);
}
return success;
@ -728,8 +724,6 @@ bool wlr_output_commit_state(struct wlr_output *output,
return false;
}
if (new_back_buffer) {
assert((pending.committed & WLR_OUTPUT_STATE_BUFFER) == 0);
wlr_output_state_set_buffer(&pending, output->back_buffer);
output_clear_back_buffer(output);
}

@ -116,8 +116,7 @@ static bool output_attach_empty_back_buffer(struct wlr_output *output,
// This function may attach a new, empty back buffer if necessary.
// If so, the new_back_buffer out parameter will be set to true.
bool output_ensure_buffer(struct wlr_output *output,
const struct wlr_output_state *state,
bool *new_back_buffer) {
struct wlr_output_state *state, bool *new_back_buffer) {
assert(*new_back_buffer == false);
// If we already have a buffer, we don't need to allocate a new one
@ -164,6 +163,7 @@ bool output_ensure_buffer(struct wlr_output *output,
}
*new_back_buffer = true;
wlr_output_state_set_buffer(state, output->back_buffer);
return true;
}

Loading…
Cancel
Save