mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-18 06:47:31 -04:00
output: Nuke wlr_output->events.present
This commit is contained in:
parent
20050bddbc
commit
544e678be0
9 changed files with 12 additions and 52 deletions
|
|
@ -1718,14 +1718,12 @@ static void handle_page_flip(int fd, unsigned seq,
|
||||||
/* 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. */
|
||||||
.output = &conn->output,
|
.output = &conn->output,
|
||||||
.commit_seq = conn->output.commit_seq,
|
|
||||||
.presented = drm->session->active,
|
.presented = drm->session->active,
|
||||||
.when = &present_time,
|
.when = &present_time,
|
||||||
.seq = seq,
|
.seq = seq,
|
||||||
.refresh = mhz_to_nsec(conn->output.refresh),
|
.refresh = mhz_to_nsec(conn->output.refresh),
|
||||||
.flags = present_flags,
|
.flags = present_flags,
|
||||||
};
|
};
|
||||||
wlr_output_send_present(&conn->output, &present_event);
|
|
||||||
wl_signal_emit_mutable(&conn->commit.events.present, &present_event);
|
wl_signal_emit_mutable(&conn->commit.events.present, &present_event);
|
||||||
|
|
||||||
if (drm->session->active) {
|
if (drm->session->active) {
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,6 @@ static void presentation_feedback_handle_presented(void *data,
|
||||||
.tv_nsec = tv_nsec,
|
.tv_nsec = tv_nsec,
|
||||||
};
|
};
|
||||||
struct wlr_output_event_present event = {
|
struct wlr_output_event_present event = {
|
||||||
.commit_seq = feedback->commit_seq,
|
|
||||||
.presented = true,
|
.presented = true,
|
||||||
.output = &feedback->output->wlr_output,
|
.output = &feedback->output->wlr_output,
|
||||||
.when = &t,
|
.when = &t,
|
||||||
|
|
@ -111,7 +110,6 @@ static void presentation_feedback_handle_presented(void *data,
|
||||||
.refresh = refresh_ns,
|
.refresh = refresh_ns,
|
||||||
.flags = flags,
|
.flags = flags,
|
||||||
};
|
};
|
||||||
wlr_output_send_present(&feedback->output->wlr_output, &event);
|
|
||||||
wl_signal_emit_mutable(&feedback->commit.events.present, &event);
|
wl_signal_emit_mutable(&feedback->commit.events.present, &event);
|
||||||
|
|
||||||
presentation_feedback_destroy(feedback);
|
presentation_feedback_destroy(feedback);
|
||||||
|
|
@ -122,11 +120,9 @@ static void presentation_feedback_handle_discarded(void *data,
|
||||||
struct wlr_wl_presentation_feedback *feedback = data;
|
struct wlr_wl_presentation_feedback *feedback = data;
|
||||||
|
|
||||||
struct wlr_output_event_present event = {
|
struct wlr_output_event_present event = {
|
||||||
.commit_seq = feedback->commit_seq,
|
|
||||||
.presented = false,
|
.presented = false,
|
||||||
.output = &feedback->output->wlr_output,
|
.output = &feedback->output->wlr_output,
|
||||||
};
|
};
|
||||||
wlr_output_send_present(&feedback->output->wlr_output, &event);
|
|
||||||
wl_signal_emit_mutable(&feedback->commit.events.present, &event);
|
wl_signal_emit_mutable(&feedback->commit.events.present, &event);
|
||||||
|
|
||||||
presentation_feedback_destroy(feedback);
|
presentation_feedback_destroy(feedback);
|
||||||
|
|
@ -588,7 +584,6 @@ static struct wlr_output_commit *output_commit(struct wlr_output *wlr_output,
|
||||||
}
|
}
|
||||||
feedback->output = output;
|
feedback->output = output;
|
||||||
feedback->feedback = wp_feedback;
|
feedback->feedback = wp_feedback;
|
||||||
feedback->commit_seq = output->wlr_output.commit_seq + 1;
|
|
||||||
wl_list_insert(&output->presentation_feedbacks, &feedback->link);
|
wl_list_insert(&output->presentation_feedbacks, &feedback->link);
|
||||||
|
|
||||||
wp_presentation_feedback_add_listener(wp_feedback,
|
wp_presentation_feedback_add_listener(wp_feedback,
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,7 @@ static struct wlr_output_commit *output_commit(struct wlr_output *wlr_output,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t serial = output->wlr_output.commit_seq;
|
uint32_t serial = output->serial++;
|
||||||
|
|
||||||
wlr_output_commit_init(&commit->commit, wlr_output);
|
wlr_output_commit_init(&commit->commit, wlr_output);
|
||||||
wl_list_insert(&output->commits, &commit->link);
|
wl_list_insert(&output->commits, &commit->link);
|
||||||
|
|
@ -754,13 +754,11 @@ void handle_x11_present_event(struct wlr_x11_backend *x11,
|
||||||
bool presented = complete_notify->mode != XCB_PRESENT_COMPLETE_MODE_SKIP;
|
bool presented = complete_notify->mode != XCB_PRESENT_COMPLETE_MODE_SKIP;
|
||||||
struct wlr_output_event_present present_event = {
|
struct wlr_output_event_present present_event = {
|
||||||
.output = &output->wlr_output,
|
.output = &output->wlr_output,
|
||||||
.commit_seq = complete_notify->serial,
|
|
||||||
.presented = presented,
|
.presented = presented,
|
||||||
.when = &t,
|
.when = &t,
|
||||||
.seq = complete_notify->msc,
|
.seq = complete_notify->msc,
|
||||||
.flags = flags,
|
.flags = flags,
|
||||||
};
|
};
|
||||||
wlr_output_send_present(&output->wlr_output, &present_event);
|
|
||||||
wl_signal_emit_mutable(&commit->commit.events.present, &present_event);
|
wl_signal_emit_mutable(&commit->commit.events.present, &present_event);
|
||||||
|
|
||||||
wl_list_remove(&commit->link);
|
wl_list_remove(&commit->link);
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ struct wlr_wl_presentation_feedback {
|
||||||
struct wlr_wl_output *output;
|
struct wlr_wl_output *output;
|
||||||
struct wl_list link; // wlr_wl_output.presentation_feedbacks
|
struct wl_list link; // wlr_wl_output.presentation_feedbacks
|
||||||
struct wp_presentation_feedback *feedback;
|
struct wp_presentation_feedback *feedback;
|
||||||
uint32_t commit_seq;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_wl_output_layer {
|
struct wlr_wl_output_layer {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ struct wlr_x11_output {
|
||||||
struct wlr_output wlr_output;
|
struct wlr_output wlr_output;
|
||||||
struct wlr_x11_backend *x11;
|
struct wlr_x11_backend *x11;
|
||||||
struct wl_list link; // wlr_x11_backend.outputs
|
struct wl_list link; // wlr_x11_backend.outputs
|
||||||
|
uint32_t serial;
|
||||||
|
|
||||||
xcb_window_t win;
|
xcb_window_t win;
|
||||||
xcb_present_event_t present_event_id;
|
xcb_present_event_t present_event_id;
|
||||||
|
|
|
||||||
|
|
@ -115,13 +115,6 @@ void wlr_output_update_needs_frame(struct wlr_output *output);
|
||||||
* See wlr_output.events.frame.
|
* See wlr_output.events.frame.
|
||||||
*/
|
*/
|
||||||
void wlr_output_send_frame(struct wlr_output *output);
|
void wlr_output_send_frame(struct wlr_output *output);
|
||||||
/**
|
|
||||||
* Send a present event.
|
|
||||||
*
|
|
||||||
* See wlr_output.events.present.
|
|
||||||
*/
|
|
||||||
void wlr_output_send_present(struct wlr_output *output,
|
|
||||||
struct wlr_output_event_present *event);
|
|
||||||
/**
|
/**
|
||||||
* Request the compositor to apply new state.
|
* Request the compositor to apply new state.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -160,9 +160,6 @@ struct wlr_output {
|
||||||
|
|
||||||
struct wlr_output_state pending;
|
struct wlr_output_state pending;
|
||||||
|
|
||||||
// Commit sequence number. Incremented on each commit, may overflow.
|
|
||||||
uint32_t commit_seq;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
// Request to render a frame
|
// Request to render a frame
|
||||||
struct wl_signal frame;
|
struct wl_signal frame;
|
||||||
|
|
@ -176,9 +173,6 @@ struct wlr_output {
|
||||||
struct wl_signal precommit; // struct wlr_output_event_precommit
|
struct wl_signal precommit; // struct wlr_output_event_precommit
|
||||||
// Emitted right after commit
|
// Emitted right after commit
|
||||||
struct wl_signal commit; // struct wlr_output_event_commit
|
struct wl_signal commit; // struct wlr_output_event_commit
|
||||||
// Emitted right after a commit has been presented to the user for
|
|
||||||
// enabled outputs
|
|
||||||
struct wl_signal present; // struct wlr_output_event_present
|
|
||||||
// Emitted after a client bound the wl_output global
|
// Emitted after a client bound the wl_output global
|
||||||
struct wl_signal bind; // struct wlr_output_event_bind
|
struct wl_signal bind; // struct wlr_output_event_bind
|
||||||
struct wl_signal description;
|
struct wl_signal description;
|
||||||
|
|
@ -209,6 +203,11 @@ struct wlr_output {
|
||||||
struct wlr_addon_set addons;
|
struct wlr_addon_set addons;
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
// private state
|
||||||
|
|
||||||
|
// used for when to create a new back buffer
|
||||||
|
bool not_committed;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_output_event_damage {
|
struct wlr_output_event_damage {
|
||||||
|
|
@ -246,9 +245,6 @@ enum wlr_output_present_flag {
|
||||||
|
|
||||||
struct wlr_output_event_present {
|
struct wlr_output_event_present {
|
||||||
struct wlr_output *output;
|
struct wlr_output *output;
|
||||||
// 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.
|
// 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.
|
||||||
|
|
|
||||||
|
|
@ -411,7 +411,6 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
||||||
.render_format = DRM_FORMAT_XRGB8888,
|
.render_format = DRM_FORMAT_XRGB8888,
|
||||||
.transform = WL_OUTPUT_TRANSFORM_NORMAL,
|
.transform = WL_OUTPUT_TRANSFORM_NORMAL,
|
||||||
.scale = 1,
|
.scale = 1,
|
||||||
.commit_seq = 0,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
wl_list_init(&output->modes);
|
wl_list_init(&output->modes);
|
||||||
|
|
@ -423,7 +422,6 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
||||||
wl_signal_init(&output->events.needs_frame);
|
wl_signal_init(&output->events.needs_frame);
|
||||||
wl_signal_init(&output->events.precommit);
|
wl_signal_init(&output->events.precommit);
|
||||||
wl_signal_init(&output->events.commit);
|
wl_signal_init(&output->events.commit);
|
||||||
wl_signal_init(&output->events.present);
|
|
||||||
wl_signal_init(&output->events.bind);
|
wl_signal_init(&output->events.bind);
|
||||||
wl_signal_init(&output->events.description);
|
wl_signal_init(&output->events.description);
|
||||||
wl_signal_init(&output->events.request_state);
|
wl_signal_init(&output->events.request_state);
|
||||||
|
|
@ -440,6 +438,8 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
||||||
output->display_destroy.notify = handle_display_destroy;
|
output->display_destroy.notify = handle_display_destroy;
|
||||||
wl_display_add_destroy_listener(display, &output->display_destroy);
|
wl_display_add_destroy_listener(display, &output->display_destroy);
|
||||||
|
|
||||||
|
output->not_committed = true;
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
output_apply_state(output, state);
|
output_apply_state(output, state);
|
||||||
}
|
}
|
||||||
|
|
@ -829,8 +829,6 @@ bool wlr_output_commit_state(struct wlr_output *output,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
output->commit_seq++;
|
|
||||||
|
|
||||||
if (output_pending_enabled(output, state)) {
|
if (output_pending_enabled(output, state)) {
|
||||||
output->frame_pending = true;
|
output->frame_pending = true;
|
||||||
output->needs_frame = false;
|
output->needs_frame = false;
|
||||||
|
|
@ -851,6 +849,8 @@ bool wlr_output_commit_state(struct wlr_output *output,
|
||||||
wlr_buffer_unlock(pending.buffer);
|
wlr_buffer_unlock(pending.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output->not_committed = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -915,26 +915,6 @@ void wlr_output_schedule_frame(struct wlr_output *output) {
|
||||||
wl_event_loop_add_idle(ev, schedule_frame_handle_idle_timer, output);
|
wl_event_loop_add_idle(ev, schedule_frame_handle_idle_timer, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_send_present(struct wlr_output *output,
|
|
||||||
struct wlr_output_event_present *event) {
|
|
||||||
assert(event);
|
|
||||||
event->output = output;
|
|
||||||
|
|
||||||
struct timespec now;
|
|
||||||
if (event->presented && event->when == NULL) {
|
|
||||||
clockid_t clock = wlr_backend_get_presentation_clock(output->backend);
|
|
||||||
errno = 0;
|
|
||||||
if (clock_gettime(clock, &now) != 0) {
|
|
||||||
wlr_log_errno(WLR_ERROR, "failed to send output present event: "
|
|
||||||
"failed to read clock");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event->when = &now;
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_signal_emit_mutable(&output->events.present, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct deferred_present_event {
|
struct deferred_present_event {
|
||||||
struct wlr_output_commit *commit;
|
struct wlr_output_commit *commit;
|
||||||
struct wl_event_source *idle_source;
|
struct wl_event_source *idle_source;
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ bool output_ensure_buffer(struct wlr_output *output,
|
||||||
if (state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
if (state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||||
needs_new_buffer = true;
|
needs_new_buffer = true;
|
||||||
}
|
}
|
||||||
if (state->allow_artifacts && output->commit_seq == 0 && enabled) {
|
if (state->allow_artifacts && output->not_committed && enabled) {
|
||||||
// On first commit, require a new buffer if the compositor called a
|
// On first commit, require a new buffer if the compositor called a
|
||||||
// mode-setting function, even if the mode won't change. This makes it
|
// mode-setting function, even if the mode won't change. This makes it
|
||||||
// so the swapchain is created now.
|
// so the swapchain is created now.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue