backend/headless: implement export_dmabuf

This commit is contained in:
Simon Ser 2020-08-25 12:30:00 +02:00
parent 61f8cdfb9e
commit 02df7b7ac8
1 changed files with 18 additions and 0 deletions

View File

@ -121,6 +121,23 @@ static void output_rollback_render(struct wlr_output *wlr_output) {
output->back_buffer = NULL; 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) { static void output_destroy(struct wlr_output *wlr_output) {
struct wlr_headless_output *output = struct wlr_headless_output *output =
headless_output_from_output(wlr_output); headless_output_from_output(wlr_output);
@ -137,6 +154,7 @@ static const struct wlr_output_impl output_impl = {
.attach_render = output_attach_render, .attach_render = output_attach_render,
.commit = output_commit, .commit = output_commit,
.rollback_render = output_rollback_render, .rollback_render = output_rollback_render,
.export_dmabuf = output_export_dmabuf,
}; };
bool wlr_output_is_headless(struct wlr_output *wlr_output) { bool wlr_output_is_headless(struct wlr_output *wlr_output) {