]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/modes: parse_cmdline: Accept extras directly after mode combined with options
authorHans de Goede <hdegoede@redhat.com>
Mon, 18 Nov 2019 15:51:25 +0000 (16:51 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 16 Dec 2019 11:13:17 +0000 (12:13 +0100)
Before this commit it was impossible to combine an extra mode argument
specified directly after the resolution with an option, e.g.
video=HDMI-1:720x480e,rotate=180 would not work, either the "e" to force
enable would need to be dropped or the ",rotate=180", otherwise the
mode_option would not be accepted.

This commit fixes this by setting parse_extras to true in this case, so
that drm_mode_parse_cmdline_res_mode() parses the extra arguments directly
after the resolution.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191118155134.30468-4-hdegoede@redhat.com
drivers/gpu/drm/drm_modes.c
drivers/gpu/drm/selftests/drm_cmdline_selftests.h
drivers/gpu/drm/selftests/test-drm_cmdline_parser.c

index a8aa7955fd45892125e63e4cdeb6ad2daa353190..f49401124727385419ecfb02a9a3d11e43d6e51a 100644 (file)
@@ -1794,6 +1794,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
                mode_end = refresh_off;
        } else if (options_ptr) {
                mode_end = options_off;
+               parse_extras = true;
        } else {
                mode_end = strlen(name);
                parse_extras = true;
index ca1fc7a789535aebd2d4b03e41561d803ad1d9b0..003e2c3ffc39de5ff7cf7d4a5333d5701741307f 100644 (file)
@@ -61,3 +61,4 @@ cmdline_test(drm_cmdline_test_margin_options)
 cmdline_test(drm_cmdline_test_multiple_options)
 cmdline_test(drm_cmdline_test_invalid_option)
 cmdline_test(drm_cmdline_test_bpp_extra_and_option)
+cmdline_test(drm_cmdline_test_extra_and_option)
index 5b8dea9222576588a713010ceed4a330548d2d99..bc4db017e993b5ba3d7f8f016a7c3b6998be02e6 100644 (file)
@@ -1018,6 +1018,30 @@ static int drm_cmdline_test_bpp_extra_and_option(void *ignored)
        return 0;
 }
 
+static int drm_cmdline_test_extra_and_option(void *ignored)
+{
+       struct drm_cmdline_mode mode = { };
+
+       FAIL_ON(!drm_mode_parse_command_line_for_connector("720x480e,rotate=180",
+                                                          &no_connector,
+                                                          &mode));
+       FAIL_ON(!mode.specified);
+       FAIL_ON(mode.xres != 720);
+       FAIL_ON(mode.yres != 480);
+       FAIL_ON(mode.rotation_reflection != DRM_MODE_ROTATE_180);
+
+       FAIL_ON(mode.refresh_specified);
+       FAIL_ON(mode.bpp_specified);
+
+       FAIL_ON(mode.rb);
+       FAIL_ON(mode.cvt);
+       FAIL_ON(mode.interlace);
+       FAIL_ON(mode.margins);
+       FAIL_ON(mode.force != DRM_FORCE_ON);
+
+       return 0;
+}
+
 #include "drm_selftest.c"
 
 static int __init test_drm_cmdline_init(void)