drm: Add DRM_MODE_TYPE_USERDEF flag to probed modes matching a video= argument

drm_helper_probe_add_cmdline_mode() prefers using a probed mode matching
a video= argument over calculating our own timings for the user specified
mode using CVT or GTF.

But userspace code which is auto-configuring the mode may want to know that
the user has specified that mode on the kernel commandline so that it can
pick that mode over the mode which is marked as DRM_MODE_TYPE_PREFERRED.

This commit sets the DRM_MODE_TYPE_USERDEF flag on the matching mode, just
as we would do on the user-specified mode when no matching probed mode is
found.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200221173313.510235-2-hdegoede@redhat.com
This commit is contained in:
Hans de Goede 2020-02-21 18:33:13 +01:00 committed by Emil Velikov
parent a519f6d03f
commit ebdc02dd4c
2 changed files with 4 additions and 1 deletions

View File

@ -159,6 +159,8 @@ static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector)
continue;
}
/* Mark the matching mode as being preferred by the user */
mode->type |= DRM_MODE_TYPE_USERDEF;
return 0;
}

View File

@ -256,7 +256,8 @@ struct drm_display_mode {
* - DRM_MODE_TYPE_DRIVER: Mode created by the driver, which is all of
* them really. Drivers must set this bit for all modes they create
* and expose to userspace.
* - DRM_MODE_TYPE_USERDEF: Mode defined via kernel command line
* - DRM_MODE_TYPE_USERDEF: Mode defined or selected via the kernel
* command line.
*
* Plus a big list of flags which shouldn't be used at all, but are
* still around since these flags are also used in the userspace ABI.