diff options
Diffstat (limited to 'backend/drm/backend.c')
-rw-r--r-- | backend/drm/backend.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index cee3cfa5..c9ffdcbe 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -53,8 +53,13 @@ static void backend_destroy(struct wlr_backend *backend) { wl_list_remove(&drm->dev_change.link); wl_list_remove(&drm->dev_remove.link); + gbm_device_destroy(drm->gbm); + + if (drm->parent) { + finish_drm_renderer(&drm->mgpu_renderer); + } + finish_drm_resources(drm); - finish_drm_renderer(&drm->renderer); free(drm->name); wlr_session_close_file(drm->session, drm->dev); @@ -219,8 +224,9 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, goto error_event; } - if (!init_drm_renderer(drm, &drm->renderer)) { - wlr_log(WLR_ERROR, "Failed to initialize renderer"); + drm->gbm = gbm_create_device(drm->fd); + if (!drm->gbm) { + wlr_log(WLR_ERROR, "Failed to create GBM device"); goto error_event; } @@ -229,9 +235,14 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, drm->backend.renderer = wlr_backend_get_renderer(&drm->parent->backend); assert(drm->backend.renderer != NULL); + if (!init_drm_renderer(drm, &drm->mgpu_renderer)) { + wlr_log(WLR_ERROR, "Failed to initialize renderer"); + goto error_event; + } + // We'll perform a multi-GPU copy for all submitted buffers, we need // to be able to texture from them - struct wlr_renderer *renderer = drm->renderer.wlr_rend; + struct wlr_renderer *renderer = drm->mgpu_renderer.wlr_rend; const struct wlr_drm_format_set *texture_formats = wlr_renderer_get_dmabuf_texture_formats(renderer); if (texture_formats == NULL) { |