aboutsummaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-06-04 10:34:34 +1000
committerDave Airlie <airlied@redhat.com>2008-06-04 10:36:58 +1000
commit40229b6ad539cebad5ebe8ca373796ca2422efdb (patch)
tree2df95422abe1999e3db2ab06c45aba2fbf7e2e06 /linux-core
parent3ed17803d826b10f8f94d09acf12877e9738823c (diff)
drm: make mode comparison more betterer.
This compares the clocks after converting to fb pico timings so we get the same answer if the X and fb modes are the same.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_modes.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/linux-core/drm_modes.c b/linux-core/drm_modes.c
index bf0d85ee..3ed427fb 100644
--- a/linux-core/drm_modes.c
+++ b/linux-core/drm_modes.c
@@ -276,8 +276,15 @@ EXPORT_SYMBOL(drm_mode_duplicate);
*/
bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2)
{
- if (mode1->clock == mode2->clock &&
- mode1->hdisplay == mode2->hdisplay &&
+ /* do clock check convert to PICOS so fb modes get matched
+ * the same */
+ if (mode1->clock && mode2->clock) {
+ if (KHZ2PICOS(mode1->clock) != KHZ2PICOS(mode2->clock))
+ return false;
+ } else if (mode1->clock != mode2->clock)
+ return false;
+
+ if (mode1->hdisplay == mode2->hdisplay &&
mode1->hsync_start == mode2->hsync_start &&
mode1->hsync_end == mode2->hsync_end &&
mode1->htotal == mode2->htotal &&