From cd60f40bbb973c8e68bad547190640aa16f0d5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 21 Mar 2019 21:12:43 +0100 Subject: [PATCH] wlr_output: Add preferred property (#1625) * wlr_output: Indicate modes link * wlr_output: Introduce preferred flag This indicates an outputs preferred mode. * drm: Set preferred flag for an outputs preferred mode --- backend/drm/drm.c | 3 +++ include/wlr/types/wlr_output.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 7fd36794..f179f835 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1207,6 +1207,9 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) { mode->wlr_mode.width = mode->drm_mode.hdisplay; mode->wlr_mode.height = mode->drm_mode.vdisplay; mode->wlr_mode.refresh = calculate_refresh_rate(&mode->drm_mode); + if (mode->drm_mode.type & DRM_MODE_TYPE_PREFERRED) { + mode->wlr_mode.preferred = true; + } wlr_log(WLR_INFO, " %"PRId32"x%"PRId32"@%"PRId32, mode->wlr_mode.width, mode->wlr_mode.height, diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index d6761ee1..84791b2d 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -20,6 +20,7 @@ struct wlr_output_mode { uint32_t flags; // enum wl_output_mode int32_t width, height; int32_t refresh; // mHz + bool preferred; struct wl_list link; }; @@ -71,7 +72,7 @@ struct wlr_output { int32_t phys_width, phys_height; // mm // Note: some backends may have zero modes - struct wl_list modes; + struct wl_list modes; // wlr_output_mode::link struct wlr_output_mode *current_mode; int32_t width, height; int32_t refresh; // mHz, may be zero