From 74501bc7fadc3b152dc9e1f18d87f154bdc1cb03 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Tue, 27 Feb 2024 23:25:45 +0100 Subject: [PATCH] src/output.c: restore flicker free resize when running nested PR #1301 did partly revert the first variant because `lab_wlr_scene_output_commit()` (which uses the `output->pending` state in contrast to `wlr_scene_output_commit()`) was deemd to cause 'frozen' frames during video playback (#1273). We are now back at using `lab_wlr_scene_output_commit()` for unrelated reasons and the cause of the original issue #1273 was likely that `wlr_scene_output_send_frame_done()` was only sent on a successful commit. This was changed to always be sent. So lets restore the flicker free nested resize as well. --- src/output.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/output.c b/src/output.c index e1c615e7..16eee4b8 100644 --- a/src/output.c +++ b/src/output.c @@ -150,6 +150,32 @@ output_request_state_notify(struct wl_listener *listener, void *data) struct output *output = wl_container_of(listener, output, request_state); const struct wlr_output_event_request_state *event = data; + /* + * If wlroots ever requests other state changes here we could + * restore more of ddc9047a67cd53b2948f71fde1bbe9118000dd3f. + */ + if (event->state->committed == WLR_OUTPUT_STATE_MODE) { + /* Only the mode has changed */ + switch (event->state->mode_type) { + case WLR_OUTPUT_STATE_MODE_FIXED: + wlr_output_set_mode(output->wlr_output, event->state->mode); + break; + case WLR_OUTPUT_STATE_MODE_CUSTOM: + wlr_output_set_custom_mode(output->wlr_output, + event->state->custom_mode.width, + event->state->custom_mode.height, + event->state->custom_mode.refresh); + break; + } + wlr_output_schedule_frame(output->wlr_output); + return; + } + + /* + * Fallback path for everything that we didn't handle above. + * The commit will cause a black frame injection so this + * path causes flickering during resize of nested outputs. + */ if (!wlr_output_commit_state(output->wlr_output, event->state)) { wlr_log(WLR_ERROR, "Backend requested a new state that could not be applied"); } -- 2.52.0