aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-12-14 23:59:04 +0100
committeremersion <contact@emersion.fr>2017-12-14 23:59:04 +0100
commit6b42bfad18f7bcb08ef031c699159d40ff6ac2a0 (patch)
treec8c24d5cf48c8a7487499d37da92e1bf7da419b9 /backend/drm
parentb884025558e750268a06818dc63bc46716c75843 (diff)
parent23fb663ea4eaff436d9bfab7f74cdd298fac44c5 (diff)
Merge branch 'master' into xwm-selection
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/backend.c19
-rw-r--r--backend/drm/drm.c5
-rw-r--r--backend/drm/renderer.c4
3 files changed, 21 insertions, 7 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index 87a4f708..6be5e5d5 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -34,6 +34,10 @@ static void wlr_drm_backend_destroy(struct wlr_backend *backend) {
wlr_output_destroy(&conn->output);
}
+ wl_list_remove(&drm->display_destroy.link);
+ wl_list_remove(&drm->session_signal.link);
+ wl_list_remove(&drm->drm_invalidated.link);
+
wlr_drm_resources_free(drm);
wlr_drm_renderer_finish(&drm->renderer);
wlr_session_close_file(drm->session, drm->fd);
@@ -57,7 +61,8 @@ bool wlr_backend_is_drm(struct wlr_backend *b) {
}
static void session_signal(struct wl_listener *listener, void *data) {
- struct wlr_drm_backend *drm = wl_container_of(listener, drm, session_signal);
+ struct wlr_drm_backend *drm =
+ wl_container_of(listener, drm, session_signal);
struct wlr_session *session = data;
if (session->active) {
@@ -84,7 +89,8 @@ static void session_signal(struct wl_listener *listener, void *data) {
}
static void drm_invalidated(struct wl_listener *listener, void *data) {
- struct wlr_drm_backend *drm = wl_container_of(listener, drm, drm_invalidated);
+ struct wlr_drm_backend *drm =
+ wl_container_of(listener, drm, drm_invalidated);
char *name = drmGetDeviceNameFromFd2(drm->fd);
wlr_log(L_DEBUG, "%s invalidated", name);
@@ -93,6 +99,12 @@ static void drm_invalidated(struct wl_listener *listener, void *data) {
wlr_drm_scan_connectors(drm);
}
+static void handle_display_destroy(struct wl_listener *listener, void *data) {
+ struct wlr_drm_backend *drm =
+ wl_container_of(listener, drm, display_destroy);
+ wlr_drm_backend_destroy(&drm->backend);
+}
+
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
struct wlr_session *session, int gpu_fd, struct wlr_backend *parent) {
assert(display && session && gpu_fd >= 0);
@@ -150,6 +162,9 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
wlr_log(L_INFO, "Failed to bind egl/wl display: %s", egl_error());
}
+ drm->display_destroy.notify = handle_display_destroy;
+ wl_display_add_destroy_listener(display, &drm->display_destroy);
+
return &drm->backend;
error_event:
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index ba203791..96b7d93d 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -565,8 +565,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
enum wl_output_transform transform =
wlr_output_transform_invert(output->transform);
struct wlr_box transformed_hotspot;
- wlr_output_transform_apply_to_box(transform, &hotspot,
- &transformed_hotspot);
+ wlr_box_transform(&hotspot, transform, &transformed_hotspot);
plane->cursor_hotspot_x = transformed_hotspot.x;
plane->cursor_hotspot_y = transformed_hotspot.y;
@@ -628,7 +627,7 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output,
enum wl_output_transform transform =
wlr_output_transform_invert(output->transform);
struct wlr_box transformed_box;
- wlr_output_transform_apply_to_box(transform, &box, &transformed_box);
+ wlr_box_transform(&box, transform, &transformed_box);
if (plane != NULL) {
transformed_box.x -= plane->cursor_hotspot_x;
diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c
index 87064914..8a8d7d1f 100644
--- a/backend/drm/renderer.c
+++ b/backend/drm/renderer.c
@@ -39,7 +39,7 @@ bool wlr_drm_renderer_init(struct wlr_drm_backend *drm,
return true;
error_egl:
- wlr_egl_free(&renderer->egl);
+ wlr_egl_finish(&renderer->egl);
error_gbm:
gbm_device_destroy(renderer->gbm);
return false;
@@ -51,7 +51,7 @@ void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer) {
}
wlr_renderer_destroy(renderer->wlr_rend);
- wlr_egl_free(&renderer->egl);
+ wlr_egl_finish(&renderer->egl);
gbm_device_destroy(renderer->gbm);
}