output: trigger frame/present events on all commits on enabled output

Up until now, frame/present events were only triggered when the
user submitted a buffer. Change the wlr_output API so that these
events are triggered when any commit is applied on an enabled
output.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3708
This commit is contained in:
Simon Ser 2023-08-14 19:39:33 +02:00 committed by Alexander Orzechowski
parent 462f04db9e
commit e5fc8cd4c7
7 changed files with 24 additions and 9 deletions

View file

@ -22,6 +22,7 @@
#include "backend/x11.h"
#include "util/time.h"
#include "types/wlr_output.h"
static const uint32_t SUPPORTED_OUTPUT_STATE =
WLR_OUTPUT_STATE_BACKEND_OPTIONAL |
@ -375,6 +376,10 @@ static bool output_commit(struct wlr_output *wlr_output,
if (!output_commit_buffer(output, state)) {
return false;
}
} else if (output_pending_enabled(wlr_output, state)) {
uint32_t serial = output->wlr_output.commit_seq;
uint64_t target_msc = output->last_msc ? output->last_msc + 1 : 0;
xcb_present_notify_msc(x11->xcb, output->win, serial, target_msc, 0, 0);
}
xcb_flush(x11->xcb);