Some panels advertise DRRS modes with matching timings but different sync
polarities. is_alt_drrs_mode() currently includes DRM_MODE_MATCH_FLAGS and
rejects such pairs.

Commit 2bd0db4b3f0b ("drm/i915: Allow panel fixed modes to have differing
sync polarities") already made is_alt_fixed_mode() ignore H/V sync polarity
because panels can declare alternate modes with different values and
Windows/GOP accepts them. Apply the same rule when matching DRRS modes.
Continue to require matching timings, 3D flags, and all other mode flags.

Tested: BOE NE160QAM-NZ1 (3840x2400); DRRS reached low refresh.
Tested: Huawei 23040676 (2520x1680); DRRS reached low refresh.
Signed-off-by: Sean Rhodes <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_panel.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_panel.c 
b/drivers/gpu/drm/i915/display/intel_panel.c
index 81e638d0c7b3..e79c51a1c33c 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -144,10 +144,13 @@ intel_panel_fixed_mode(struct intel_connector *connector,
 static bool is_alt_drrs_mode(const struct drm_display_mode *mode,
                             const struct drm_display_mode *preferred_mode)
 {
+       u32 sync_flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NHSYNC |
+               DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC;
+
        return drm_mode_match(mode, preferred_mode,
                              DRM_MODE_MATCH_TIMINGS |
-                             DRM_MODE_MATCH_FLAGS |
                              DRM_MODE_MATCH_3D_FLAGS) &&
+               (mode->flags & ~sync_flags) == (preferred_mode->flags & 
~sync_flags) &&
                mode->clock != preferred_mode->clock;
 }
 

Reply via email to