mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
output: attach buffer to state in output_ensure_buffer()
This commit is contained in:
parent
2ac31fc630
commit
b625a13156
3 changed files with 4 additions and 10 deletions
|
@ -12,7 +12,7 @@ bool output_pick_format(struct wlr_output *output,
|
||||||
struct wlr_drm_format *format, uint32_t fmt);
|
struct wlr_drm_format *format, uint32_t fmt);
|
||||||
void output_clear_back_buffer(struct wlr_output *output);
|
void output_clear_back_buffer(struct wlr_output *output);
|
||||||
bool output_ensure_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,
|
bool output_cursor_set_texture(struct wlr_output_cursor *cursor,
|
||||||
struct wlr_texture *texture, bool own_texture, float scale,
|
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, ©, &new_back_buffer)) {
|
if (!output_ensure_buffer(output, ©, &new_back_buffer)) {
|
||||||
return false;
|
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, ©);
|
bool success = output->impl->test(output, ©);
|
||||||
if (new_back_buffer) {
|
if (new_back_buffer) {
|
||||||
|
wlr_buffer_unlock(copy.buffer);
|
||||||
output_clear_back_buffer(output);
|
output_clear_back_buffer(output);
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
|
@ -728,8 +724,6 @@ bool wlr_output_commit_state(struct wlr_output *output,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (new_back_buffer) {
|
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);
|
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.
|
// This function may attach a new, empty back buffer if necessary.
|
||||||
// If so, the new_back_buffer out parameter will be set to true.
|
// If so, the new_back_buffer out parameter will be set to true.
|
||||||
bool output_ensure_buffer(struct wlr_output *output,
|
bool output_ensure_buffer(struct wlr_output *output,
|
||||||
const struct wlr_output_state *state,
|
struct wlr_output_state *state, bool *new_back_buffer) {
|
||||||
bool *new_back_buffer) {
|
|
||||||
assert(*new_back_buffer == false);
|
assert(*new_back_buffer == false);
|
||||||
|
|
||||||
// If we already have a buffer, we don't need to allocate a new one
|
// 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;
|
*new_back_buffer = true;
|
||||||
|
wlr_output_state_set_buffer(state, output->back_buffer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue