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.
This commit is contained in:
Consolatis 2024-02-27 23:25:45 +01:00 committed by Johan Malm
parent f250c6ba12
commit 74501bc7fa

View file

@ -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");
}