[PATCH 3/3] drm: Sort connector modes based on vrefresh

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Fri May 31 05:17:08 PDT 2013


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Keeping the modes sorted by vrefresh before the pixel clock makes the
mode list somehow more pleasing to the eye.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
This is quite a subjective thing, so if no one else wants it, I'm fine
with dropping it. More of an RFC really...

 drivers/gpu/drm/drm_crtc_helper.c | 5 +++--
 drivers/gpu/drm/drm_modes.c       | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index ed1334e..f554516 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -189,13 +189,14 @@ prune:
 	if (list_empty(&connector->modes))
 		return 0;
 
+	list_for_each_entry(mode, &connector->modes, head)
+		mode->vrefresh = drm_mode_vrefresh(mode);
+
 	drm_mode_sort(&connector->modes);
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
 			drm_get_connector_name(connector));
 	list_for_each_entry(mode, &connector->modes, head) {
-		mode->vrefresh = drm_mode_vrefresh(mode);
-
 		drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
 		drm_mode_debug_printmodeline(mode);
 	}
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index ba86316..4370fd4 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1018,6 +1018,11 @@ static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head
 	diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay;
 	if (diff)
 		return diff;
+
+	diff = b->vrefresh - a->vrefresh;
+	if (diff)
+		return diff;
+
 	diff = b->clock - a->clock;
 	return diff;
 }
-- 
1.8.1.5



More information about the dri-devel mailing list