]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
drm: Sort connector modes based on vrefresh
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 31 May 2013 12:17:08 +0000 (12:17 +0000)
committerDave Airlie <airlied@redhat.com>
Mon, 10 Jun 2013 22:35:51 +0000 (08:35 +1000)
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@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/drm_modes.c

index ed1334e27c33283442fceb604892e55666bdfe2c..f554516ec2a47da91056f7312dd4fcfea3697fa2 100644 (file)
@@ -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);
        }
index 69153385c63f5fd52aaeb0a45209b9e6a657e0d5..a6729bfe6860e06a3d2ac0f0da721caada4238d8 100644 (file)
@@ -1020,6 +1020,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;
 }