WDRM_CONNECTOR_NON_DESKTOP,
WDRM_CONNECTOR_CONTENT_PROTECTION,
WDRM_CONNECTOR_HDCP_CONTENT_TYPE,
+ WDRM_CONNECTOR_PANEL_ORIENTATION,
WDRM_CONNECTOR__COUNT
};
WDRM_DPMS_STATE__COUNT
};
+enum wdrm_panel_orientation {
+ WDRM_PANEL_ORIENTATION_NORMAL = 0,
+ WDRM_PANEL_ORIENTATION_UPSIDE_DOWN,
+ WDRM_PANEL_ORIENTATION_LEFT_SIDE_UP,
+ WDRM_PANEL_ORIENTATION_RIGHT_SIDE_UP,
+ WDRM_PANEL_ORIENTATION__COUNT
+};
+
/**
* List of properties attached to DRM CRTCs
*/
},
};
+struct drm_property_enum_info panel_orientation_enums[] = {
+ [WDRM_PANEL_ORIENTATION_NORMAL] = { .name = "Normal", },
+ [WDRM_PANEL_ORIENTATION_UPSIDE_DOWN] = { .name = "Upside Down", },
+ [WDRM_PANEL_ORIENTATION_LEFT_SIDE_UP] = { .name = "Left Side Up", },
+ [WDRM_PANEL_ORIENTATION_RIGHT_SIDE_UP] = { .name = "Right Side Up", },
+};
+
const struct drm_property_info connector_props[] = {
[WDRM_CONNECTOR_EDID] = { .name = "EDID" },
[WDRM_CONNECTOR_DPMS] = {
.enum_values = hdcp_content_type_enums,
.num_enum_values = WDRM_HDCP_CONTENT_TYPE__COUNT,
},
+ [WDRM_CONNECTOR_PANEL_ORIENTATION] = {
+ .name = "panel orientation",
+ .enum_values = panel_orientation_enums,
+ .num_enum_values = WDRM_PANEL_ORIENTATION__COUNT,
+ },
};
const struct drm_property_info crtc_props[] = {
return drm_property_get_value(non_desktop_info, props, 0);
}
+static uint32_t
+get_panel_orientation(struct drm_head *head, drmModeObjectPropertiesPtr props)
+{
+ struct drm_property_info *orientation =
+ &head->props_conn[WDRM_CONNECTOR_PANEL_ORIENTATION];
+ uint64_t kms_val =
+ drm_property_get_value(orientation, props,
+ WDRM_PANEL_ORIENTATION_NORMAL);
+
+ switch (kms_val) {
+ case WDRM_PANEL_ORIENTATION_NORMAL:
+ return WL_OUTPUT_TRANSFORM_NORMAL;
+ case WDRM_PANEL_ORIENTATION_UPSIDE_DOWN:
+ return WL_OUTPUT_TRANSFORM_180;
+ case WDRM_PANEL_ORIENTATION_LEFT_SIDE_UP:
+ return WL_OUTPUT_TRANSFORM_90;
+ case WDRM_PANEL_ORIENTATION_RIGHT_SIDE_UP:
+ return WL_OUTPUT_TRANSFORM_270;
+ default:
+ assert(!"unknown property value in get_panel_orientation");
+ }
+}
+
static int
parse_modeline(const char *s, drmModeModeInfo *mode)
{
weston_head_set_physical_size(&head->base, head->connector->mmWidth,
head->connector->mmHeight);
+ weston_head_set_transform(&head->base,
+ get_panel_orientation(head, props));
+
/* Unknown connection status is assumed disconnected. */
weston_head_set_connection_status(&head->base,
head->connector->connection == DRM_MODE_CONNECTED);