diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/drm.c | 31 | ||||
-rw-r--r-- | backend/drm/properties.c | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 0e981d59..abfd1c2f 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -977,6 +977,37 @@ uint32_t wlr_drm_connector_get_id(struct wlr_output *output) { return conn->id; } +enum wl_output_transform wlr_drm_connector_get_panel_orientation( + struct wlr_output *output) { + struct wlr_drm_connector *conn = get_drm_connector_from_output(output); + if (conn->props.panel_orientation) { + return WL_OUTPUT_TRANSFORM_NORMAL; + } + + char *orientation = get_drm_prop_enum(conn->backend->fd, conn->id, + conn->props.panel_orientation); + if (orientation == NULL) { + return WL_OUTPUT_TRANSFORM_NORMAL; + } + + enum wl_output_transform tr; + if (strcmp(orientation, "Normal") == 0) { + tr = WL_OUTPUT_TRANSFORM_NORMAL; + } else if (strcmp(orientation, "Left Side Up") == 0) { + tr = WL_OUTPUT_TRANSFORM_90; + } else if (strcmp(orientation, "Upside Down") == 0) { + tr = WL_OUTPUT_TRANSFORM_180; + } else if (strcmp(orientation, "Right Side Up") == 0) { + tr = WL_OUTPUT_TRANSFORM_270; + } else { + wlr_drm_conn_log(conn, WLR_ERROR, "Unknown panel orientation: %s", orientation); + tr = WL_OUTPUT_TRANSFORM_NORMAL; + } + + free(orientation); + return tr; +} + 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/backend/drm/properties.c b/backend/drm/properties.c index 2717e09e..f2696593 100644 --- a/backend/drm/properties.c +++ b/backend/drm/properties.c @@ -26,6 +26,7 @@ static const struct prop_info connector_info[] = { { "PATH", INDEX(path) }, { "link-status", INDEX(link_status) }, { "non-desktop", INDEX(non_desktop) }, + { "panel orientation", INDEX(panel_orientation) }, { "subconnector", INDEX(subconnector) }, { "vrr_capable", INDEX(vrr_capable) }, #undef INDEX |