aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-08-25 12:30:00 +0200
committerSimon Ser <contact@emersion.fr>2020-11-15 22:54:07 +0100
commit02df7b7ac89696e3a94de3ff66b2bed1c6e5b77a (patch)
treee5488b14297b0e8fa6ebea600279ed57538680dc /backend
parent61f8cdfb9ee2f8cc710c4cf947634c0c737e6383 (diff)
backend/headless: implement export_dmabuf
Diffstat (limited to 'backend')
-rw-r--r--backend/headless/output.c18
1 files changed, 18 insertions, 0 deletions
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) {