From: Ville Syrjälä <[email protected]>

Now that we no longer fuzz M/N during fastset these should
match exctly.

TODO: we may need to do something for fastboot here as the
VBIOS/GOP may not compute M/N exactly the same way we do.
Though I guess we could try to match the VBIOS/GOP exactly.

Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 49 ++++----------------
 1 file changed, 8 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 86971be92e57..198c6340a463 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -5832,47 +5832,15 @@ bool intel_fuzzy_clock_check(int clock1, int clock2)
        return false;
 }
 
-static bool
-intel_compare_m_n(unsigned int m, unsigned int n,
-                 unsigned int m2, unsigned int n2,
-                 bool exact)
-{
-       if (m == m2 && n == n2)
-               return true;
-
-       if (exact || !m || !n || !m2 || !n2)
-               return false;
-
-       BUILD_BUG_ON(DATA_LINK_M_N_MASK > INT_MAX);
-
-       if (n > n2) {
-               while (n > n2) {
-                       m2 <<= 1;
-                       n2 <<= 1;
-               }
-       } else if (n < n2) {
-               while (n < n2) {
-                       m <<= 1;
-                       n <<= 1;
-               }
-       }
-
-       if (n != n2)
-               return false;
-
-       return intel_fuzzy_clock_check(m, m2);
-}
-
 static bool
 intel_compare_link_m_n(const struct intel_link_m_n *m_n,
-                      const struct intel_link_m_n *m2_n2,
-                      bool exact)
+                      const struct intel_link_m_n *m2_n2)
 {
        return m_n->tu == m2_n2->tu &&
-               intel_compare_m_n(m_n->data_m, m_n->data_n,
-                                 m2_n2->data_m, m2_n2->data_n, exact) &&
-               intel_compare_m_n(m_n->link_m, m_n->link_n,
-                                 m2_n2->link_m, m2_n2->link_n, exact);
+               m_n->data_m == m2_n2->data_m &&
+               m_n->data_n == m2_n2->data_n &&
+               m_n->link_m == m2_n2->link_m &&
+               m_n->link_n == m2_n2->link_n;
 }
 
 static bool
@@ -6066,8 +6034,7 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
 
 #define PIPE_CONF_CHECK_M_N(name) do { \
        if (!intel_compare_link_m_n(&current_config->name, \
-                                   &pipe_config->name,\
-                                   !fastset)) { \
+                                   &pipe_config->name)) { \
                pipe_config_mismatch(fastset, crtc, __stringify(name), \
                                     "(expected tu %i data %i/%i link %i/%i, " \
                                     "found tu %i, data %i/%i link %i/%i)", \
@@ -6114,9 +6081,9 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
  */
 #define PIPE_CONF_CHECK_M_N_ALT(name, alt_name) do { \
        if (!intel_compare_link_m_n(&current_config->name, \
-                                   &pipe_config->name, !fastset) && \
+                                   &pipe_config->name) && \
            !intel_compare_link_m_n(&current_config->alt_name, \
-                                   &pipe_config->name, !fastset)) { \
+                                   &pipe_config->name)) { \
                pipe_config_mismatch(fastset, crtc, __stringify(name), \
                                     "(expected tu %i data %i/%i link %i/%i, " \
                                     "or tu %i data %i/%i link %i/%i, " \
-- 
2.35.1

Reply via email to