output: expose wlr_output_state_set_buffer()

This commit is contained in:
Simon Ser 2023-02-20 12:00:18 +01:00 committed by Isaac Freund
parent 4629d0ef40
commit 7215bd1e0f
4 changed files with 12 additions and 12 deletions

View file

@ -6,8 +6,6 @@
void output_pending_resolution(struct wlr_output *output, void output_pending_resolution(struct wlr_output *output,
const struct wlr_output_state *state, int *width, int *height); const struct wlr_output_state *state, int *width, int *height);
void output_state_attach_buffer(struct wlr_output_state *state,
struct wlr_buffer *buffer);
bool output_is_direct_scanout(struct wlr_output *output, bool output_is_direct_scanout(struct wlr_output *output,
struct wlr_buffer *buffer); struct wlr_buffer *buffer);

View file

@ -559,6 +559,8 @@ void wlr_output_state_set_render_format(struct wlr_output_state *state,
uint32_t format); uint32_t format);
void wlr_output_state_set_subpixel(struct wlr_output_state *state, void wlr_output_state_set_subpixel(struct wlr_output_state *state,
enum wl_output_subpixel subpixel); enum wl_output_subpixel subpixel);
void wlr_output_state_set_buffer(struct wlr_output_state *state,
struct wlr_buffer *buffer);
/** /**

View file

@ -743,7 +743,7 @@ bool wlr_output_commit_state(struct wlr_output *output,
} }
if (new_back_buffer) { if (new_back_buffer) {
assert((pending.committed & WLR_OUTPUT_STATE_BUFFER) == 0); assert((pending.committed & WLR_OUTPUT_STATE_BUFFER) == 0);
output_state_attach_buffer(&pending, output->back_buffer); wlr_output_state_set_buffer(&pending, output->back_buffer);
output_clear_back_buffer(output); output_clear_back_buffer(output);
} }
@ -872,7 +872,7 @@ bool wlr_output_commit(struct wlr_output *output) {
// implicit rendering synchronization point. The backend needs it to avoid // implicit rendering synchronization point. The backend needs it to avoid
// displaying a buffer when asynchronous GPU work isn't finished. // displaying a buffer when asynchronous GPU work isn't finished.
if (output->back_buffer != NULL) { if (output->back_buffer != NULL) {
output_state_attach_buffer(&state, output->back_buffer); wlr_output_state_set_buffer(&state, output->back_buffer);
output_clear_back_buffer(output); output_clear_back_buffer(output);
} }
@ -886,16 +886,9 @@ void wlr_output_rollback(struct wlr_output *output) {
output_state_clear(&output->pending); output_state_clear(&output->pending);
} }
void output_state_attach_buffer(struct wlr_output_state *state,
struct wlr_buffer *buffer) {
output_state_clear_buffer(state);
state->committed |= WLR_OUTPUT_STATE_BUFFER;
state->buffer = wlr_buffer_lock(buffer);
}
void wlr_output_attach_buffer(struct wlr_output *output, void wlr_output_attach_buffer(struct wlr_output *output,
struct wlr_buffer *buffer) { struct wlr_buffer *buffer) {
output_state_attach_buffer(&output->pending, buffer); wlr_output_state_set_buffer(&output->pending, buffer);
} }
void wlr_output_send_frame(struct wlr_output *output) { void wlr_output_send_frame(struct wlr_output *output) {

View file

@ -66,3 +66,10 @@ void wlr_output_state_set_subpixel(struct wlr_output_state *state,
state->committed |= WLR_OUTPUT_STATE_SUBPIXEL; state->committed |= WLR_OUTPUT_STATE_SUBPIXEL;
state->subpixel = subpixel; state->subpixel = subpixel;
} }
void wlr_output_state_set_buffer(struct wlr_output_state *state,
struct wlr_buffer *buffer) {
state->committed |= WLR_OUTPUT_STATE_BUFFER;
wlr_buffer_unlock(state->buffer);
state->buffer = wlr_buffer_lock(buffer);
}