backend/drm: return secondary backend DRM FD

It can be useful for compositors to get the real DRM FD instead of
the one from the parent compositor. For instance, some compositors
might want to perform some DRM IOCTLs there to check the driver
name, fetch some DRM resources, etc. This will also be a requirement
for direct scanout on secondary GPUs.
This commit is contained in:
Simon Ser 2023-12-11 17:51:36 +01:00 committed by Simon Zeni
parent 3475b1880f
commit d8c0707e27

View File

@ -73,12 +73,7 @@ static void backend_destroy(struct wlr_backend *backend) {
static int backend_get_drm_fd(struct wlr_backend *backend) { static int backend_get_drm_fd(struct wlr_backend *backend) {
struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend); struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend);
return drm->fd;
if (drm->parent) {
return drm->parent->fd;
} else {
return drm->fd;
}
} }
static uint32_t drm_backend_get_buffer_caps(struct wlr_backend *backend) { static uint32_t drm_backend_get_buffer_caps(struct wlr_backend *backend) {