From b495faf98d2d29c66be8770c66e42b997c602d56 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 8 Apr 2022 16:23:51 +0300 Subject: [PATCH] backends/drm: Fix mode comparison Some modes can have the exact frame timings but different flags. Currently, the mode comparison function doesn't take that into account which can result in the drm backend setting the current mode flag incorrectly. --- src/backends/drm/drm_object_connector.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/backends/drm/drm_object_connector.cpp b/src/backends/drm/drm_object_connector.cpp index 2b4faf0821..9e0d3c6abc 100644 --- a/src/backends/drm/drm_object_connector.cpp +++ b/src/backends/drm/drm_object_connector.cpp @@ -20,24 +20,14 @@ #include #include +#include namespace KWin { static bool checkIfEqual(const drmModeModeInfo *one, const drmModeModeInfo *two) { - return one->clock == two->clock - && one->hdisplay == two->hdisplay - && one->hsync_start == two->hsync_start - && one->hsync_end == two->hsync_end - && one->htotal == two->htotal - && one->hskew == two->hskew - && one->vdisplay == two->vdisplay - && one->vsync_start == two->vsync_start - && one->vsync_end == two->vsync_end - && one->vtotal == two->vtotal - && one->vscan == two->vscan - && one->vrefresh == two->vrefresh; + return std::memcmp(one, two, sizeof(drmModeModeInfo)) == 0; } static quint64 refreshRateForMode(_drmModeModeInfo *m)