From a23fd5ff54e8196ec1dda1cb172caa40959c3acc Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 27 Jul 2022 16:43:46 +0000 Subject: [PATCH] drm: Always prefer modes > 60Hz to any others Avoids picking 4K@30Hz and other modes which feel really bad. Happens on a lot of USB C -> HDMI adapters, even if they advertise support for it online. --- src/drm.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/drm.cpp b/src/drm.cpp index 9f75f06..bac1203 100644 --- a/src/drm.cpp +++ b/src/drm.cpp @@ -314,6 +314,11 @@ static bool get_object_properties(struct drm_t *drm, uint32_t obj_id, uint32_t o static bool compare_modes( drmModeModeInfo mode1, drmModeModeInfo mode2 ) { + bool goodRefresh1 = mode1.vrefresh >= 60; + bool goodRefresh2 = mode2.vrefresh >= 60; + if (goodRefresh1 != goodRefresh2) + return goodRefresh1; + if (mode1.type & DRM_MODE_TYPE_PREFERRED) return true; if (mode2.type & DRM_MODE_TYPE_PREFERRED)