aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/drm.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-06-22 05:37:07 -0700
committerGitHub <noreply@github.com>2018-06-22 05:37:07 -0700
commite459fe0ec713ea65b35b966f9bb3c6c70c9504aa (patch)
treebbf22d6d1c6014d6b2174dd37c0e80c2381648b1 /backend/drm/drm.c
parent47c7674a68ca6adfd0b8151d62c3afae32d69577 (diff)
parented7d5b0f53167b6191d408e5c7f20a3672fac3c2 (diff)
Merge pull request #992 from emersion/screencontent
Implement wlr_export_dmabuf_unstable_v1 protocol
Diffstat (limited to 'backend/drm/drm.c')
-rw-r--r--backend/drm/drm.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index ef8efb9a..c5db480e 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -254,6 +254,25 @@ static uint32_t drm_connector_get_gamma_size(struct wlr_output *output) {
return 0;
}
+static bool drm_connector_export_dmabuf(struct wlr_output *output,
+ struct wlr_dmabuf_attributes *attribs) {
+ struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
+ struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
+
+ if (!drm->session->active) {
+ return false;
+ }
+
+ struct wlr_drm_crtc *crtc = conn->crtc;
+ if (!crtc) {
+ return false;
+ }
+ struct wlr_drm_plane *plane = crtc->primary;
+ struct wlr_drm_surface *surf = &plane->surf;
+
+ return export_drm_bo(surf->back, attribs);
+}
+
static void drm_connector_start_renderer(struct wlr_drm_connector *conn) {
if (conn->state != WLR_DRM_CONN_CONNECTED) {
return;
@@ -742,6 +761,7 @@ static const struct wlr_output_impl output_impl = {
.swap_buffers = drm_connector_swap_buffers,
.set_gamma = drm_connector_set_gamma,
.get_gamma_size = drm_connector_get_gamma_size,
+ .export_dmabuf = drm_connector_export_dmabuf,
};
bool wlr_output_is_drm(struct wlr_output *output) {