aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@posteo.net>2021-10-14 22:40:12 +0300
committerSimon Ser <contact@emersion.fr>2021-10-15 09:38:58 +0200
commit2af8cc769a4cb2e47d6ec75aa62bb8e565578a24 (patch)
treebc809b9415aa3cc8b95091f4d65bc03a50310983
parent1089b7b8d638a286c70571fced969826d61143bc (diff)
output: add presented flag to presentation event
-rw-r--r--backend/drm/drm.c1
-rw-r--r--backend/headless/output.c1
-rw-r--r--backend/wayland/output.c3
-rw-r--r--backend/x11/output.c2
-rw-r--r--include/wlr/types/wlr_output.h2
-rw-r--r--types/wlr_output.c4
6 files changed, 11 insertions, 2 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index abfd1c2f..191ad064 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -1465,6 +1465,7 @@ static void handle_page_flip(int fd, unsigned seq,
/* The DRM backend guarantees that the presentation event will be for
* the last submitted frame. */
.commit_seq = conn->output.commit_seq,
+ .presented = true,
.when = &present_time,
.seq = seq,
.refresh = mhz_to_nsec(conn->output.refresh),
diff --git a/backend/headless/output.c b/backend/headless/output.c
index 8351c935..43762b23 100644
--- a/backend/headless/output.c
+++ b/backend/headless/output.c
@@ -66,6 +66,7 @@ static bool output_commit(struct wlr_output *wlr_output) {
if (wlr_output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
struct wlr_output_event_present present_event = {
.commit_seq = wlr_output->commit_seq + 1,
+ .presented = true,
};
wlr_output_send_present(wlr_output, &present_event);
}
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index 285c70fc..4d9ef56e 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -75,6 +75,7 @@ static void presentation_feedback_handle_presented(void *data,
};
struct wlr_output_event_present event = {
.commit_seq = feedback->commit_seq,
+ .presented = true,
.when = &t,
.seq = ((uint64_t)seq_hi << 32) | seq_lo,
.refresh = refresh_ns,
@@ -91,6 +92,7 @@ static void presentation_feedback_handle_discarded(void *data,
struct wlr_output_event_present event = {
.commit_seq = feedback->commit_seq,
+ .presented = false,
};
wlr_output_send_present(&feedback->output->wlr_output, &event);
@@ -350,6 +352,7 @@ static bool output_commit(struct wlr_output *wlr_output) {
} else {
struct wlr_output_event_present present_event = {
.commit_seq = wlr_output->commit_seq + 1,
+ .presented = true,
};
wlr_output_send_present(wlr_output, &present_event);
}
diff --git a/backend/x11/output.c b/backend/x11/output.c
index 2f996c10..3ad7b4a4 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -690,9 +690,11 @@ void handle_x11_present_event(struct wlr_x11_backend *x11,
flags |= WLR_OUTPUT_PRESENT_ZERO_COPY;
}
+ bool presented = complete_notify->mode != XCB_PRESENT_COMPLETE_MODE_SKIP;
struct wlr_output_event_present present_event = {
.output = &output->wlr_output,
.commit_seq = complete_notify->serial,
+ .presented = presented,
.when = &t,
.seq = complete_notify->msc,
.flags = flags,
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 5ef5a485..6c07372b 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -228,6 +228,8 @@ struct wlr_output_event_present {
// Frame submission for which this presentation event is for (see
// wlr_output.commit_seq).
uint32_t commit_seq;
+ // Whether the frame was presented at all.
+ bool presented;
// Time when the content update turned into light the first time.
struct timespec *when;
// Vertical retrace counter. Zero if unavailable.
diff --git a/types/wlr_output.c b/types/wlr_output.c
index a1744304..b6167d6d 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -959,8 +959,8 @@ void wlr_output_send_present(struct wlr_output *output,
assert(event);
event->output = output;
- struct timespec now;
- if (event->when == NULL) {
+ if (event->presented && event->when == NULL) {
+ struct timespec now;
clockid_t clock = wlr_backend_get_presentation_clock(output->backend);
errno = 0;
if (clock_gettime(clock, &now) != 0) {