diff options
author | Simon Ser <contact@emersion.fr> | 2020-12-17 20:48:47 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-12-17 20:48:47 +0100 |
commit | 9cd3f03f652fc7ee905001e09dafa40b72e1317d (patch) | |
tree | c7a152c15d038de7d3795c2b51fb9bca07e54ec1 /backend/drm | |
parent | 60001a75a276f931b02d78a95cedfd0098b88617 (diff) |
backend/drm: add wlr_drm_backend.name
Save the DRM device name in a wlr_drm_backend field, so that we can
easily use it for logging purposes.
Diffstat (limited to 'backend/drm')
-rw-r--r-- | backend/drm/backend.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index b2da7cb3..44794b51 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -50,6 +50,8 @@ static void backend_destroy(struct wlr_backend *backend) { finish_drm_resources(drm); finish_drm_renderer(&drm->renderer); + + free(drm->name); wlr_session_close_file(drm->session, drm->dev); wl_event_source_remove(drm->drm_event); free(drm); @@ -108,9 +110,7 @@ static void drm_invalidated(struct wl_listener *listener, void *data) { struct wlr_drm_backend *drm = wl_container_of(listener, drm, drm_invalidated); - char *name = drmGetDeviceNameFromFd2(drm->fd); - wlr_log(WLR_DEBUG, "%s invalidated", name); - free(name); + wlr_log(WLR_DEBUG, "%s invalidated", drm->name); scan_drm_connectors(drm); } @@ -137,7 +137,6 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, char *name = drmGetDeviceNameFromFd2(dev->fd); drmVersion *version = drmGetVersion(dev->fd); wlr_log(WLR_INFO, "Initializing DRM backend for %s (%s)", name, version->name); - free(name); drmFreeVersion(version); struct wlr_drm_backend *drm = calloc(1, sizeof(struct wlr_drm_backend)); @@ -152,6 +151,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, drm->dev = dev; drm->fd = dev->fd; + drm->name = name; if (parent != NULL) { drm->parent = get_drm_backend_from_backend(parent); } |