summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2022-05-11 20:31:24 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2022-05-16 13:43:21 +0200
commitb959eb4f5b7ea49b47e95c9047d33d1b1cf81057 (patch)
treef5a29ba81ab6ea052c73c7bca518d92d536b5377
parentb6415bd7386bcf9d2e0d6ee1d4ef4186e7a87b24 (diff)
downloadlinux-stable-b959eb4f5b7ea49b47e95c9047d33d1b1cf81057.tar.gz
linux-stable-b959eb4f5b7ea49b47e95c9047d33d1b1cf81057.tar.bz2
linux-stable-b959eb4f5b7ea49b47e95c9047d33d1b1cf81057.zip
drm/client: Look for command-line modes first
When picking a mode, first look for modes that have been specified by the user on the kernel's command line. Only if that fails, use the existing heuristic of picking a nearby mode from it's various parameters. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20220511183125.14294-3-tzimmermann@suse.de
-rw-r--r--drivers/gpu/drm/drm_client_modeset.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index e6346a67cd98..b777faa87f04 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -165,6 +165,17 @@ drm_connector_pick_cmdline_mode(struct drm_connector *connector)
struct drm_display_mode *mode;
bool prefer_non_interlace;
+ /*
+ * Find a user-defined mode. If the user gave us a valid
+ * mode on the kernel command line, it will show up in this
+ * list.
+ */
+
+ list_for_each_entry(mode, &connector->modes, head) {
+ if (mode->type & DRM_MODE_TYPE_USERDEF)
+ return mode;
+ }
+
cmdline_mode = &connector->cmdline_mode;
if (cmdline_mode->specified == false)
return NULL;