From e7f68ba0811f975faa8ce06d3caf4d2e5cb87be5 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 29 Apr 2021 09:49:24 +0200 Subject: [PATCH] backend/drm: fix allocator DRM FD on multi-GPU setups On multi-GPU setups, there is a primary DRM backend and secondary DRM backends. wlr_backend_get_drm_fd will always return the parent DRM FD even on secondary backends, so that users always use the primary device for rendering. However, for our internal rendering we want to use the secondary device. Use allocator_autocreate_with_drm_fd to make sure the allocator will create buffers on the secondary device. We do something similar to ensure our internal rendering will happen on the secondary device with renderer_autocreate_with_drm_fd. Fixes: cc1b66364cc9 ("backend: use wlr_allocator_autocreate") --- backend/drm/renderer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index c19df83b..818f0521 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -35,8 +35,8 @@ bool init_drm_renderer(struct wlr_drm_backend *drm, goto error_gbm; } - renderer->allocator = wlr_allocator_autocreate(&drm->backend, - renderer->wlr_rend); + renderer->allocator = allocator_autocreate_with_drm_fd(&drm->backend, + renderer->wlr_rend, drm->fd); if (renderer->allocator == NULL) { wlr_log(WLR_ERROR, "Failed to create allocator"); goto error_wlr_rend;