From f17b0f975d271a2c001627fe47af9a5b8800c774 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 15 Jan 2021 21:50:17 +0100 Subject: [PATCH] backend/drm: add wlr_drm_connector_get_id This allows a compositor to get a KMS connector object ID from a wlr_output. The compositor can then query more information about the connector via libdrm. This gives more freedom to compositors and allows them to read KMS properties that wlroots doesn't know about. For instance, they could read the EDID or the suggested_{X,Y} properties and change their output configuration based on that. --- backend/drm/drm.c | 5 +++++ include/wlr/backend/drm.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 0bf51209f..995201435 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1046,6 +1046,11 @@ bool wlr_output_is_drm(struct wlr_output *output) { return output->impl == &output_impl; } +uint32_t wlr_drm_connector_get_id(struct wlr_output *output) { + struct wlr_drm_connector *conn = get_drm_connector_from_output(output); + return conn->id; +} + static const int32_t subpixel_map[] = { [DRM_MODE_SUBPIXEL_UNKNOWN] = WL_OUTPUT_SUBPIXEL_UNKNOWN, [DRM_MODE_SUBPIXEL_HORIZONTAL_RGB] = WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB, diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h index 0a307166a..baa034218 100644 --- a/include/wlr/backend/drm.h +++ b/include/wlr/backend/drm.h @@ -28,6 +28,11 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, bool wlr_backend_is_drm(struct wlr_backend *backend); bool wlr_output_is_drm(struct wlr_output *output); +/** + * Get the KMS connector object ID. + */ +uint32_t wlr_drm_connector_get_id(struct wlr_output *output); + /** * Add mode to the list of available modes */