From 02df7b7ac89696e3a94de3ff66b2bed1c6e5b77a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 25 Aug 2020 12:30:00 +0200 Subject: [PATCH] backend/headless: implement export_dmabuf --- backend/headless/output.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/backend/headless/output.c b/backend/headless/output.c index d2160987..8ce7a32b 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -121,6 +121,23 @@ static void output_rollback_render(struct wlr_output *wlr_output) { output->back_buffer = NULL; } +static bool output_export_dmabuf(struct wlr_output *wlr_output, + struct wlr_dmabuf_attributes *attribs) { + struct wlr_headless_output *output = + headless_output_from_output(wlr_output); + + if (!output->front_buffer) { + return false; + } + + struct wlr_dmabuf_attributes tmp; + if (!wlr_buffer_get_dmabuf(output->front_buffer, &tmp)) { + return false; + } + + return wlr_dmabuf_attributes_copy(attribs, &tmp); +} + static void output_destroy(struct wlr_output *wlr_output) { struct wlr_headless_output *output = headless_output_from_output(wlr_output); @@ -137,6 +154,7 @@ static const struct wlr_output_impl output_impl = { .attach_render = output_attach_render, .commit = output_commit, .rollback_render = output_rollback_render, + .export_dmabuf = output_export_dmabuf, }; bool wlr_output_is_headless(struct wlr_output *wlr_output) {