From 1c0507b12a30e38c4e35e64b254dd5c1d298f3ae Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 25 Nov 2019 23:41:04 +0000 Subject: [PATCH] compositor: Use weston_head transform for output default If the output only has a single weston_head attached to it, take its declared transform as the default transform. With the previous patches, this allows a device declaring the KMS 'panel orientation' property (e.g. through DeviceTree) to autoconfigure to the correct display rotation when running Weston. Signed-off-by: Daniel Stone --- compositor/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compositor/main.c b/compositor/main.c index 799ab837..c9002bf4 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -1700,6 +1700,7 @@ drm_backend_output_configure(struct weston_output *output, const struct weston_drm_output_api *api; enum weston_drm_backend_output_mode mode = WESTON_DRM_BACKEND_OUTPUT_PREFERRED; + uint32_t transform = WL_OUTPUT_TRANSFORM_NORMAL; char *s; char *modeline = NULL; char *gbm_format = NULL; @@ -1731,9 +1732,13 @@ drm_backend_output_configure(struct weston_output *output, } free(modeline); + if (count_remaining_heads(output, NULL) == 1) { + struct weston_head *head = weston_output_get_first_head(output); + transform = weston_head_get_transform(head); + } + wet_output_set_scale(output, section, 1, 0); - if (wet_output_set_transform(output, section, - WL_OUTPUT_TRANSFORM_NORMAL, + if (wet_output_set_transform(output, section, transform, UINT32_MAX) < 0) { return -1; }