From 5fb0007e0249388792f3772c30bfabf8d551dec0 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Thu, 24 Aug 2023 18:12:27 -0400 Subject: [PATCH] output_event_commit: Remove committed and buffer The newly introduced state struct can be used to retrieve this. --- include/wlr/types/wlr_output.h | 2 -- types/output/output.c | 2 -- types/scene/wlr_scene.c | 3 ++- types/wlr_cursor.c | 4 ++-- types/wlr_export_dmabuf_v1.c | 4 ++-- types/wlr_output_layout.c | 3 ++- types/wlr_output_power_management_v1.c | 2 +- types/wlr_screencopy_v1.c | 7 +++---- 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 4b5f29b1..7b57042c 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -224,9 +224,7 @@ struct wlr_output_event_precommit { struct wlr_output_event_commit { struct wlr_output *output; - uint32_t committed; // bitmask of enum wlr_output_state_field struct timespec *when; - struct wlr_buffer *buffer; // NULL if no buffer is committed const struct wlr_output_state *state; }; diff --git a/types/output/output.c b/types/output/output.c index 78bec6db..a04df4e4 100644 --- a/types/output/output.c +++ b/types/output/output.c @@ -833,9 +833,7 @@ bool wlr_output_commit_state(struct wlr_output *output, struct wlr_output_event_commit event = { .output = output, - .committed = pending.committed, .when = &now, - .buffer = (pending.committed & WLR_OUTPUT_STATE_BUFFER) ? pending.buffer : NULL, .state = &pending, }; wl_signal_emit_mutable(&output->events.commit, &event); diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 62da2ef6..9df7dd22 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -1265,8 +1265,9 @@ static void scene_output_handle_commit(struct wl_listener *listener, void *data) struct wlr_scene_output *scene_output = wl_container_of(listener, scene_output, output_commit); struct wlr_output_event_commit *event = data; + const struct wlr_output_state *state = event->state; - if (event->committed & (WLR_OUTPUT_STATE_MODE | + if (state->committed & (WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_TRANSFORM | WLR_OUTPUT_STATE_SCALE | WLR_OUTPUT_STATE_ENABLED)) { diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index be5e06d4..2584c6b6 100644 --- a/types/wlr_cursor.c +++ b/types/wlr_cursor.c @@ -566,13 +566,13 @@ static void output_cursor_output_handle_output_commit( wl_container_of(listener, output_cursor, output_commit); const struct wlr_output_event_commit *event = data; - if (event->committed & WLR_OUTPUT_STATE_SCALE) { + if (event->state->committed & WLR_OUTPUT_STATE_SCALE) { cursor_output_cursor_update(output_cursor); } struct wlr_surface *surface = output_cursor->cursor->state->surface; if (surface && output_cursor->output_cursor->visible && - (event->committed & WLR_OUTPUT_STATE_BUFFER)) { + (event->state->committed & WLR_OUTPUT_STATE_BUFFER)) { wlr_surface_send_frame_done(surface, event->when); } } diff --git a/types/wlr_export_dmabuf_v1.c b/types/wlr_export_dmabuf_v1.c index 8e0c9f45..69245e37 100644 --- a/types/wlr_export_dmabuf_v1.c +++ b/types/wlr_export_dmabuf_v1.c @@ -57,7 +57,7 @@ static void frame_output_handle_commit(struct wl_listener *listener, wl_container_of(listener, frame, output_commit); struct wlr_output_event_commit *event = data; - if (!(event->committed & WLR_OUTPUT_STATE_BUFFER)) { + if (!(event->state->committed & WLR_OUTPUT_STATE_BUFFER)) { return; } @@ -65,7 +65,7 @@ static void frame_output_handle_commit(struct wl_listener *listener, wl_list_init(&frame->output_commit.link); struct wlr_dmabuf_attributes attribs = {0}; - if (!wlr_buffer_get_dmabuf(event->buffer, &attribs)) { + if (!wlr_buffer_get_dmabuf(event->state->buffer, &attribs)) { zwlr_export_dmabuf_frame_v1_send_cancel(frame->resource, ZWLR_EXPORT_DMABUF_FRAME_V1_CANCEL_REASON_TEMPORARY); frame_destroy(frame); diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c index 927e61fb..e0bd7026 100644 --- a/types/wlr_output_layout.c +++ b/types/wlr_output_layout.c @@ -118,7 +118,8 @@ static void handle_output_commit(struct wl_listener *listener, void *data) { wl_container_of(listener, l_output, commit); struct wlr_output_event_commit *event = data; - if (event->committed & (WLR_OUTPUT_STATE_SCALE | WLR_OUTPUT_STATE_TRANSFORM | + if (event->state->committed & (WLR_OUTPUT_STATE_SCALE | + WLR_OUTPUT_STATE_TRANSFORM | WLR_OUTPUT_STATE_MODE)) { output_layout_reconfigure(l_output->layout); output_update_global(l_output->output); diff --git a/types/wlr_output_power_management_v1.c b/types/wlr_output_power_management_v1.c index 04e16753..763d0d6a 100644 --- a/types/wlr_output_power_management_v1.c +++ b/types/wlr_output_power_management_v1.c @@ -62,7 +62,7 @@ static void output_power_handle_output_commit(struct wl_listener *listener, struct wlr_output_power_v1 *output_power = wl_container_of(listener, output_power, output_commit_listener); struct wlr_output_event_commit *event = data; - if (event->committed & WLR_OUTPUT_STATE_ENABLED) { + if (event->state->committed & WLR_OUTPUT_STATE_ENABLED) { output_power_v1_send_mode(output_power); } } diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c index 5140be77..91f98484 100644 --- a/types/wlr_screencopy_v1.c +++ b/types/wlr_screencopy_v1.c @@ -272,10 +272,9 @@ static void frame_handle_output_commit(struct wl_listener *listener, struct wlr_output_event_commit *event = data; struct wlr_output *output = frame->output; struct wlr_renderer *renderer = output->renderer; - struct wlr_buffer *buffer = event->buffer; assert(renderer); - if (!(event->committed & WLR_OUTPUT_STATE_BUFFER)) { + if (!(event->state->committed & WLR_OUTPUT_STATE_BUFFER)) { return; } @@ -297,10 +296,10 @@ static void frame_handle_output_commit(struct wl_listener *listener, bool ok; switch (frame->buffer_cap) { case WLR_BUFFER_CAP_DMABUF: - ok = frame_dma_copy(frame, buffer); + ok = frame_dma_copy(frame, event->state->buffer); break; case WLR_BUFFER_CAP_DATA_PTR: - ok = frame_shm_copy(frame, buffer); + ok = frame_shm_copy(frame, event->state->buffer); break; default: abort(); // unreachable