drm/i915: Allow fuzzy matching in intel_compare_link_m_n
Subsystems (2)
PATCH 1/1 drm/i915: Allow fuzzy matching in intel_compare_link_m_n
This prevents a unnecessary modeset on a dell XPS 13 (2016).
N is always a power of 2, which means that for fuzzy matching we should compare for inequality on the n values, then do fuzzy matching on the m values.
Tested-by:
--
drivers/gpu/drm/i915/intel_display.c +8 -5
@@ -12638,19 +12638,22 @@ intel_compare_m_n(unsigned int m, unsigned int n,BUILD_BUG_ON (DATA_LINK_M_N_MASK >INT_MAX ); -if (m > m2) { -while (m > m2) { +if (n > n2) { +while (n > n2) { m2 <<=1 ; n2 <<=1 ; } - }else if (m < m2) { -while (m < m2) { + }else if (n < n2) { +while (n < n2) { m <<=1 ; n <<=1 ; } } -return m == m2 && n == n2; +if (n != n2) +return false; + +return intel_fuzzy_clock_check (m, m2); } static bool
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 8 lines · PST Maarten Lankhorst
This prevents a unnecessary modeset on a dell XPS 13 (2016).
N is always a power of 2, which means that for fuzzy matching we should compare for inequality on the n values, then do fuzzy matching on the m values.
Signed-off-by Maarten Lankhorst <[email protected]>Tested-by:
drivers/gpu/drm/i915/
Quoted 2 lines
--
drivers/gpu/drm/i915/ renamed from drivers/gpu/drm/i915/intel_display.c +0
-0
intel_display.c
Quoted 23 lines
index
7afbdc45a278..aa4f1e69b92e100644drivers/gpu/drm/i915/intel_display.c +4
-4@@ -12638,19 +12638,22 @@ intel_compare_m_n(unsigned int m, unsigned int n,BUILD_BUG_ON (DATA_LINK_M_N_MASK >INT_MAX ); -if (m > m2) { -while (m > m2) { +if (n > n2) { +while (n > n2) { m2 <<=1 ; n2 <<=1 ; } - }else if (m < m2) { -while (m < m2) { + }else if (n < n2) { +while (n < n2) { m <<=1 ; n <<=1 ; }
drivers/gpu/drm/i915/intel_display.c intel_compare_m_n(unsigned int m, unsigned int n, · line 12659
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +4
-1} -return m == m2 && n == n2; +if (n != n2) +return false; + +return intel_fuzzy_clock_check (m, m2); } static bool
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 8 lines · Maarten Lankhorst
This prevents a unnecessary modeset on a dell XPS 13 (2016).
N is always a power of 2, which means that for fuzzy matching we should compare for inequality on the n values, then do fuzzy matching on the m values.
Signed-off-by Maarten Lankhorst <[email protected]>Tested-by:
Wasn't sure about overflow risks, but as long as the value we compute originally computed didn't overflow this should be safe.
Quoted 38 lines
--
drivers/gpu/drm/i915/intel_display.c +8
-5@@ -12638,19 +12638,22 @@ intel_compare_m_n(unsigned int m, unsigned int n,BUILD_BUG_ON (DATA_LINK_M_N_MASK >INT_MAX ); -if (m > m2) { -while (m > m2) { +if (n > n2) { +while (n > n2) { m2 <<=1 ; n2 <<=1 ; } - }else if (m < m2) { -while (m < m2) { + }else if (n < n2) { +while (n < n2) { m <<=1 ; n <<=1 ; } } -return m == m2 && n == n2; +if (n != n2) +return false; + +return intel_fuzzy_clock_check (m, m2); } static bool_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx