output: take wl_event_loop in wlr_output_init()

We don't need the whole wl_display here anymore. The wl_event_loop
is enough.
This commit is contained in:
Simon Ser 2023-08-12 08:37:08 +02:00 committed by Isaac Freund
parent d23d8ed3ba
commit d61ec694b3
8 changed files with 17 additions and 18 deletions

View File

@ -1467,7 +1467,7 @@ static bool connect_drm_connector(struct wlr_drm_connector *wlr_conn,
free(current_modeinfo);
wlr_output_init(output, &drm->backend, &output_impl, drm->display, &state);
wlr_output_init(output, &drm->backend, &output_impl, wl_display_get_event_loop(drm->display), &state);
wlr_output_state_finish(&state);
// fill out the modes

View File

@ -119,7 +119,8 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend,
wlr_output_state_init(&state);
wlr_output_state_set_custom_mode(&state, width, height, 0);
wlr_output_init(wlr_output, &backend->backend, &output_impl, backend->display, &state);
wlr_output_init(wlr_output, &backend->backend, &output_impl,
wl_display_get_event_loop(backend->display), &state);
wlr_output_state_finish(&state);
output_update_refresh(output, 0);

View File

@ -775,7 +775,7 @@ static struct wlr_wl_output *output_create(struct wlr_wl_backend *backend,
wlr_output_state_set_custom_mode(&state, 1280, 720, 0);
wlr_output_init(wlr_output, &backend->backend, &output_impl,
backend->local_display, &state);
wl_display_get_event_loop(backend->local_display), &state);
wlr_output_state_finish(&state);
wlr_output->adaptive_sync_status = WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;

View File

@ -549,7 +549,8 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
wlr_output_state_init(&state);
wlr_output_state_set_custom_mode(&state, 1024, 768, 0);
wlr_output_init(wlr_output, &x11->backend, &output_impl, x11->wl_display, &state);
wlr_output_init(wlr_output, &x11->backend, &output_impl,
wl_display_get_event_loop(x11->wl_display), &state);
wlr_output_state_finish(&state);
size_t output_num = ++last_output_num;

View File

@ -101,7 +101,7 @@ struct wlr_output_impl {
* Initialize a new output.
*/
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
const struct wlr_output_impl *impl, struct wl_display *display,
const struct wlr_output_impl *impl, struct wl_event_loop *event_loop,
const struct wlr_output_state *state);
/**
* Notify compositors that they need to submit a new frame in order to apply

View File

@ -127,7 +127,7 @@ struct wlr_render_pass;
struct wlr_output {
const struct wlr_output_impl *impl;
struct wlr_backend *backend;
struct wl_display *display;
struct wl_event_loop *event_loop;
struct wl_global *global;
struct wl_list resources;

View File

@ -185,9 +185,8 @@ void wlr_output_schedule_done(struct wlr_output *output) {
return; // Already scheduled
}
struct wl_event_loop *ev = wl_display_get_event_loop(output->display);
output->idle_done =
wl_event_loop_add_idle(ev, schedule_done_handle_idle_timer, output);
output->idle_done = wl_event_loop_add_idle(output->event_loop,
schedule_done_handle_idle_timer, output);
}
struct wlr_output *wlr_output_from_resource(struct wl_resource *resource) {
@ -405,7 +404,7 @@ static void output_apply_state(struct wlr_output *output,
}
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
const struct wlr_output_impl *impl, struct wl_display *display,
const struct wlr_output_impl *impl, struct wl_event_loop *event_loop,
const struct wlr_output_state *state) {
assert(impl->commit);
if (impl->set_cursor || impl->move_cursor) {
@ -415,7 +414,7 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
*output = (struct wlr_output){
.backend = backend,
.impl = impl,
.display = display,
.event_loop = event_loop,
.render_format = DRM_FORMAT_XRGB8888,
.transform = WL_OUTPUT_TRANSFORM_NORMAL,
.scale = 1,
@ -907,9 +906,8 @@ void wlr_output_schedule_frame(struct wlr_output *output) {
// We're using an idle timer here in case a buffer swap happens right after
// this function is called
struct wl_event_loop *ev = wl_display_get_event_loop(output->display);
output->idle_frame =
wl_event_loop_add_idle(ev, schedule_frame_handle_idle_timer, output);
output->idle_frame = wl_event_loop_add_idle(output->event_loop,
schedule_frame_handle_idle_timer, output);
}
void wlr_output_send_present(struct wlr_output *output,
@ -966,8 +964,8 @@ void output_defer_present(struct wlr_output *output, struct wlr_output_event_pre
deferred->output_destroy.notify = deferred_present_event_handle_output_destroy;
wl_signal_add(&output->events.destroy, &deferred->output_destroy);
struct wl_event_loop *ev = wl_display_get_event_loop(output->display);
deferred->idle_source = wl_event_loop_add_idle(ev, deferred_present_event_handle_idle, deferred);
deferred->idle_source = wl_event_loop_add_idle(output->event_loop,
deferred_present_event_handle_idle, deferred);
}
void wlr_output_send_request_state(struct wlr_output *output,

View File

@ -473,8 +473,7 @@ static void output_cursor_set_xcursor_image(struct wlr_cursor_output_cursor *out
}
if (output_cursor->xcursor_timer == NULL) {
struct wl_event_loop *event_loop =
wl_display_get_event_loop(output_cursor->output_cursor->output->display);
struct wl_event_loop *event_loop = output_cursor->output_cursor->output->event_loop;
output_cursor->xcursor_timer =
wl_event_loop_add_timer(event_loop, handle_xcursor_timer, output_cursor);
if (output_cursor->xcursor_timer == NULL) {