From ad3a455db95e2c5c1823b98e0019a0000f6287fe Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 1 Dec 2020 16:05:23 +0100 Subject: [PATCH] backend/multi: implement get_drm_fd Just like get_renderer, iterate over all sub-backends until we find one that implements get_drm_fd. --- backend/multi/backend.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backend/multi/backend.c b/backend/multi/backend.c index 6289f107..ddefc0ce 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -6,6 +6,7 @@ #include #include #include +#include "backend/backend.h" #include "backend/multi.h" #include "util/signal.h" @@ -96,12 +97,26 @@ static clockid_t multi_backend_get_presentation_clock( return CLOCK_MONOTONIC; } +static int multi_backend_get_drm_fd(struct wlr_backend *backend) { + struct wlr_multi_backend *multi = multi_backend_from_backend(backend); + + struct subbackend_state *sub; + wl_list_for_each(sub, &multi->backends, link) { + if (sub->backend->impl->get_drm_fd) { + return backend_get_drm_fd(sub->backend); + } + } + + return -1; +} + struct wlr_backend_impl backend_impl = { .start = multi_backend_start, .destroy = multi_backend_destroy, .get_renderer = multi_backend_get_renderer, .get_session = multi_backend_get_session, .get_presentation_clock = multi_backend_get_presentation_clock, + .get_drm_fd = multi_backend_get_drm_fd, }; static void handle_display_destroy(struct wl_listener *listener, void *data) {