From e6858621ab936656a16a0adc62ad4b870a844168 Mon Sep 17 00:00:00 2001 From: Nick Hollinghurst Date: Wed, 4 Oct 2023 17:46:32 +0100 Subject: [PATCH] backend/drm: Allow interlaced modes whose resolution is unique This partially reverts the filtering-out of interlaced modes, but we still remove those whose resolution matches a progressive mode (at least until wlr-randr and arandr can be taught to distinguish them). --- backend/drm/drm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index e9e4c6db2..f3c97078d 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1612,7 +1612,20 @@ static bool connect_drm_connector(struct wlr_drm_connector *wlr_conn, bool found_current_mode = false; for (int i = 0; i < drm_conn->count_modes; ++i) { if (drm_conn->modes[i].flags & DRM_MODE_FLAG_INTERLACE) { - continue; + // Filter out any interlaced mode with the same resolution + // as a progressive mode (because wlr-randr and arandr + // can't currently distinguish them). + int j; + for (j = 0; j < drm_conn->count_modes; ++j) { + if (!(drm_conn->modes[j].flags & DRM_MODE_FLAG_INTERLACE) && + drm_conn->modes[j].hdisplay == drm_conn->modes[i].hdisplay && + drm_conn->modes[j].vdisplay == drm_conn->modes[i].vdisplay) { + break; + } + } + if (j < drm_conn->count_modes) { + continue; + } } struct wlr_drm_mode *mode = drm_mode_create(&drm_conn->modes[i]);