Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Prefer noninterlace cmdline mode unless explicitly specified

Currently drm_pick_cmdline_mode() doesn't care about the interlace
when the given mode line has no "i" suffix. That is, when there are
multiple entries for the same resolution, an interlace mode might be
picked up just depending on the assigned order, and there is no way to
exclude it.

This patch changes the logic for the mode selection, to prefer the
noninterlace mode unless the interlace mode is explicitly given.
When no matching mode is found, it still tries the interlace mode as
fallback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Takashi Iwai and committed by
Dave Airlie
c683f427 deadcb36

+11
+11
drivers/gpu/drm/drm_fb_helper.c
··· 1159 1159 { 1160 1160 struct drm_cmdline_mode *cmdline_mode; 1161 1161 struct drm_display_mode *mode = NULL; 1162 + bool prefer_non_interlace; 1162 1163 1163 1164 cmdline_mode = &fb_helper_conn->cmdline_mode; 1164 1165 if (cmdline_mode->specified == false) ··· 1171 1170 if (cmdline_mode->rb || cmdline_mode->margins) 1172 1171 goto create_mode; 1173 1172 1173 + prefer_non_interlace = !cmdline_mode->interlace; 1174 + again: 1174 1175 list_for_each_entry(mode, &fb_helper_conn->connector->modes, head) { 1175 1176 /* check width/height */ 1176 1177 if (mode->hdisplay != cmdline_mode->xres || ··· 1187 1184 if (cmdline_mode->interlace) { 1188 1185 if (!(mode->flags & DRM_MODE_FLAG_INTERLACE)) 1189 1186 continue; 1187 + } else if (prefer_non_interlace) { 1188 + if (mode->flags & DRM_MODE_FLAG_INTERLACE) 1189 + continue; 1190 1190 } 1191 1191 return mode; 1192 + } 1193 + 1194 + if (prefer_non_interlace) { 1195 + prefer_non_interlace = false; 1196 + goto again; 1192 1197 } 1193 1198 1194 1199 create_mode: