types/wlr_output: removing the useless pointer

master
YaoBing Xiao 3 months ago committed by Alexander Orzechowski
parent cf93d31736
commit 43554c1966

@ -2062,16 +2062,15 @@ static void handle_page_flip(int fd, unsigned seq,
present_flags |= WLR_OUTPUT_PRESENT_ZERO_COPY; present_flags |= WLR_OUTPUT_PRESENT_ZERO_COPY;
} }
struct timespec present_time = {
.tv_sec = tv_sec,
.tv_nsec = tv_usec * 1000,
};
struct wlr_output_event_present present_event = { struct wlr_output_event_present present_event = {
/* The DRM backend guarantees that the presentation event will be for /* The DRM backend guarantees that the presentation event will be for
* the last submitted frame. */ * the last submitted frame. */
.commit_seq = conn->output.commit_seq, .commit_seq = conn->output.commit_seq,
.presented = drm->session->active, .presented = drm->session->active,
.when = &present_time, .when = {
.tv_sec = tv_sec,
.tv_nsec = tv_usec * 1000,
},
.seq = seq, .seq = seq,
.refresh = mhz_to_nsec(conn->refresh), .refresh = mhz_to_nsec(conn->refresh),
.flags = present_flags, .flags = present_flags,

@ -94,14 +94,13 @@ static void presentation_feedback_handle_presented(void *data,
uint32_t seq_hi, uint32_t seq_lo, uint32_t flags) { uint32_t seq_hi, uint32_t seq_lo, uint32_t flags) {
struct wlr_wl_presentation_feedback *feedback = data; struct wlr_wl_presentation_feedback *feedback = data;
struct timespec t = {
.tv_sec = ((uint64_t)tv_sec_hi << 32) | tv_sec_lo,
.tv_nsec = tv_nsec,
};
struct wlr_output_event_present event = { struct wlr_output_event_present event = {
.commit_seq = feedback->commit_seq, .commit_seq = feedback->commit_seq,
.presented = true, .presented = true,
.when = &t, .when = {
.tv_sec = ((uint64_t)tv_sec_hi << 32) | tv_sec_lo,
.tv_nsec = tv_nsec,
},
.seq = ((uint64_t)seq_hi << 32) | seq_lo, .seq = ((uint64_t)seq_hi << 32) | seq_lo,
.refresh = refresh_ns, .refresh = refresh_ns,
.flags = flags, .flags = flags,

@ -747,9 +747,6 @@ void handle_x11_present_event(struct wlr_x11_backend *x11,
output->last_msc = complete_notify->msc; output->last_msc = complete_notify->msc;
struct timespec t;
timespec_from_nsec(&t, complete_notify->ust * 1000);
uint32_t flags = 0; uint32_t flags = 0;
if (complete_notify->mode == XCB_PRESENT_COMPLETE_MODE_FLIP) { if (complete_notify->mode == XCB_PRESENT_COMPLETE_MODE_FLIP) {
flags |= WLR_OUTPUT_PRESENT_ZERO_COPY; flags |= WLR_OUTPUT_PRESENT_ZERO_COPY;
@ -760,10 +757,10 @@ void handle_x11_present_event(struct wlr_x11_backend *x11,
.output = &output->wlr_output, .output = &output->wlr_output,
.commit_seq = complete_notify->serial, .commit_seq = complete_notify->serial,
.presented = presented, .presented = presented,
.when = &t,
.seq = complete_notify->msc, .seq = complete_notify->msc,
.flags = flags, .flags = flags,
}; };
timespec_from_nsec(&present_event.when, complete_notify->ust * 1000);
wlr_output_send_present(&output->wlr_output, &present_event); wlr_output_send_present(&output->wlr_output, &present_event);
wlr_output_send_frame(&output->wlr_output); wlr_output_send_frame(&output->wlr_output);

@ -263,7 +263,7 @@ struct wlr_output_event_present {
// Whether the frame was presented at all. // Whether the frame was presented at all.
bool presented; bool presented;
// Time when the content update turned into light the first time. // Time when the content update turned into light the first time.
struct timespec *when; struct timespec when;
// Vertical retrace counter. Zero if unavailable. // Vertical retrace counter. Zero if unavailable.
unsigned seq; unsigned seq;
// Prediction of how many nanoseconds after `when` the very next output // Prediction of how many nanoseconds after `when` the very next output

@ -794,14 +794,12 @@ void wlr_output_send_present(struct wlr_output *output,
assert(event); assert(event);
event->output = output; event->output = output;
struct timespec now; if (event->presented && (event->when.tv_sec == 0 && event->when.tv_nsec == 0)) {
if (event->presented && event->when == NULL) { if (clock_gettime(CLOCK_MONOTONIC, &event->when) != 0) {
if (clock_gettime(CLOCK_MONOTONIC, &now) != 0) {
wlr_log_errno(WLR_ERROR, "failed to send output present event: " wlr_log_errno(WLR_ERROR, "failed to send output present event: "
"failed to read clock"); "failed to read clock");
return; return;
} }
event->when = &now;
} }
wl_signal_emit_mutable(&output->events.present, event); wl_signal_emit_mutable(&output->events.present, event);

@ -239,8 +239,8 @@ void wlr_presentation_event_from_output(struct wlr_presentation_event *event,
const struct wlr_output_event_present *output_event) { const struct wlr_output_event_present *output_event) {
*event = (struct wlr_presentation_event){ *event = (struct wlr_presentation_event){
.output = output_event->output, .output = output_event->output,
.tv_sec = (uint64_t)output_event->when->tv_sec, .tv_sec = (uint64_t)output_event->when.tv_sec,
.tv_nsec = (uint32_t)output_event->when->tv_nsec, .tv_nsec = (uint32_t)output_event->when.tv_nsec,
.refresh = (uint32_t)output_event->refresh, .refresh = (uint32_t)output_event->refresh,
.seq = (uint64_t)output_event->seq, .seq = (uint64_t)output_event->seq,
.flags = output_event->flags, .flags = output_event->flags,

Loading…
Cancel
Save