From 05ed20218396db2176345475b6b76a1d54e0f02d Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 27 Jun 2019 15:12:35 -0400 Subject: [PATCH] drm backend: detect non-desktop outputs --- backend/drm/drm.c | 10 ++++++++-- backend/drm/properties.c | 1 + include/backend/drm/properties.h | 1 + include/wlr/types/wlr_output.h | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index ca23a1b6..9247f931 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1206,8 +1206,8 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) { drm->display); struct wl_event_loop *ev = wl_display_get_event_loop(drm->display); - wlr_conn->retry_pageflip = wl_event_loop_add_timer(ev, retry_pageflip, - wlr_conn); + wlr_conn->retry_pageflip = wl_event_loop_add_timer( + ev, retry_pageflip, wlr_conn); wlr_conn->state = WLR_DRM_CONN_DISCONNECTED; wlr_conn->id = drm_conn->connector_id; @@ -1269,6 +1269,12 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) { get_drm_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props); + uint64_t non_desktop; + if (get_drm_prop(drm->fd, wlr_conn->id, + wlr_conn->props.non_desktop, &non_desktop)) { + wlr_conn->output.non_desktop = non_desktop; + } + size_t edid_len = 0; uint8_t *edid = get_drm_prop_blob(drm->fd, wlr_conn->id, wlr_conn->props.edid, &edid_len); diff --git a/backend/drm/properties.c b/backend/drm/properties.c index 010b71d4..11ec9a4b 100644 --- a/backend/drm/properties.c +++ b/backend/drm/properties.c @@ -24,6 +24,7 @@ static const struct prop_info connector_info[] = { { "EDID", INDEX(edid) }, { "PATH", INDEX(path) }, { "link-status", INDEX(link_status) }, + { "non-desktop", INDEX(non_desktop) }, #undef INDEX }; diff --git a/include/backend/drm/properties.h b/include/backend/drm/properties.h index 28f0dbe4..bed2ca57 100644 --- a/include/backend/drm/properties.h +++ b/include/backend/drm/properties.h @@ -16,6 +16,7 @@ union wlr_drm_connector_props { uint32_t dpms; uint32_t link_status; // not guaranteed to exist uint32_t path; + uint32_t non_desktop; // atomic-modesetting only diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 281f7daf..3e76b018 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -112,6 +112,9 @@ struct wlr_output { bool frame_pending; float transform_matrix[9]; + // true, for example, with VR headsets + bool non_desktop; + struct wlr_output_state pending; struct {