Skip to content

Commit 9bc3cd5

Browse files
vsyrjalaairlied
authored andcommitted
drm: Sort connector modes based on vrefresh
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>
1 parent 990256a commit 9bc3cd5

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎drivers/gpu/drm/drm_crtc_helper.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,14 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
189189
if (list_empty(&connector->modes))
190190
return 0;
191191

192+
list_for_each_entry(mode, &connector->modes, head)
193+
mode->vrefresh = drm_mode_vrefresh(mode);
194+
192195
drm_mode_sort(&connector->modes);
193196

194197
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
195198
drm_get_connector_name(connector));
196199
list_for_each_entry(mode, &connector->modes, head) {
197-
mode->vrefresh = drm_mode_vrefresh(mode);
198-
199200
drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
200201
drm_mode_debug_printmodeline(mode);
201202
}

‎drivers/gpu/drm/drm_modes.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,11 @@ static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head
10201020
diff = b->hdisplay * b->vdisplay - a->hdisplay * a->vdisplay;
10211021
if (diff)
10221022
return diff;
1023+
1024+
diff = b->vrefresh - a->vrefresh;
1025+
if (diff)
1026+
return diff;
1027+
10231028
diff = b->clock - a->clock;
10241029
return diff;
10251030
}

0 commit comments

Comments
 (0)