Commit 0facdaa2 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/client: Don't add new command-line mode

Don't add a mode for the kernel's command-line parameters from
within the DRM client code. Doing so can result in an unusable
display. If there's no compatible command-line mode, the client
will use one of the connector's preferred modes.

All mode creation and validation has to be performed by the
connector. When clients run, the connector's fill_modes callback
has already processed the kernel parameters and validated each
mode before adding it. The connector's mode list does not contain
invalid modes.

v2:
	* grammar in commit message (Javier)
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Reviewed-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511183125.14294-4-tzimmermann@suse.de
parent b959eb4f
...@@ -158,8 +158,7 @@ drm_connector_has_preferred_mode(struct drm_connector *connector, int width, int ...@@ -158,8 +158,7 @@ drm_connector_has_preferred_mode(struct drm_connector *connector, int width, int
return NULL; return NULL;
} }
static struct drm_display_mode * static struct drm_display_mode *drm_connector_pick_cmdline_mode(struct drm_connector *connector)
drm_connector_pick_cmdline_mode(struct drm_connector *connector)
{ {
struct drm_cmdline_mode *cmdline_mode; struct drm_cmdline_mode *cmdline_mode;
struct drm_display_mode *mode; struct drm_display_mode *mode;
...@@ -180,11 +179,10 @@ drm_connector_pick_cmdline_mode(struct drm_connector *connector) ...@@ -180,11 +179,10 @@ drm_connector_pick_cmdline_mode(struct drm_connector *connector)
if (cmdline_mode->specified == false) if (cmdline_mode->specified == false)
return NULL; return NULL;
/* attempt to find a matching mode in the list of modes /*
* we have gotten so far, if not add a CVT mode that conforms * Attempt to find a matching mode in the list of modes we
* have gotten so far.
*/ */
if (cmdline_mode->rb || cmdline_mode->margins)
goto create_mode;
prefer_non_interlace = !cmdline_mode->interlace; prefer_non_interlace = !cmdline_mode->interlace;
again: again:
...@@ -218,12 +216,7 @@ drm_connector_pick_cmdline_mode(struct drm_connector *connector) ...@@ -218,12 +216,7 @@ drm_connector_pick_cmdline_mode(struct drm_connector *connector)
goto again; goto again;
} }
create_mode: return NULL;
mode = drm_mode_create_from_cmdline_mode(connector->dev, cmdline_mode);
if (mode)
list_add(&mode->head, &connector->modes);
return mode;
} }
static bool drm_connector_enabled(struct drm_connector *connector, bool strict) static bool drm_connector_enabled(struct drm_connector *connector, bool strict)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment