diff options
author | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-10-22 16:14:37 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-10-22 22:19:47 +0200 |
commit | 70e8277175fc756b635650c1bbad295592b5ed94 (patch) | |
tree | 58e3e69d1cc7a28226d2fb3376940a2d94a4643f /backend | |
parent | 7c10a77e0a6360d559e8c9b4ba5df0d72f0b2b3f (diff) |
backend/multi: implement get_buffer_caps
Diffstat (limited to 'backend')
-rw-r--r-- | backend/multi/backend.c | 25 |
1 files changed, 25 insertions, 0 deletions
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 <time.h> #include <wlr/backend/interface.h> #include <wlr/backend/session.h> +#include <wlr/types/wlr_buffer.h> #include <wlr/util/log.h> +#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) { |