From 70e8277175fc756b635650c1bbad295592b5ed94 Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Fri, 22 Oct 2021 16:14:37 -0400 Subject: backend/multi: implement get_buffer_caps --- backend/multi/backend.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'backend') diff --git a/backend/multi/backend.c b/backend/multi/backend.c index 7c74959e..ffe79476 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -5,7 +5,9 @@ #include #include #include +#include #include +#include "backend/backend.h" #include "backend/multi.h" #include "util/signal.h" @@ -109,6 +111,28 @@ static int multi_backend_get_drm_fd(struct wlr_backend *backend) { return -1; } +static uint32_t multi_backend_get_buffer_caps(struct wlr_backend *backend) { + struct wlr_multi_backend *multi = multi_backend_from_backend(backend); + + if (wl_list_empty(&multi->backends)) { + return 0; + } + + uint32_t caps = WLR_BUFFER_CAP_DATA_PTR | WLR_BUFFER_CAP_DMABUF + | WLR_BUFFER_CAP_SHM; + + struct subbackend_state *sub; + wl_list_for_each(sub, &multi->backends, link) { + uint32_t backend_caps = backend_get_buffer_caps(sub->backend); + if (backend_caps != 0) { + // only count backend capable of presenting a buffer + caps = caps & backend_caps; + } + } + + return caps; +} + static const struct wlr_backend_impl backend_impl = { .start = multi_backend_start, .destroy = multi_backend_destroy, @@ -116,6 +140,7 @@ static const struct wlr_backend_impl backend_impl = { .get_session = multi_backend_get_session, .get_presentation_clock = multi_backend_get_presentation_clock, .get_drm_fd = multi_backend_get_drm_fd, + .get_buffer_caps = multi_backend_get_buffer_caps, }; static void handle_display_destroy(struct wl_listener *listener, void *data) { -- cgit v1.2.3