aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-08-06 04:08:32 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-08-06 08:50:12 -0400
commiteaf99c749d43ae74ac7ffece5512f3c73f01dfd2 (patch)
treeb4e9e44920af793735b81481b50a1d54a6099ef9 /drivers/gpu/drm/drm_crtc.c
parentea6763c104c93acb6554659fe4a3c9e9328a4b51 (diff)
drm: Perform cmdline mode parsing during connector initialisation
i915.ko has a custom fbdev initialisation routine that aims to preserve the current mode set by the BIOS, unless overruled by the user. The user's wishes are determined by what, if any, mode is specified on the command line (via the video= parameter). However, that command line mode is first parsed by drm_fb_helper_initial_config() which is called after i915.ko's custom initial_config() as a fallback method. So in order for us to honour it, we need to move the cmdline parser earlier. If we perform the connector cmdline parsing as soon as we initialise the connector, that cmdline mode and forced status is then available even if the fbdev helper is not compiled in or never called. We also then expose the cmdline user mode in the connector mode lists. v2: Rebase after connector->name upheaval. v3: Adapt mga200 to look for the cmdline mode in the new place. Nicely simplifies things while at that. v4: Fix checkpatch. v5: Select FB_CMDLINE to adapt to the changed fbdev patch. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73154 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (v2) Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> (v2) Cc: dri-devel@lists.freedesktop.org Cc: Julia Lemire <jlemire@matrox.com> Cc: Dave Airlie <airlied@redhat.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 33ff631c8d23..66d3bfb8d264 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -863,6 +863,59 @@ static void drm_mode_remove(struct drm_connector *connector,
863} 863}
864 864
865/** 865/**
866 * drm_connector_get_cmdline_mode - reads the user's cmdline mode
867 * @connector: connector to quwery
868 * @mode: returned mode
869 *
870 * The kernel supports per-connector configration of its consoles through
871 * use of the video= parameter. This function parses that option and
872 * extracts the user's specified mode (or enable/disable status) for a
873 * particular connector. This is typically only used during the early fbdev
874 * setup.
875 */
876static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
877{
878 struct drm_cmdline_mode *mode = &connector->cmdline_mode;
879 char *option = NULL;
880
881 if (fb_get_options(connector->name, &option))
882 return;
883
884 if (!drm_mode_parse_command_line_for_connector(option,
885 connector,
886 mode))
887 return;
888
889 if (mode->force) {
890 const char *s;
891
892 switch (mode->force) {
893 case DRM_FORCE_OFF:
894 s = "OFF";
895 break;
896 case DRM_FORCE_ON_DIGITAL:
897 s = "ON - dig";
898 break;
899 default:
900 case DRM_FORCE_ON:
901 s = "ON";
902 break;
903 }
904
905 DRM_INFO("forcing %s connector %s\n", connector->name, s);
906 connector->force = mode->force;
907 }
908
909 DRM_DEBUG_KMS("cmdline mode for connector %s %dx%d@%dHz%s%s%s\n",
910 connector->name,
911 mode->xres, mode->yres,
912 mode->refresh_specified ? mode->refresh : 60,
913 mode->rb ? " reduced blanking" : "",
914 mode->margins ? " with margins" : "",
915 mode->interlace ? " interlaced" : "");
916}
917
918/**
866 * drm_connector_init - Init a preallocated connector 919 * drm_connector_init - Init a preallocated connector
867 * @dev: DRM device 920 * @dev: DRM device
868 * @connector: the connector to init 921 * @connector: the connector to init
@@ -914,6 +967,8 @@ int drm_connector_init(struct drm_device *dev,
914 connector->edid_blob_ptr = NULL; 967 connector->edid_blob_ptr = NULL;
915 connector->status = connector_status_unknown; 968 connector->status = connector_status_unknown;
916 969
970 drm_connector_get_cmdline_mode(connector);
971
917 list_add_tail(&connector->head, &dev->mode_config.connector_list); 972 list_add_tail(&connector->head, &dev->mode_config.connector_list);
918 dev->mode_config.num_connector++; 973 dev->mode_config.num_connector++;
919 974