aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-11-23 14:08:46 +0100
committerKirill Primak <vyivel@eclair.cafe>2024-01-25 15:05:36 +0000
commit54f9944b4885e4a08c0f004136ef06f732b8308f (patch)
tree96bed8d580f996fb60d61e82f606cb1b263ef344 /backend/drm
parentb62ac611c8825f83c992843e3832474eaa2e4b72 (diff)
backend/drm: drop wl_display argument
We can grab the event loop from the wlr_session instead.
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/backend.c22
-rw-r--r--backend/drm/drm.c2
-rw-r--r--backend/drm/monitor.c6
3 files changed, 7 insertions, 23 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index 655a1856..b65dc10d 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -47,7 +47,6 @@ static void backend_destroy(struct wlr_backend *backend) {
wlr_backend_finish(backend);
- wl_list_remove(&drm->display_destroy.link);
wl_list_remove(&drm->session_destroy.link);
wl_list_remove(&drm->session_active.link);
wl_list_remove(&drm->parent_destroy.link);
@@ -180,22 +179,15 @@ static void handle_session_destroy(struct wl_listener *listener, void *data) {
backend_destroy(&drm->backend);
}
-static void handle_display_destroy(struct wl_listener *listener, void *data) {
- struct wlr_drm_backend *drm =
- wl_container_of(listener, drm, display_destroy);
- backend_destroy(&drm->backend);
-}
-
static void handle_parent_destroy(struct wl_listener *listener, void *data) {
struct wlr_drm_backend *drm =
wl_container_of(listener, drm, parent_destroy);
backend_destroy(&drm->backend);
}
-struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
- struct wlr_session *session, struct wlr_device *dev,
- struct wlr_backend *parent) {
- assert(display && session && dev);
+struct wlr_backend *wlr_drm_backend_create(struct wlr_session *session,
+ struct wlr_device *dev, struct wlr_backend *parent) {
+ assert(session && dev);
assert(!parent || wlr_backend_is_drm(parent));
char *name = drmGetDeviceNameFromFd2(dev->fd);
@@ -234,10 +226,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
drm->dev_remove.notify = handle_dev_remove;
wl_signal_add(&dev->events.remove, &drm->dev_remove);
- drm->display = display;
-
- struct wl_event_loop *event_loop = wl_display_get_event_loop(display);
- drm->drm_event = wl_event_loop_add_fd(event_loop, drm->fd,
+ drm->drm_event = wl_event_loop_add_fd(session->event_loop, drm->fd,
WL_EVENT_READABLE, handle_drm_event, drm);
if (!drm->drm_event) {
wlr_log(WLR_ERROR, "Failed to create DRM event source");
@@ -288,9 +277,6 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
drm->session_destroy.notify = handle_session_destroy;
wl_signal_add(&session->events.destroy, &drm->session_destroy);
- drm->display_destroy.notify = handle_display_destroy;
- wl_display_add_destroy_listener(display, &drm->display_destroy);
-
return &drm->backend;
error_mgpu_renderer:
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index e62dd638..5ad84235 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -1483,7 +1483,7 @@ static bool connect_drm_connector(struct wlr_drm_connector *wlr_conn,
free(current_modeinfo);
- wlr_output_init(output, &drm->backend, &output_impl, wl_display_get_event_loop(drm->display), &state);
+ wlr_output_init(output, &drm->backend, &output_impl, drm->session->event_loop, &state);
wlr_output_state_finish(&state);
// fill out the modes
diff --git a/backend/drm/monitor.c b/backend/drm/monitor.c
index 939a00ff..efd85374 100644
--- a/backend/drm/monitor.c
+++ b/backend/drm/monitor.c
@@ -25,8 +25,7 @@ static void handle_add_drm_card(struct wl_listener *listener, void *data) {
}
wlr_log(WLR_DEBUG, "Creating DRM backend for %s after hotplug", event->path);
- struct wlr_backend *child_drm = wlr_drm_backend_create(
- backend_monitor->display, backend_monitor->session,
+ struct wlr_backend *child_drm = wlr_drm_backend_create(backend_monitor->session,
dev, backend_monitor->primary_drm);
if (!child_drm) {
wlr_log(WLR_ERROR, "Failed to create DRM backend after hotplug");
@@ -65,7 +64,7 @@ static void handle_multi_destroy(struct wl_listener *listener, void *data) {
struct wlr_drm_backend_monitor *drm_backend_monitor_create(
struct wlr_backend *multi, struct wlr_backend *primary_drm,
- struct wlr_session *session, struct wl_display *display) {
+ struct wlr_session *session) {
struct wlr_drm_backend_monitor *monitor = calloc(1, sizeof(*monitor));
if (!monitor) {
wlr_log_errno(WLR_ERROR, "Allocation failed");
@@ -75,7 +74,6 @@ struct wlr_drm_backend_monitor *drm_backend_monitor_create(
monitor->multi = multi;
monitor->primary_drm = primary_drm;
monitor->session = session;
- monitor->display = display;
monitor->session_add_drm_card.notify = handle_add_drm_card;
wl_signal_add(&session->events.add_drm_card, &monitor->session_add_drm_card);