Skip to contentSkip to conversation

drm/modes: parse_cmdline: Add support for specifying panel_orientation on the kernel cmdline

PATCH Superseded Hans de Goede 4 participants 25 messages Nov 10, 2019 – Nov 13, 2019

Subsystems (6)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover drm/modes: parse_cmdline: Add support for specifying panel_orientation on the kernel cmdline

Hi All,

I've been thinking about adding support for overriding a connector's panel-orientation from the kernel commandline from a while now. Both for testing and for special cases, e.g. a kiosk like setup which uses a TV mounted in portrait mode.

Then this plymouth merge-req came in:
"Force display orientation using configuration file"
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/83

Which was the trigger for me to actually do this. This turned out to be a bit more work then expected as I wanted users to be able to specify the new "panel_orientation" option as a freestanding option, without needing to prefix a resolution; and when working on that I stumbled over various things which could be improved in the cmdline parsing code.

This patch-seet is the end result of all this. Amongst other tests, it has been tested with the test-drm_cmdline_parser.ko selftest and it adds some new tests to that in some of the patches.

Regards,

Hans

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

PATCH 1/12 drm/modes: parse_cmdline: Fix possible reference past end of string

Before this commit, if the last option of a video=... option is for example "rotate" without a "=<value>" after it then delim will point to the terminating 0 of the string, and value which is sets to <delim + 1> will point one position past the end of the string.

This commit fixes this by enforcing that the contents of delim equals '=' as it should be for options which take a value, this check is done in a new drm_mode_parse_cmdline_int helper function which factors out the common integer parsing code for all the options which take an int.

---
 drivers/gpu/drm/drm_modes.c | 68 ++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 38 deletions(-)
drivers/gpu/drm/drm_modes.c +30 -38
index 88232698d7a0..3c3c7435225f 100644
@@ -1568,11 +1568,34 @@ static int drm_mode_parse_cmdline_res_mode(const char *str, unsigned int length,
 	return 0;
 }
 
+static int drm_mode_parse_cmdline_int(const char *delim, unsigned int *int_ret)
+{
+	const char *value;
+	char *endp;
+
+	/*
+	 * delim must point to the '=', otherwise it is a syntax error and
+	 * if delim points to the terminating zero, then delim + 1 wil point
+	 * past the end of the string.
+	 */
+	if (*delim != '=')
+		return -EINVAL;
+
+	value = delim + 1;
+	*int_ret = simple_strtol(value, &endp, 10);
+
+	/* Make sure we have parsed something */
+	if (endp == value)
+		return -EINVAL;
+
+	return 0;
+}
+
 static int drm_mode_parse_cmdline_options(char *str, size_t len,
 					  const struct drm_connector *connector,
 					  struct drm_cmdline_mode *mode)
 {
-	unsigned int rotation = 0;
+	unsigned int deg, margin, rotation = 0;
 	char *sep = str;
 
 	while ((sep = strchr(sep, ','))) {
@@ -1588,13 +1611,7 @@ static int drm_mode_parse_cmdline_options(char *str, size_t len,
 		}
 
 		if (!strncmp(option, "rotate", delim - option)) {
-			const char *value = delim + 1;
-			unsigned int deg;
-
-			deg = simple_strtol(value, &sep, 10);
-
-			/* Make sure we have parsed something */
-			if (sep == value)
+			if (drm_mode_parse_cmdline_int(delim, &deg))
 				return -EINVAL;
 
 			switch (deg) {
@@ -1619,57 +1636,32 @@ static int drm_mode_parse_cmdline_options(char *str, size_t len,
 			}
 		} else if (!strncmp(option, "reflect_x", delim - option)) {
 			rotation |= DRM_MODE_REFLECT_X;
-			sep = delim;
 		} else if (!strncmp(option, "reflect_y", delim - option)) {
 			rotation |= DRM_MODE_REFLECT_Y;
-			sep = delim;
 		} else if (!strncmp(option, "margin_right", delim - option)) {
-			const char *value = delim + 1;
-			unsigned int margin;
-
-			margin = simple_strtol(value, &sep, 10);
-
-			/* Make sure we have parsed something */
-			if (sep == value)
+			if (drm_mode_parse_cmdline_int(delim, &margin))
 				return -EINVAL;
 
 			mode->tv_margins.right = margin;
 		} else if (!strncmp(option, "margin_left", delim - option)) {
-			const char *value = delim + 1;
-			unsigned int margin;
-
-			margin = simple_strtol(value, &sep, 10);
-
-			/* Make sure we have parsed something */
-			if (sep == value)
+			if (drm_mode_parse_cmdline_int(delim, &margin))
 				return -EINVAL;
 
 			mode->tv_margins.left = margin;
 		} else if (!strncmp(option, "margin_top", delim - option)) {
-			const char *value = delim + 1;
-			unsigned int margin;
-
-			margin = simple_strtol(value, &sep, 10);
-
-			/* Make sure we have parsed something */
-			if (sep == value)
+			if (drm_mode_parse_cmdline_int(delim, &margin))
 				return -EINVAL;
 
 			mode->tv_margins.top = margin;
 		} else if (!strncmp(option, "margin_bottom", delim - option)) {
-			const char *value = delim + 1;
-			unsigned int margin;
-
-			margin = simple_strtol(value, &sep, 10);
-
-			/* Make sure we have parsed something */
-			if (sep == value)
+			if (drm_mode_parse_cmdline_int(delim, &margin))
 				return -EINVAL;
 
 			mode->tv_margins.bottom = margin;
 		} else {
 			return -EINVAL;
 		}
+		sep = delim;
 	}
 
 	mode->rotation_reflection = rotation;
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 2/12 drm/modes: parse_cmdline: Make various char pointers const

In reply to Hans de Goede

We are not supposed to modify the passed in string, make char pointers used in drm_mode_parse_cmdline_options() const char * where possible.

---
 drivers/gpu/drm/drm_modes.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_modes.c +5 -5
index 3c3c7435225f..654d4b6fecb3 100644
@@ -1591,15 +1591,15 @@ static int drm_mode_parse_cmdline_int(const char *delim, unsigned int *int_ret)
 	return 0;
 }
 
-static int drm_mode_parse_cmdline_options(char *str, size_t len,
+static int drm_mode_parse_cmdline_options(const char *str, size_t len,
 					  const struct drm_connector *connector,
 					  struct drm_cmdline_mode *mode)
 {
 	unsigned int deg, margin, rotation = 0;
-	char *sep = str;
+	const char *sep = str;
 
 	while ((sep = strchr(sep, ','))) {
-		char *delim, *option;
+		const char *delim, *option;
 
 		option = sep + 1;
 		delim = strchr(option, '=');
@@ -1718,8 +1718,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 	bool named_mode = false, parse_extras = false;
 	unsigned int bpp_off = 0, refresh_off = 0, options_off = 0;
 	unsigned int mode_end = 0;
-	char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = NULL;
-	char *options_ptr = NULL;
+	const char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = NULL;
+	const char *options_ptr = NULL;
 	char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL;
 	int ret;
 
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH 3/12 drm/modes: parse_cmdline: Stop parsing extras after bpp / refresh at ', '

In reply to Hans de Goede

Before this commit it was impossible to add an extra mode argument after a bpp or refresh specifier, combined with an option, e.g. video=HDMI-1:720x480-24e,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 fixing the length calculation if extras_ptr is set to stop the extra parsing at the start of the options (stop at the ',' options_ptr points to).

---
 drivers/gpu/drm/drm_modes.c                   | 10 ++++---
 .../gpu/drm/selftests/drm_cmdline_selftests.h |  1 +
 .../drm/selftests/test-drm_cmdline_parser.c   | 26 +++++++++++++++++++
 3 files changed, 33 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_modes.c +6 -4
index 654d4b6fecb3..a8aa7955fd45 100644
@@ -1721,7 +1721,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 	const char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = NULL;
 	const char *options_ptr = NULL;
 	char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL;
-	int ret;
+	int i, len, ret;
 
 #ifdef CONFIG_FB
 	if (!mode_option)
@@ -1841,9 +1841,11 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 	else if (refresh_ptr)
 		extra_ptr = refresh_end_ptr;
 
-	if (extra_ptr &&
-	    extra_ptr != options_ptr) {
-		int len = strlen(name) - (extra_ptr - name);
+	if (extra_ptr) {
+		if (options_ptr)
+			len = options_ptr - extra_ptr;
+		else
+			len = strlen(extra_ptr);
 
 		ret = drm_mode_parse_cmdline_extra(extra_ptr, len, false,
 						   connector, mode);
drivers/gpu/drm/selftests/drm_cmdline_selftests.h +1 -0
index 6d61a0eb5d64..ca1fc7a78953 100644
@@ -60,3 +60,4 @@ cmdline_test(drm_cmdline_test_vmirror)
 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)
drivers/gpu/drm/selftests/test-drm_cmdline_parser.c +26 -0
index 013de9d27c35..5b8dea922257 100644
@@ -992,6 +992,32 @@ static int drm_cmdline_test_invalid_option(void *ignored)
 	return 0;
 }
 
+static int drm_cmdline_test_bpp_extra_and_option(void *ignored)
+{
+	struct drm_cmdline_mode mode = { };
+
+	FAIL_ON(!drm_mode_parse_command_line_for_connector("720x480-24e,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.bpp != 24);
+
+	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)
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

PATCH 4/12 drm/modes: parse_cmdline: Accept extras directly after mode combined with options

In reply to Hans de Goede

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.

---
 drivers/gpu/drm/drm_modes.c                   |  1 +
 .../gpu/drm/selftests/drm_cmdline_selftests.h |  1 +
 .../drm/selftests/test-drm_cmdline_parser.c   | 24 +++++++++++++++++++
 3 files changed, 26 insertions(+)
drivers/gpu/drm/drm_modes.c +1 -0
index a8aa7955fd45..f49401124727 100644
@@ -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;
drivers/gpu/drm/selftests/drm_cmdline_selftests.h +1 -0
index ca1fc7a78953..003e2c3ffc39 100644
@@ -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)
drivers/gpu/drm/selftests/test-drm_cmdline_parser.c +24 -0
index 5b8dea922257..bc4db017e993 100644
@@ -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)
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

PATCH 5/12 drm/modes: parse_cmdline: Rework drm_mode_parse_cmdline_options()

In reply to Hans de Goede

Refactor drm_mode_parse_cmdline_options() so that it takes a pointer to the first option, rather then a pointer to the ',' before the first option.

This is a preparation patch for allowing parsing of stand-alone options without a mode before them, e.g.: video=HDMI-1:margin_right=14,...

---
 drivers/gpu/drm/drm_modes.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_modes.c +9 -12
index f49401124727..25e8edf4cfb8 100644
@@ -1591,23 +1591,21 @@ static int drm_mode_parse_cmdline_int(const char *delim, unsigned int *int_ret)
 	return 0;
 }
 
-static int drm_mode_parse_cmdline_options(const char *str, size_t len,
+static int drm_mode_parse_cmdline_options(const char *str,
 					  const struct drm_connector *connector,
 					  struct drm_cmdline_mode *mode)
 {
 	unsigned int deg, margin, rotation = 0;
-	const char *sep = str;
+	const char *delim, *option, *sep;
 
-	while ((sep = strchr(sep, ','))) {
-		const char *delim, *option;
-
-		option = sep + 1;
+	option = str;
+	do {
 		delim = strchr(option, '=');
 		if (!delim) {
 			delim = strchr(option, ',');
 
 			if (!delim)
-				delim = str + len;
+				delim = option + strlen(option);
 		}
 
 		if (!strncmp(option, "rotate", delim - option)) {
@@ -1661,8 +1659,9 @@ static int drm_mode_parse_cmdline_options(const char *str, size_t len,
 		} else {
 			return -EINVAL;
 		}
-		sep = delim;
-	}
+		sep = strchr(delim, ',');
+		option = sep + 1;
+	} while (sep);
 
 	mode->rotation_reflection = rotation;
 
@@ -1855,9 +1854,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 	}
 
 	if (options_ptr) {
-		int len = strlen(name) - (options_ptr - name);
-
-		ret = drm_mode_parse_cmdline_options(options_ptr, len,
+		ret = drm_mode_parse_cmdline_options(options_ptr + 1,
 						     connector, mode);
 		if (ret)
 			return false;
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

PATCH 6/12 drm/modes: parse_cmdline: Add freestanding argument to drm_mode_parse_cmdline_options()

In reply to Hans de Goede

Add a freestanding function argument to drm_mode_parse_cmdline_options() similar to how drm_mode_parse_cmdline_extra() already has this.

This is a preparation patch for allowing parsing of stand-alone options without a mode before them, e.g.: video=HDMI-1:margin_right=14,...

---
 drivers/gpu/drm/drm_modes.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/drm_modes.c +5 -0
index 25e8edf4cfb8..80cb247c83c7 100644
@@ -1592,6 +1592,7 @@ static int drm_mode_parse_cmdline_int(const char *delim, unsigned int *int_ret)
 }
 
 static int drm_mode_parse_cmdline_options(const char *str,
+					  bool freestanding,
 					  const struct drm_connector *connector,
 					  struct drm_cmdline_mode *mode)
 {
@@ -1663,6 +1664,9 @@ static int drm_mode_parse_cmdline_options(const char *str,
 		option = sep + 1;
 	} while (sep);
 
+	if (rotation && freestanding)
+		return -EINVAL;
+
 	mode->rotation_reflection = rotation;
 
 	return 0;
@@ -1855,6 +1859,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 
 	if (options_ptr) {
 		ret = drm_mode_parse_cmdline_options(options_ptr + 1,
+						     false,
 						     connector, mode);
 		if (ret)
 			return false;
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

PATCH 7/12 drm/modes: parse_cmdline: Set bpp/refresh_specified after successful parsing

In reply to Hans de Goede

drm_connector_get_cmdline_mode() calls drm_mode_parse_command_line_for_connector() with &connector->cmdline_mode as mode argument, so anything which we store in the mode arguments gets kept even if we return false.

Avoid storing a possibly false-postive bpp/refresh_specified setting in connector->cmdline_mode by moving the setting of these to after successful parsing of the bpp/refresh parts of the video= argument.

---
 drivers/gpu/drm/drm_modes.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_modes.c +5 -4
index 80cb247c83c7..72828fa9fc91 100644
@@ -1771,10 +1771,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 
 	/* Try to locate the bpp and refresh specifiers, if any */
 	bpp_ptr = strchr(name, '-');
-	if (bpp_ptr) {
+	if (bpp_ptr)
 		bpp_off = bpp_ptr - name;
-		mode->bpp_specified = true;
-	}
 
 	refresh_ptr = strchr(name, '@');
 	if (refresh_ptr) {
@@ -1782,7 +1780,6 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 			return false;
 
 		refresh_off = refresh_ptr - name;
-		mode->refresh_specified = true;
 	}
 
 	/* Locate the start of named options */
@@ -1825,6 +1822,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 		ret = drm_mode_parse_cmdline_bpp(bpp_ptr, &bpp_end_ptr, mode);
 		if (ret)
 			return false;
+
+		mode->bpp_specified = true;
 	}
 
 	if (refresh_ptr) {
@@ -1832,6 +1831,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 						     &refresh_end_ptr, mode);
 		if (ret)
 			return false;
+
+		mode->refresh_specified = true;
 	}
 
 	/*
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

PATCH 8/12 drm/modes: parse_cmdline: Allow specifying stand-alone options

In reply to Hans de Goede

Some options which can be specified on the commandline, such as margin_right=..., margin_left=..., etc. are applied not only to the specified mode, but to all modes. As such it would be nice if the user can simply say e.g. video=HDMI-1:margin_right=14,margin_left=24,margin_bottom=36,margin_top=42

This commit refactors drm_mode_parse_command_line_for_connector() to add support for this, and as a nice side effect also cleans up the function a bit.

---
 drivers/gpu/drm/drm_modes.c                   | 92 +++++++------------
 .../gpu/drm/selftests/drm_cmdline_selftests.h |  2 +
 .../drm/selftests/test-drm_cmdline_parser.c   | 50 ++++++++++
 3 files changed, 86 insertions(+), 58 deletions(-)
drivers/gpu/drm/drm_modes.c +34 -58
index 72828fa9fc91..2e82603f5d0a 100644
@@ -1677,17 +1677,6 @@ static const char * const drm_named_modes_whitelist[] = {
 	"PAL",
 };
 
-static bool drm_named_mode_is_in_whitelist(const char *mode, unsigned int size)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++)
-		if (!strncmp(mode, drm_named_modes_whitelist[i], size))
-			return true;
-
-	return false;
-}
-
 /**
  * drm_mode_parse_command_line_for_connector - parse command line modeline for connector
  * @mode_option: optional per connector mode option
@@ -1718,7 +1707,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 					       struct drm_cmdline_mode *mode)
 {
 	const char *name;
-	bool named_mode = false, parse_extras = false;
+	bool freestanding = false, parse_extras = false;
 	unsigned int bpp_off = 0, refresh_off = 0, options_off = 0;
 	unsigned int mode_end = 0;
 	const char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = NULL;
@@ -1738,49 +1727,14 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 
 	name = mode_option;
 
-	/*
-	 * This is a bit convoluted. To differentiate between the
-	 * named modes and poorly formatted resolutions, we need a
-	 * bunch of things:
-	 *   - We need to make sure that the first character (which
-	 *     would be our resolution in X) is a digit.
-	 *   - If not, then it's either a named mode or a force on/off.
-	 *     To distinguish between the two, we need to run the
-	 *     extra parsing function, and if not, then we consider it
-	 *     a named mode.
-	 *
-	 * If this isn't enough, we should add more heuristics here,
-	 * and matching unit-tests.
-	 */
-	if (!isdigit(name[0]) && name[0] != 'x') {
-		unsigned int namelen = strlen(name);
-
-		/*
-		 * Only the force on/off options can be in that case,
-		 * and they all take a single character.
-		 */
-		if (namelen == 1) {
-			ret = drm_mode_parse_cmdline_extra(name, namelen, true,
-							   connector, mode);
-			if (!ret)
-				return true;
-		}
-
-		named_mode = true;
-	}
-
 	/* Try to locate the bpp and refresh specifiers, if any */
 	bpp_ptr = strchr(name, '-');
 	if (bpp_ptr)
 		bpp_off = bpp_ptr - name;
 
 	refresh_ptr = strchr(name, '@');
-	if (refresh_ptr) {
-		if (named_mode)
-			return false;
-
+	if (refresh_ptr)
 		refresh_off = refresh_ptr - name;
-	}
 
 	/* Locate the start of named options */
 	options_ptr = strchr(name, ',');
@@ -1800,23 +1754,45 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 		parse_extras = true;
 	}
 
-	if (named_mode) {
-		if (mode_end + 1 > DRM_DISPLAY_MODE_LEN)
-			return false;
+	/* First check for a named mode */
+	for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) {
+		ret = str_has_prefix(name, drm_named_modes_whitelist[i]);
+		if (ret == mode_end) {
+			if (refresh_ptr)
+				return false; /* named + refresh is invalid */
 
-		if (!drm_named_mode_is_in_whitelist(name, mode_end))
-			return false;
+			strcpy(mode->name, drm_named_modes_whitelist[i]);
+			mode->specified = true;
+			break;
+		}
+	}
 
-		strscpy(mode->name, name, mode_end + 1);
-	} else {
+	/* No named mode? Check for a normal mode argument, e.g. 1024x768 */
+	if (!mode->specified && isdigit(name[0])) {
 		ret = drm_mode_parse_cmdline_res_mode(name, mode_end,
 						      parse_extras,
 						      connector,
 						      mode);
 		if (ret)
 			return false;
+
+		mode->specified = true;
+	}
+
+	/* No mode? Check for freestanding extras and/or options */
+	if (!mode->specified) {
+		unsigned int len = strlen(mode_option);
+
+		if (bpp_ptr || refresh_ptr)
+			return false; /* syntax error */
+
+		if (len == 1 || (len >= 2 && mode_option[1] == ','))
+			extra_ptr = mode_option;
+		else
+			options_ptr = mode_option - 1;
+
+		freestanding = true;
 	}
-	mode->specified = true;
 
 	if (bpp_ptr) {
 		ret = drm_mode_parse_cmdline_bpp(bpp_ptr, &bpp_end_ptr, mode);
@@ -1852,7 +1828,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 		else
 			len = strlen(extra_ptr);
 
-		ret = drm_mode_parse_cmdline_extra(extra_ptr, len, false,
+		ret = drm_mode_parse_cmdline_extra(extra_ptr, len, freestanding,
 						   connector, mode);
 		if (ret)
 			return false;
@@ -1860,7 +1836,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 
 	if (options_ptr) {
 		ret = drm_mode_parse_cmdline_options(options_ptr + 1,
-						     false,
+						     freestanding,
 						     connector, mode);
 		if (ret)
 			return false;
drivers/gpu/drm/selftests/drm_cmdline_selftests.h +2 -0
index 003e2c3ffc39..aee92ac2cc21 100644
@@ -62,3 +62,5 @@ 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)
+cmdline_test(drm_cmdline_test_freestanding_options)
+cmdline_test(drm_cmdline_test_freestanding_force_e_and_options)
drivers/gpu/drm/selftests/test-drm_cmdline_parser.c +50 -0

56 lines not on this page · raw message

Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

PATCH 9/12 drm/modes: parse_cmdline: Add support for specifying panel_orientation

In reply to Hans de Goede

Sometimes we want to override a connector's panel_orientation from the kernel commandline. Either for testing and for special cases, e.g. a kiosk like setup which uses a TV mounted in portrait mode.

Users can already specify a "rotate" option through a video= kernel cmdline option. But that only supports 0/180 degrees (see drm_client_modeset TODO) and only works for in kernel modeset clients, not for userspace kms users.

The "panel-orientation" connector property OTOH does support 90/270 degrees as it leaves dealing with the rotation up to userspace and this does work for userspace kms clients (at least those which support this property).

---
 Documentation/fb/modedb.rst                   |  3 ++
 drivers/gpu/drm/drm_modes.c                   | 32 +++++++++++++++++++
 .../gpu/drm/selftests/drm_cmdline_selftests.h |  1 +
 .../drm/selftests/test-drm_cmdline_parser.c   | 22 +++++++++++++
 include/drm/drm_connector.h                   |  8 +++++
 5 files changed, 66 insertions(+)
Documentation/fb/modedb.rst +3 -0
index 9c4e3fd39e6d..624d08fd2856 100644
@@ -65,6 +65,9 @@ Valid options are::
   - reflect_y (boolean): Perform an axial symmetry on the Y axis
   - rotate (integer): Rotate the initial framebuffer by x
     degrees. Valid values are 0, 90, 180 and 270.
+  - panel_orientation, one of "normal", "upside_down", "left_side_up", or
+    "right_side_up". For KMS drivers only, this sets the "panel orientation"
+    property on the kms connector as hint for kms users.
 
 
 -----------------------------------------------------------------------------
drivers/gpu/drm/drm_modes.c +32 -0
index 2e82603f5d0a..119fed7ab815 100644
@@ -1591,6 +1591,33 @@ static int drm_mode_parse_cmdline_int(const char *delim, unsigned int *int_ret)
 	return 0;
 }
 
+static int drm_mode_parse_panel_orientation(const char *delim,
+					    struct drm_cmdline_mode *mode)
+{
+	const char *value;
+
+	if (*delim != '=')
+		return -EINVAL;
+
+	value = delim + 1;
+	delim = strchr(value, ',');
+	if (!delim)
+		delim = value + strlen(value);
+
+	if (!strncmp(value, "normal", delim - value))
+		mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
+	else if (!strncmp(value, "upside_down", delim - value))
+		mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
+	else if (!strncmp(value, "left_side_up", delim - value))
+		mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
+	else if (!strncmp(value, "right_side_up", delim - value))
+		mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
+	else
+		return -EINVAL;
+
+	return 0;
+}
+
 static int drm_mode_parse_cmdline_options(const char *str,
 					  bool freestanding,
 					  const struct drm_connector *connector,
@@ -1657,6 +1684,9 @@ static int drm_mode_parse_cmdline_options(const char *str,
 				return -EINVAL;
 
 			mode->tv_margins.bottom = margin;
+		} else if (!strncmp(option, "panel_orientation", delim - option)) {
+			if (drm_mode_parse_panel_orientation(delim, mode))
+				return -EINVAL;
 		} else {
 			return -EINVAL;
 		}
@@ -1715,6 +1745,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 	char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL;
 	int i, len, ret;
 
+	mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+
 #ifdef CONFIG_FB
 	if (!mode_option)
 		mode_option = fb_mode_option;
drivers/gpu/drm/selftests/drm_cmdline_selftests.h +1 -0
index aee92ac2cc21..ceac7af9a172 100644
@@ -64,3 +64,4 @@ cmdline_test(drm_cmdline_test_bpp_extra_and_option)
 cmdline_test(drm_cmdline_test_extra_and_option)
 cmdline_test(drm_cmdline_test_freestanding_options)
 cmdline_test(drm_cmdline_test_freestanding_force_e_and_options)
+cmdline_test(drm_cmdline_test_panel_orientation)
drivers/gpu/drm/selftests/test-drm_cmdline_parser.c +22 -0
index 8248d4aa5aaa..520f3e66a384 100644
@@ -1092,6 +1092,28 @@ static int drm_cmdline_test_freestanding_force_e_and_options(void *ignored)
 	return 0;
 }
 
+static int drm_cmdline_test_panel_orientation(void *ignored)
+{
+	struct drm_cmdline_mode mode = { };
+
+	FAIL_ON(!drm_mode_parse_command_line_for_connector("panel_orientation=upside_down",
+							   &no_connector,
+							   &mode));
+	FAIL_ON(mode.specified);
+	FAIL_ON(mode.refresh_specified);
+	FAIL_ON(mode.bpp_specified);
+
+	FAIL_ON(mode.panel_orientation != DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP);
+
+	FAIL_ON(mode.rb);
+	FAIL_ON(mode.cvt);
+	FAIL_ON(mode.interlace);
+	FAIL_ON(mode.margins);
+	FAIL_ON(mode.force != DRM_FORCE_UNSPECIFIED);
+
+	return 0;
+}
+
 #include "drm_selftest.c"
 
 static int __init test_drm_cmdline_init(void)
include/drm/drm_connector.h +8 -0
index 681cb590f952..e60bb3602497 100644
@@ -1065,6 +1065,14 @@ struct drm_cmdline_mode {
 	 */
 	unsigned int rotation_reflection;
 
+	/**
+	 * @panel_orientation
+	 *
+	 * drm-connector "panel orientation" property override value,
+	 * DRM_MODE_PANEL_ORIENTATION_UNKNOWN if not set.
+	 */
+	enum drm_panel_orientation panel_orientation;
+
 	/**
 	 * @tv_margins: TV margins to apply to the mode.
 	 */
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Acked-by on v1 9/12
#10 lore raw

Re: [PATCH 09/12] drm/modes: parse_cmdline: Add support for specifying panel_orientation

Hi Hans,

Thanks for this series (and thanks for bouncing the mails too).

All the previous patches are

Quoted 27 lines · Hans de Goede

Sometimes we want to override a connector's panel_orientation from the kernel commandline. Either for testing and for special cases, e.g. a kiosk like setup which uses a TV mounted in portrait mode.

Users can already specify a "rotate" option through a video= kernel cmdline option. But that only supports 0/180 degrees (see drm_client_modeset TODO) and only works for in kernel modeset clients, not for userspace kms users.

The "panel-orientation" connector property OTOH does support 90/270 degrees as it leaves dealing with the rotation up to userspace and this does work for userspace kms clients (at least those which support this property).

---
 Documentation/fb/modedb.rst                   |  3 ++
 drivers/gpu/drm/drm_modes.c                   | 32 +++++++++++++++++++
 .../gpu/drm/selftests/drm_cmdline_selftests.h |  1 +
 .../drm/selftests/test-drm_cmdline_parser.c   | 22 +++++++++++++
 include/drm/drm_connector.h                   |  8 +++++
 5 files changed, 66 insertions(+)
Documentation/fb/modedb.rst +0 -0
index 9c4e3fd39e6d..624d08fd2856 100644

Documentation/fb/modedb.rst Valid options are:: · line 70

Quoted 6 lines
Documentation/fb/modedb.rst +3 -0
@@ -65,6 +65,9 @@ Valid options are::
   - reflect_y (boolean): Perform an axial symmetry on the Y axis
   - rotate (integer): Rotate the initial framebuffer by x
     degrees. Valid values are 0, 90, 180 and 270.
+  - panel_orientation, one of "normal", "upside_down", "left_side_up", or
+    "right_side_up". For KMS drivers only, this sets the "panel orientation"
+    property on the kms connector as hint for kms users.

Even though the semantic is a bit different, I think we should remain consistent and have the same argument than for rotate (ie, steps in clockwise rotation in steps of 90 degrees).

The rest looks good

Maxime

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw

Re: [PATCH 09/12] drm/modes: parse_cmdline: Add support for specifying panel_orientation

Hi,

Quoted 6 lines · Maxime Ripard

Hi Hans,

Thanks for this series (and thanks for bouncing the mails too).

All the previous patches are

Thank you for the review.

Quoted 23 lines · Hans de Goede
Quoted 22 lines

Sometimes we want to override a connector's panel_orientation from the kernel commandline. Either for testing and for special cases, e.g. a kiosk like setup which uses a TV mounted in portrait mode.

Users can already specify a "rotate" option through a video= kernel cmdline option. But that only supports 0/180 degrees (see drm_client_modeset TODO) and only works for in kernel modeset clients, not for userspace kms users.

The "panel-orientation" connector property OTOH does support 90/270 degrees as it leaves dealing with the rotation up to userspace and this does work for userspace kms clients (at least those which support this property).

---
  Documentation/fb/modedb.rst                   |  3 ++
  drivers/gpu/drm/drm_modes.c                   | 32 +++++++++++++++++++
  .../gpu/drm/selftests/drm_cmdline_selftests.h |  1 +
  .../drm/selftests/test-drm_cmdline_parser.c   | 22 +++++++++++++
  include/drm/drm_connector.h                   |  8 +++++
  5 files changed, 66 insertions(+)
Quoted 15 lines

Documentation/fb/modedb.rst Valid options are:: · line 70

Quoted 11 lines
Documentation/fb/modedb.rst +3 -0
index 9c4e3fd39e6d..624d08fd2856 100644
@@ -65,6 +65,9 @@ Valid options are::
    - reflect_y (boolean): Perform an axial symmetry on the Y axis
    - rotate (integer): Rotate the initial framebuffer by x
      degrees. Valid values are 0, 90, 180 and 270.
+  - panel_orientation, one of "normal", "upside_down", "left_side_up", or
+    "right_side_up". For KMS drivers only, this sets the "panel orientation"
+    property on the kms connector as hint for kms users.

Even though the semantic is a bit different, I think we should remain consistent and have the same argument than for rotate (ie, steps in clockwise rotation in steps of 90 degrees).

Well the kernel kms defines for rotation also talk about 90 / 180 / 270":

#define DRM_MODE_ROTATE_0       (1<<0)
#define DRM_MODE_ROTATE_90      (1<<1)
#define DRM_MODE_ROTATE_180     (1<<2)
#define DRM_MODE_ROTATE_270     (1<<3)

Where as the panel orientation uses strings like right_side_up, which means that the side of the panel which normally is the right side of the panel is now pointing up as the panel is mounted 90 degrees rotated with its original right side now pointing up. This IMHO is much clearer then 90 / 270 degrees which are ambiguous and perhaps more importantly this matches the kernel defines for panel-orientation and matches the String values enumerated by the enum type panel-orientation connector property:

static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {

        { DRM_MODE_PANEL_ORIENTATION_NORMAL,    "Normal"        },
        { DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, "Upside Down"   },
        { DRM_MODE_PANEL_ORIENTATION_LEFT_UP,   "Left Side Up"  },

{ DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, "Right Side Up" },
};

So I would prefer to stick to the strings.

Regards,

Hans

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#12 lore raw

Re: [PATCH 09/12] drm/modes: parse_cmdline: Add support for specifying panel_orientation

Quoted 67 lines · Hans de Goede

Hi,

Quoted 6 lines · Maxime Ripard

Hi Hans,

Thanks for this series (and thanks for bouncing the mails too).

All the previous patches are

Thank you for the review.

Quoted 23 lines · Hans de Goede
Quoted 22 lines

Sometimes we want to override a connector's panel_orientation from the kernel commandline. Either for testing and for special cases, e.g. a kiosk like setup which uses a TV mounted in portrait mode.

Users can already specify a "rotate" option through a video= kernel cmdline option. But that only supports 0/180 degrees (see drm_client_modeset TODO) and only works for in kernel modeset clients, not for userspace kms users.

The "panel-orientation" connector property OTOH does support 90/270 degrees as it leaves dealing with the rotation up to userspace and this does work for userspace kms clients (at least those which support this property).

---
  Documentation/fb/modedb.rst                   |  3 ++
  drivers/gpu/drm/drm_modes.c                   | 32 +++++++++++++++++++
  .../gpu/drm/selftests/drm_cmdline_selftests.h |  1 +
  .../drm/selftests/test-drm_cmdline_parser.c   | 22 +++++++++++++
  include/drm/drm_connector.h                   |  8 +++++
  5 files changed, 66 insertions(+)
Quoted 15 lines

Documentation/fb/modedb.rst Valid options are:: · line 70

Quoted 11 lines
Documentation/fb/modedb.rst +3 -0
index 9c4e3fd39e6d..624d08fd2856 100644
@@ -65,6 +65,9 @@ Valid options are::
    - reflect_y (boolean): Perform an axial symmetry on the Y axis
    - rotate (integer): Rotate the initial framebuffer by x
      degrees. Valid values are 0, 90, 180 and 270.
+  - panel_orientation, one of "normal", "upside_down", "left_side_up", or
+    "right_side_up". For KMS drivers only, this sets the "panel orientation"
+    property on the kms connector as hint for kms users.

Even though the semantic is a bit different, I think we should remain consistent and have the same argument than for rotate (ie, steps in clockwise rotation in steps of 90 degrees).

Well the kernel kms defines for rotation also talk about 90 / 180 / 270":

#define DRM_MODE_ROTATE_0       (1<<0)
#define DRM_MODE_ROTATE_90      (1<<1)
#define DRM_MODE_ROTATE_180     (1<<2)
#define DRM_MODE_ROTATE_270     (1<<3)

Where as the panel orientation uses strings like right_side_up, which means that the side of the panel which normally is the right side of the panel is now pointing up as the panel is mounted 90 degrees rotated with its original right side now pointing up. This IMHO is much clearer then 90 / 270 degrees which are ambiguous and perhaps more importantly this matches the kernel defines for panel-orientation and matches the String values enumerated by the enum type panel-orientation connector property:

Quoted 8 lines

static const struct drm_prop_enum_list drm_panel_orientation_enum_list[] = {

        { DRM_MODE_PANEL_ORIENTATION_NORMAL,    "Normal"        },
        { DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP, "Upside Down"   },
        { DRM_MODE_PANEL_ORIENTATION_LEFT_UP,   "Left Side Up"  },

{ DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, "Right Side Up" },
};

So I would prefer to stick to the strings.

Ok, that works for me then

Maxime

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#13 lore raw

Re: [PATCH 09/12] drm/modes: parse_cmdline: Add support for specifying panel_orientation

In reply to Hans de Goede
I love your patch! Perhaps something to improve:

Hi Hans,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v5.4-rc7 next-20191112]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Hans-de-Goede/drm-modes-parse_cmdline-Add-support-for-specifying-panel_orientation-on-the-kernel-cmdline/20191112-173153
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
reproduce: make htmldocs

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

Warning: The Sphinx 'sphinx_rtd_theme' HTML theme was not found. Make sure you have the theme installed to produce pretty HTML output. Falling back to the default theme.
WARNING: dot(1) not found, for better output quality install graphviz from http://www.graphviz.org
WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
include/linux/regulator/machine.h:196: warning: Function parameter or member 'max_uV_step' not described in 'regulation_constraints' include/linux/regulator/driver.h:223: warning: Function parameter or member 'resume' not described in 'regulator_ops' include/linux/i2c.h:337: warning: Function parameter or member 'init_irq' not described in 'i2c_client'
drivers/gpio/gpiolib-of.c:92: warning: Excess function parameter 'dev' description in 'of_gpio_need_valid_mask'
include/linux/spi/spi.h:190: warning: Function parameter or member 'driver_override' not described in 'spi_device'
mm/util.c:1: warning: 'get_user_pages_fast' not found
drivers/usb/typec/bus.c:1: warning: 'typec_altmode_register_driver' not found
drivers/usb/typec/bus.c:1: warning: 'typec_altmode_unregister_driver' not found
drivers/usb/typec/class.c:1: warning: 'typec_altmode_register_notifier' not found
drivers/usb/typec/class.c:1: warning: 'typec_altmode_unregister_notifier' not found
include/linux/w1.h:277: warning: Function parameter or member 'of_match_table' not described in 'w1_family'
fs/posix_acl.c:647: warning: Function parameter or member 'inode' not described in 'posix_acl_update_mode'
fs/posix_acl.c:647: warning: Function parameter or member 'mode_p' not described in 'posix_acl_update_mode'
fs/posix_acl.c:647: warning: Function parameter or member 'acl' not described in 'posix_acl_update_mode'
kernel/dma/coherent.c:1: warning: no structured comments found
include/linux/input/sparse-keymap.h:43: warning: Function parameter or member 'sw' not described in 'key_entry' drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c:1: warning: no structured comments found
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1: warning: no structured comments found
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:254: warning: Function parameter or member 'hdcp_workqueue' not described in 'amdgpu_display_manager' lib/genalloc.c:1: warning: 'gen_pool_add_virt' not found
lib/genalloc.c:1: warning: 'gen_pool_alloc' not found
lib/genalloc.c:1: warning: 'gen_pool_free' not found
lib/genalloc.c:1: warning: 'gen_pool_alloc_algo' not found
include/linux/rculist.h:374: warning: Excess function parameter 'cond' description in 'list_for_each_entry_rcu'
include/linux/rculist.h:651: warning: Excess function parameter 'cond' description in 'hlist_for_each_entry_rcu'
include/net/cfg80211.h:1185: warning: Function parameter or member 'txpwr' not described in 'station_parameters'
include/net/mac80211.h:4056: warning: Function parameter or member 'sta_set_txpwr' not described in 'ieee80211_ops' include/net/mac80211.h:2018: warning: Function parameter or member 'txpwr' not described in 'ieee80211_sta'
include/drm/drm_connector.h:1074: warning: Incorrect use of kernel-doc format: * @panel_orientation

>> include/drm/drm_connector.h:1085: warning: Function parameter or member 'panel_orientation' not described in 'drm_cmdline_mode'

include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'prepare_writeback_job' not described in 'drm_connector_helper_funcs' include/drm/drm_modeset_helper_vtables.h:1052: warning: Function parameter or member 'cleanup_writeback_job' not described in 'drm_connector_helper_funcs' include/drm/drm_gem_shmem_helper.h:87: warning: Function parameter or member 'madv' not described in 'drm_gem_shmem_object' include/drm/drm_gem_shmem_helper.h:87: warning: Function parameter or member 'madv_list' not described in 'drm_gem_shmem_object' include/linux/skbuff.h:888: warning: Function parameter or member 'dev_scratch' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'list' not described in 'sk_buff'
include/linux/skbuff.h:888: warning: Function parameter or member 'ip_defrag_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'skb_mstamp_ns' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__cloned_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'head_frag' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_type_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'encapsulation' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'encap_hdr_csum' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_valid' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member '__pkt_vlan_present_offset' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'vlan_present' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_complete_sw' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'csum_level' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'inner_protocol_type' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'remcsum_offload' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'sender_cpu' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'reserved_tailroom' not described in 'sk_buff' include/linux/skbuff.h:888: warning: Function parameter or member 'inner_ipproto' not described in 'sk_buff' include/net/sock.h:233: warning: Function parameter or member 'skc_addrpair' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_portpair' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_ipv6only' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_net_refcnt' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_v6_daddr' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_v6_rcv_saddr' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_cookie' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_listener' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_tw_dr' not described in 'sock_common'
include/net/sock.h:233: warning: Function parameter or member 'skc_rcv_wnd' not described in 'sock_common' include/net/sock.h:233: warning: Function parameter or member 'skc_tw_rcv_nxt' not described in 'sock_common' include/net/sock.h:515: warning: Function parameter or member 'sk_rx_skb_cache' not described in 'sock'
include/net/sock.h:515: warning: Function parameter or member 'sk_wq_raw' not described in 'sock'
include/net/sock.h:515: warning: Function parameter or member 'tcp_rtx_queue' not described in 'sock'
include/net/sock.h:515: warning: Function parameter or member 'sk_tx_skb_cache' not described in 'sock'
include/net/sock.h:515: warning: Function parameter or member 'sk_route_forced_caps' not described in 'sock' include/net/sock.h:515: warning: Function parameter or member 'sk_txtime_report_errors' not described in 'sock' include/net/sock.h:515: warning: Function parameter or member 'sk_validate_xmit_skb' not described in 'sock' include/net/sock.h:515: warning: Function parameter or member 'sk_bpf_storage' not described in 'sock'
include/net/sock.h:2450: warning: Function parameter or member 'tcp_rx_skb_cache_key' not described in 'DECLARE_STATIC_KEY_FALSE' include/net/sock.h:2450: warning: Excess function parameter 'sk' description in 'DECLARE_STATIC_KEY_FALSE' include/net/sock.h:2450: warning: Excess function parameter 'skb' description in 'DECLARE_STATIC_KEY_FALSE' include/linux/netdevice.h:2053: warning: Function parameter or member 'gso_partial_features' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'l3mdev_ops' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'xfrmdev_ops' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'tlsdev_ops' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'name_assign_type' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'ieee802154_ptr' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'mpls_ptr' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'xdp_prog' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'gro_flush_timeout' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'nf_hooks_ingress' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member '____cacheline_aligned_in_smp' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'qdisc_hash' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'xps_cpus_map' not described in 'net_device' include/linux/netdevice.h:2053: warning: Function parameter or member 'xps_rxqs_map' not described in 'net_device' include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising' not described in 'phylink_link_state' include/linux/phylink.h:56: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising' not described in 'phylink_link_state' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'quotactl' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'quota_on' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'sb_free_mnt_opts' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'sb_eat_lsm_opts' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'sb_kern_mount' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'sb_show_options' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'sb_add_mnt_opt' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'd_instantiate' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'getprocattr' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'setprocattr' not described in 'security_list_options' include/linux/lsm_hooks.h:1822: warning: Function parameter or member 'locked_down' not described in 'security_list_options' Documentation/admin-guide/perf/imx-ddr.rst:21: WARNING: Unexpected indentation.
Documentation/admin-guide/perf/imx-ddr.rst:34: WARNING: Unexpected indentation.
Documentation/admin-guide/perf/imx-ddr.rst:40: WARNING: Unexpected indentation.
Documentation/admin-guide/perf/imx-ddr.rst:45: WARNING: Unexpected indentation.
Documentation/admin-guide/perf/imx-ddr.rst:52: WARNING: Unexpected indentation.
Documentation/admin-guide/xfs.rst:257: WARNING: Block quote ends without a blank line; unexpected unindent. include/uapi/linux/firewire-cdev.h:312: WARNING: Inline literal start-string without end-string. drivers/firewire/core-transaction.c:606: WARNING: Inline strong start-string without end-string. drivers/message/fusion/mptbase.c:5057: WARNING: Definition list ends without a blank line; unexpected unindent. include/linux/regulator/driver.h:284: WARNING: Unknown target name: "regulator_regmap_x_voltage".
include/linux/i2c.h:522: WARNING: Inline strong start-string without end-string.
Documentation/driver-api/gpio/driver.rst:420: WARNING: Unexpected indentation.
Documentation/driver-api/gpio/driver.rst:418: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:422: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/driver-api/gpio/driver.rst:424: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:424: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:424: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:428: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:441: WARNING: Unexpected indentation.
Documentation/driver-api/gpio/driver.rst:435: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:435: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:442: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/driver-api/gpio/driver.rst:444: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/driver-api/gpio/driver.rst:455: WARNING: Unexpected indentation.
Documentation/driver-api/gpio/driver.rst:453: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:455: WARNING: Inline emphasis start-string without end-string. Documentation/driver-api/gpio/driver.rst:458: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/driver-api/gpio/driver.rst:460: WARNING: Inline emphasis start-string without end-string.

vim +1085 include/drm/drm_connector.h

52217195176115 Daniel Vetter 2016-08-12   958  
772cd52c5574b0 Maxime Ripard 2019-06-19   959  /**
772cd52c5574b0 Maxime Ripard 2019-06-19   960   * struct drm_cmdline_mode - DRM Mode passed through the kernel command-line
772cd52c5574b0 Maxime Ripard 2019-06-19   961   *
772cd52c5574b0 Maxime Ripard 2019-06-19   962   * Each connector can have an initial mode with additional options
772cd52c5574b0 Maxime Ripard 2019-06-19   963   * passed through the kernel command line. This structure allows to
772cd52c5574b0 Maxime Ripard 2019-06-19   964   * express those parameters and will be filled by the command-line
772cd52c5574b0 Maxime Ripard 2019-06-19   965   * parser.
772cd52c5574b0 Maxime Ripard 2019-06-19   966   */
52217195176115 Daniel Vetter 2016-08-12   967  struct drm_cmdline_mode {
3aeeb13d899627 Maxime Ripard 2019-06-19   968  	/**
3aeeb13d899627 Maxime Ripard 2019-06-19   969  	 * @name:
3aeeb13d899627 Maxime Ripard 2019-06-19   970  	 *
3aeeb13d899627 Maxime Ripard 2019-06-19   971  	 * Name of the mode.
3aeeb13d899627 Maxime Ripard 2019-06-19   972  	 */
3aeeb13d899627 Maxime Ripard 2019-06-19   973  	char name[DRM_DISPLAY_MODE_LEN];
3aeeb13d899627 Maxime Ripard 2019-06-19   974  
772cd52c5574b0 Maxime Ripard 2019-06-19   975  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19   976  	 * @specified:
772cd52c5574b0 Maxime Ripard 2019-06-19   977  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19   978  	 * Has a mode been read from the command-line?
772cd52c5574b0 Maxime Ripard 2019-06-19   979  	 */
52217195176115 Daniel Vetter 2016-08-12   980  	bool specified;
772cd52c5574b0 Maxime Ripard 2019-06-19   981  
772cd52c5574b0 Maxime Ripard 2019-06-19   982  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19   983  	 * @refresh_specified:
772cd52c5574b0 Maxime Ripard 2019-06-19   984  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19   985  	 * Did the mode have a preferred refresh rate?
772cd52c5574b0 Maxime Ripard 2019-06-19   986  	 */
52217195176115 Daniel Vetter 2016-08-12   987  	bool refresh_specified;
772cd52c5574b0 Maxime Ripard 2019-06-19   988  
772cd52c5574b0 Maxime Ripard 2019-06-19   989  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19   990  	 * @bpp_specified:
772cd52c5574b0 Maxime Ripard 2019-06-19   991  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19   992  	 * Did the mode have a preferred BPP?
772cd52c5574b0 Maxime Ripard 2019-06-19   993  	 */
52217195176115 Daniel Vetter 2016-08-12   994  	bool bpp_specified;
772cd52c5574b0 Maxime Ripard 2019-06-19   995  
772cd52c5574b0 Maxime Ripard 2019-06-19   996  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19   997  	 * @xres:
772cd52c5574b0 Maxime Ripard 2019-06-19   998  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19   999  	 * Active resolution on the X axis, in pixels.
772cd52c5574b0 Maxime Ripard 2019-06-19  1000  	 */
772cd52c5574b0 Maxime Ripard 2019-06-19  1001  	int xres;
772cd52c5574b0 Maxime Ripard 2019-06-19  1002  
772cd52c5574b0 Maxime Ripard 2019-06-19  1003  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19  1004  	 * @yres:
772cd52c5574b0 Maxime Ripard 2019-06-19  1005  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19  1006  	 * Active resolution on the Y axis, in pixels.
772cd52c5574b0 Maxime Ripard 2019-06-19  1007  	 */
772cd52c5574b0 Maxime Ripard 2019-06-19  1008  	int yres;
772cd52c5574b0 Maxime Ripard 2019-06-19  1009  
772cd52c5574b0 Maxime Ripard 2019-06-19  1010  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19  1011  	 * @bpp:
772cd52c5574b0 Maxime Ripard 2019-06-19  1012  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19  1013  	 * Bits per pixels for the mode.
772cd52c5574b0 Maxime Ripard 2019-06-19  1014  	 */
52217195176115 Daniel Vetter 2016-08-12  1015  	int bpp;
772cd52c5574b0 Maxime Ripard 2019-06-19  1016  
772cd52c5574b0 Maxime Ripard 2019-06-19  1017  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19  1018  	 * @refresh:
772cd52c5574b0 Maxime Ripard 2019-06-19  1019  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19  1020  	 * Refresh rate, in Hertz.
772cd52c5574b0 Maxime Ripard 2019-06-19  1021  	 */
52217195176115 Daniel Vetter 2016-08-12  1022  	int refresh;
772cd52c5574b0 Maxime Ripard 2019-06-19  1023  
772cd52c5574b0 Maxime Ripard 2019-06-19  1024  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19  1025  	 * @rb:
772cd52c5574b0 Maxime Ripard 2019-06-19  1026  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19  1027  	 * Do we need to use reduced blanking?
772cd52c5574b0 Maxime Ripard 2019-06-19  1028  	 */
52217195176115 Daniel Vetter 2016-08-12  1029  	bool rb;
772cd52c5574b0 Maxime Ripard 2019-06-19  1030  
772cd52c5574b0 Maxime Ripard 2019-06-19  1031  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19  1032  	 * @interlace:
772cd52c5574b0 Maxime Ripard 2019-06-19  1033  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19  1034  	 * The mode is interlaced.
772cd52c5574b0 Maxime Ripard 2019-06-19  1035  	 */
52217195176115 Daniel Vetter 2016-08-12  1036  	bool interlace;
772cd52c5574b0 Maxime Ripard 2019-06-19  1037  
772cd52c5574b0 Maxime Ripard 2019-06-19  1038  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19  1039  	 * @cvt:
772cd52c5574b0 Maxime Ripard 2019-06-19  1040  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19  1041  	 * The timings will be calculated using the VESA Coordinated
772cd52c5574b0 Maxime Ripard 2019-06-19  1042  	 * Video Timings instead of looking up the mode from a table.
772cd52c5574b0 Maxime Ripard 2019-06-19  1043  	 */
52217195176115 Daniel Vetter 2016-08-12  1044  	bool cvt;
772cd52c5574b0 Maxime Ripard 2019-06-19  1045  
772cd52c5574b0 Maxime Ripard 2019-06-19  1046  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19  1047  	 * @margins:
772cd52c5574b0 Maxime Ripard 2019-06-19  1048  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19  1049  	 * Add margins to the mode calculation (1.8% of xres rounded
772cd52c5574b0 Maxime Ripard 2019-06-19  1050  	 * down to 8 pixels and 1.8% of yres).
772cd52c5574b0 Maxime Ripard 2019-06-19  1051  	 */
52217195176115 Daniel Vetter 2016-08-12  1052  	bool margins;
772cd52c5574b0 Maxime Ripard 2019-06-19  1053  
772cd52c5574b0 Maxime Ripard 2019-06-19  1054  	/**
772cd52c5574b0 Maxime Ripard 2019-06-19  1055  	 * @force:
772cd52c5574b0 Maxime Ripard 2019-06-19  1056  	 *
772cd52c5574b0 Maxime Ripard 2019-06-19  1057  	 * Ignore the hotplug state of the connector, and force its
772cd52c5574b0 Maxime Ripard 2019-06-19  1058  	 * state to one of the DRM_FORCE_* values.
772cd52c5574b0 Maxime Ripard 2019-06-19  1059  	 */
52217195176115 Daniel Vetter 2016-08-12  1060  	enum drm_connector_force force;
1bf4e09227c345 Maxime Ripard 2019-06-19  1061  
1bf4e09227c345 Maxime Ripard 2019-06-19  1062  	/**
1bf4e09227c345 Maxime Ripard 2019-06-19  1063  	 * @rotation_reflection:
1bf4e09227c345 Maxime Ripard 2019-06-19  1064  	 *
1bf4e09227c345 Maxime Ripard 2019-06-19  1065  	 * Initial rotation and reflection of the mode setup from the
1bf4e09227c345 Maxime Ripard 2019-06-19  1066  	 * command line. See DRM_MODE_ROTATE_* and
1bf4e09227c345 Maxime Ripard 2019-06-19  1067  	 * DRM_MODE_REFLECT_*. The only rotations supported are
1bf4e09227c345 Maxime Ripard 2019-06-19  1068  	 * DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180.
1bf4e09227c345 Maxime Ripard 2019-06-19  1069  	 */
1bf4e09227c345 Maxime Ripard 2019-06-19  1070  	unsigned int rotation_reflection;
3d46a3007cd8f7 Maxime Ripard 2019-06-19  1071  
77fbea6d77359f Hans de Goede 2019-11-10  1072  	/**
77fbea6d77359f Hans de Goede 2019-11-10  1073  	 * @panel_orientation
77fbea6d77359f Hans de Goede 2019-11-10 @1074  	 *
77fbea6d77359f Hans de Goede 2019-11-10  1075  	 * drm-connector "panel orientation" property override value,
77fbea6d77359f Hans de Goede 2019-11-10  1076  	 * DRM_MODE_PANEL_ORIENTATION_UNKNOWN if not set.
77fbea6d77359f Hans de Goede 2019-11-10  1077  	 */
77fbea6d77359f Hans de Goede 2019-11-10  1078  	enum drm_panel_orientation panel_orientation;
77fbea6d77359f Hans de Goede 2019-11-10  1079  
3d46a3007cd8f7 Maxime Ripard 2019-06-19  1080  	/**
3d46a3007cd8f7 Maxime Ripard 2019-06-19  1081  	 * @tv_margins: TV margins to apply to the mode.
3d46a3007cd8f7 Maxime Ripard 2019-06-19  1082  	 */
3d46a3007cd8f7 Maxime Ripard 2019-06-19  1083  	struct drm_connector_tv_margins tv_margins;
52217195176115 Daniel Vetter 2016-08-12  1084  };

52217195176115 Daniel Vetter 2016-08-12 @1085

:::::: The code at line 1085 was first introduced by commit
:::::: 522171951761153172c75b94ae1f4bc9ab631745 drm: Extract drm_connector.[hc]

:::::: TO: Daniel Vetter <[email protected]>
:::::: CC: Daniel Vetter <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

#14 lore raw

PATCH 10/12 drm/modes: parse_cmdline: Remove some unnecessary code

In reply to Hans de Goede

Remove 2 bits of dead-code:

1) drm_mode_parse_command_line_for_connector() always gets called with a zero-ed drm_cmdline_mode struct and assumes so in most places, so there is no reason to set mode->specified to false if no mode_option is present.

2) fb_get_options() will return fb_mode_option if no video=<connector-name> argument is present on the kernel commandline, so there is no need to also do this in drm_mode_parse_command_line_for_connector() as our only caller uses fb_get_options() to get the mode_option argument.

---
 drivers/gpu/drm/drm_modes.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpu/drm/drm_modes.c +0 -7
index 119fed7ab815..0bf3cb8c08ff 100644
@@ -1747,15 +1747,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 
 	mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
 
-#ifdef CONFIG_FB
 	if (!mode_option)
-		mode_option = fb_mode_option;
-#endif
-
-	if (!mode_option) {
-		mode->specified = false;
 		return false;
-	}
 
 	name = mode_option;
 
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#15 lore raw

Re: [PATCH 10/12] drm/modes: parse_cmdline: Remove some unnecessary code

Quoted 6 lines · Hans de Goede

Remove 2 bits of dead-code:

1) drm_mode_parse_command_line_for_connector() always gets called with a zero-ed drm_cmdline_mode struct and assumes so in most places, so there is no reason to set mode->specified to false if no mode_option is present.

Hm I'd keep that part, just for safety. It's not really a performance critical path really ...
-Daniel

Quoted 37 lines

2) fb_get_options() will return fb_mode_option if no video=<connector-name> argument is present on the kernel commandline, so there is no need to also do this in drm_mode_parse_command_line_for_connector() as our only caller uses fb_get_options() to get the mode_option argument.

---
 drivers/gpu/drm/drm_modes.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpu/drm/drm_modes.c +0 -7
index 119fed7ab815..0bf3cb8c08ff 100644
@@ -1747,15 +1747,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 
 	mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
 
-#ifdef CONFIG_FB
 	if (!mode_option)
-		mode_option = fb_mode_option;
-#endif
-
-	if (!mode_option) {
-		mode->specified = false;
 		return false;
-	}
 
 	name = mode_option;
 
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#16 lore raw

Re: [PATCH 10/12] drm/modes: parse_cmdline: Remove some unnecessary code

Hi,

Quoted 10 lines · Daniel Vetter
Quoted 6 lines · Hans de Goede

Remove 2 bits of dead-code:

1) drm_mode_parse_command_line_for_connector() always gets called with a zero-ed drm_cmdline_mode struct and assumes so in most places, so there is no reason to set mode->specified to false if no mode_option is present.

Hm I'd keep that part, just for safety. It's not really a performance critical path really ...

But we do not explicitly set bpp_specified or refresh_specified to false ever. So this is inconsistent, which bugs me :)

Alternative proposal: Add an explicit memset(..., 0, ...) at the top of the function to make sure that we clear everything and not just 1 of the 3 specified flags.

Regards,

Hans

Quoted 32 lines

-Daniel

Quoted 30 lines

2) fb_get_options() will return fb_mode_option if no video=<connector-name> argument is present on the kernel commandline, so there is no need to also do this in drm_mode_parse_command_line_for_connector() as our only caller uses fb_get_options() to get the mode_option argument.

---
  drivers/gpu/drm/drm_modes.c | 7 -------
  1 file changed, 7 deletions(-)
drivers/gpu/drm/drm_modes.c +0 -7
index 119fed7ab815..0bf3cb8c08ff 100644
@@ -1747,15 +1747,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 
  	mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
 
-#ifdef CONFIG_FB
  	if (!mode_option)
-		mode_option = fb_mode_option;
-#endif
-
-	if (!mode_option) {
-		mode->specified = false;
  		return false;
-	}
 
  	name = mode_option;
 
Quoted 8 lines
Quoted 7 lines
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#17 lore raw

PATCH 11/12 drm/connector: Split out orientation quirk detection (v2)

In reply to Hans de Goede

From: Derek Basehore <[email protected]>

Not every platform needs quirk detection for panel orientation, so split the drm_connector_init_panel_orientation_property into two functions. One for platforms without the need for quirks, and the other for platforms that need quirks.

Hans de Goede (changes in v2):

Rename the function from drm_connector_init_panel_orientation_property to drm_connector_set_panel_orientation[_with_quirk] and pass in the panel-orientation to set.

Beside the rename, also make the function set the passed in value only once, if the value was set before (to a value other then DRM_MODE_PANEL_ORIENTATION_UNKNOWN) make any further set calls a no-op.

This change is preparation for allowing the user to override the panel-orientation for any connector from the kernel commandline. When the panel-orientation is overridden this way, then we must ignore the panel-orientation detection done by the driver.

---
 drivers/gpu/drm/drm_connector.c         | 74 ++++++++++++++++++-------
 drivers/gpu/drm/i915/display/icl_dsi.c  |  5 +-
 drivers/gpu/drm/i915/display/intel_dp.c |  9 ++-
 drivers/gpu/drm/i915/display/vlv_dsi.c  |  5 +-
 include/drm/drm_connector.h             |  9 ++-
 5 files changed, 71 insertions(+), 31 deletions(-)
drivers/gpu/drm/drm_connector.c +54 -20
index 4c766624b20d..40a985c411a6 100644
@@ -1114,7 +1114,8 @@ static const struct drm_prop_enum_list hdmi_colorspaces[] = {
  *	coordinates, so if userspace rotates the picture to adjust for
  *	the orientation it must also apply the same transformation to the
  *	touchscreen input coordinates. This property is initialized by calling
- *	drm_connector_init_panel_orientation_property().
+ *	drm_connector_set_panel_orientation() or
+ *	drm_connector_set_panel_orientation_with_quirk()
  *
  * scaling mode:
  *	This property defines how a non-native mode is upscaled to the native
@@ -1986,38 +1987,41 @@ void drm_connector_set_vrr_capable_property(
 EXPORT_SYMBOL(drm_connector_set_vrr_capable_property);
 
 /**
- * drm_connector_init_panel_orientation_property -
- *	initialize the connecters panel_orientation property
- * @connector: connector for which to init the panel-orientation property.
- * @width: width in pixels of the panel, used for panel quirk detection
- * @height: height in pixels of the panel, used for panel quirk detection
+ * drm_connector_set_panel_orientation - sets the connecter's panel_orientation
+ * @connector: connector for which to set the panel-orientation property.
+ * @panel_orientation: drm_panel_orientation value to set
+ *
+ * This function sets the connector's panel_orientation and attaches
+ * a "panel orientation" property to the connector.
  *
- * This function should only be called for built-in panels, after setting
- * connector->display_info.panel_orientation first (if known).
+ * Calling this function on a connector where the panel_orientation has
+ * already been set is a no-op (e.g. the orientation has been overridden with
+ * a kernel commandline option).
  *
- * This function will check for platform specific (e.g. DMI based) quirks
- * overriding display_info.panel_orientation first, then if panel_orientation
- * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the
- * "panel orientation" property to the connector.
+ * It is allowed to call this function with a panel_orientation of
+ * DRM_MODE_PANEL_ORIENTATION_UNKNOWN, in which case it is a no-op.
  *
  * Returns:
  * Zero on success, negative errno on failure.
  */
-int drm_connector_init_panel_orientation_property(
-	struct drm_connector *connector, int width, int height)
+int drm_connector_set_panel_orientation(
+	struct drm_connector *connector,
+	enum drm_panel_orientation panel_orientation)
 {
 	struct drm_device *dev = connector->dev;
 	struct drm_display_info *info = &connector->display_info;
 	struct drm_property *prop;
-	int orientation_quirk;
 
-	orientation_quirk = drm_get_panel_orientation_quirk(width, height);
-	if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
-		info->panel_orientation = orientation_quirk;
+	/* Already set? */
+	if (info->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
+		return 0;
 
-	if (info->panel_orientation == DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
+	/* Don't attach the property if the orientation is unknown */
+	if (panel_orientation == DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
 		return 0;
 
+	info->panel_orientation = panel_orientation;
+
 	prop = dev->mode_config.panel_orientation_property;
 	if (!prop) {
 		prop = drm_property_create_enum(dev, DRM_MODE_PROP_IMMUTABLE,
@@ -2034,7 +2038,37 @@ int drm_connector_init_panel_orientation_property(
 				   info->panel_orientation);
 	return 0;
 }
-EXPORT_SYMBOL(drm_connector_init_panel_orientation_property);
+EXPORT_SYMBOL(drm_connector_set_panel_orientation);
+
+/**
+ * drm_connector_set_panel_orientation_with_quirk -
+ *	set the connecter's panel_orientation after checking for quirks
+ * @connector: connector for which to init the panel-orientation property.
+ * @panel_orientation: drm_panel_orientation value to set
+ * @width: width in pixels of the panel, used for panel quirk detection
+ * @height: height in pixels of the panel, used for panel quirk detection
+ *
+ * Like drm_connector_set_panel_orientation(), but with a check for platform
+ * specific (e.g. DMI based) quirks overriding the passed in panel_orientation.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_set_panel_orientation_with_quirk(
+	struct drm_connector *connector,
+	enum drm_panel_orientation panel_orientation,
+	int width, int height)
+{
+	int orientation_quirk;
+
+	orientation_quirk = drm_get_panel_orientation_quirk(width, height);
+	if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
+		panel_orientation = orientation_quirk;
+
+	return drm_connector_set_panel_orientation(connector,
+						   panel_orientation);
+}
+EXPORT_SYMBOL(drm_connector_set_panel_orientation_with_quirk);
 
 int drm_connector_set_obj_prop(struct drm_mode_object *obj,
 				    struct drm_property *property,
drivers/gpu/drm/i915/display/icl_dsi.c +2 -3
index 6e398c33a524..8cd51cf67d02 100644
@@ -1536,9 +1536,8 @@ static void icl_dsi_add_properties(struct intel_connector *connector)
 
 	connector->base.state->scaling_mode = DRM_MODE_SCALE_ASPECT;
 
-	connector->base.display_info.panel_orientation =
-			intel_dsi_get_panel_orientation(connector);
-	drm_connector_init_panel_orientation_property(&connector->base,
+	drm_connector_set_panel_orientation_with_quirk(&connector->base,
+				intel_dsi_get_panel_orientation(connector),
 				connector->panel.fixed_mode->hdisplay,
 				connector->panel.fixed_mode->vdisplay);
 }
drivers/gpu/drm/i915/display/intel_dp.c +6 -3
index 57e9f0ba331b..8d5b95d18bc0 100644
@@ -7081,9 +7081,12 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	intel_connector->panel.backlight.power = intel_edp_backlight_power;
 	intel_panel_setup_backlight(connector, pipe);
 
-	if (fixed_mode)
-		drm_connector_init_panel_orientation_property(
-			connector, fixed_mode->hdisplay, fixed_mode->vdisplay);
+	if (fixed_mode) {
+		/* We do not know the orientation, but their might be a quirk */
+		drm_connector_set_panel_orientation_with_quirk(connector,
+				DRM_MODE_PANEL_ORIENTATION_UNKNOWN,
+				fixed_mode->hdisplay, fixed_mode->vdisplay);
+	}
 
 	return true;
 
drivers/gpu/drm/i915/display/vlv_dsi.c +2 -3
index 313705e10fa2..fc63e2f6a511 100644
@@ -1636,10 +1636,9 @@ static void vlv_dsi_add_properties(struct intel_connector *connector)
 
 		connector->base.state->scaling_mode = DRM_MODE_SCALE_ASPECT;
 
-		connector->base.display_info.panel_orientation =
-			vlv_dsi_get_panel_orientation(connector);
-		drm_connector_init_panel_orientation_property(
+		drm_connector_set_panel_orientation_with_quirk(
 				&connector->base,
+				vlv_dsi_get_panel_orientation(connector),
 				connector->panel.fixed_mode->hdisplay,
 				connector->panel.fixed_mode->vdisplay);
 	}
include/drm/drm_connector.h +7 -2
index e60bb3602497..480687a49b95 100644
@@ -1547,8 +1547,13 @@ void drm_connector_set_link_status_property(struct drm_connector *connector,
 					    uint64_t link_status);
 void drm_connector_set_vrr_capable_property(
 		struct drm_connector *connector, bool capable);
-int drm_connector_init_panel_orientation_property(
-	struct drm_connector *connector, int width, int height);
+int drm_connector_set_panel_orientation(
+	struct drm_connector *connector,
+	enum drm_panel_orientation panel_orientation);
+int drm_connector_set_panel_orientation_with_quirk(
+	struct drm_connector *connector,
+	enum drm_panel_orientation panel_orientation,
+	int width, int height);
 int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
 					  int min, int max);
 
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#18 lore raw

PATCH 12/12 drm/connector: Hookup the new drm_cmdline_mode panel_orientation member

In reply to Hans de Goede

If the new video=... panel_orientation option is set for a connector, honor it and setup a matching "panel orientation" property on the connector.

---
 drivers/gpu/drm/drm_connector.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_connector.c +7 -0
index 40a985c411a6..591914f01cd4 100644
@@ -140,6 +140,13 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
 		connector->force = mode->force;
 	}
 
+	if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
+		DRM_INFO("setting connector %s panel_orientation to %d\n",
+			 connector->name, mode->panel_orientation);
+		drm_connector_set_panel_orientation(connector,
+						    mode->panel_orientation);
+	}
+
 	DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
 		      connector->name, mode->name,
 		      mode->xres, mode->yres,
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#19 lore raw

Re: [PATCH 12/12] drm/connector: Hookup the new drm_cmdline_mode panel_orientation member

Quoted 5 lines · Hans de Goede

If the new video=... panel_orientation option is set for a connector, honor it and setup a matching "panel orientation" property on the connector.

Don't we need one more patch here to create the panel orientation property if the driver doesn't do it? Otherwise this won't happen, and userspace can't look at it (only the internal fbdev stuff, which has it's own limitations wrt rotation).
-Daniel

Quoted 29 lines
---
 drivers/gpu/drm/drm_connector.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_connector.c +7 -0
index 40a985c411a6..591914f01cd4 100644
@@ -140,6 +140,13 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
 		connector->force = mode->force;
 	}
 
+	if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
+		DRM_INFO("setting connector %s panel_orientation to %d\n",
+			 connector->name, mode->panel_orientation);
+		drm_connector_set_panel_orientation(connector,
+						    mode->panel_orientation);
+	}
+
 	DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
 		      connector->name, mode->name,
 		      mode->xres, mode->yres,
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#20 lore raw

Re: [PATCH 12/12] drm/connector: Hookup the new drm_cmdline_mode panel_orientation member

Hi,

Quoted 11 lines · Daniel Vetter
Quoted 5 lines · Hans de Goede

If the new video=... panel_orientation option is set for a connector, honor it and setup a matching "panel orientation" property on the connector.

Don't we need one more patch here to create the panel orientation property if the driver doesn't do it? Otherwise this won't happen, and userspace can't look at it (only the internal fbdev stuff, which has it's own limitations wrt rotation).

That is what patch 11/12 is for, that patch renames drm_connector_init_panel_orientation to drm_set_panel_orientation and makes it both set, init and attach the property (unless called with DRM_MODE_PANEL_ORIENTATION_UNKNOWN in which case it is a no-op).

Patch 11/12 also makes drm_set_panel_orientation do the set only once, which is why the orientation to set is now passed instead of stored directly in the connector, so that a second set call (panel_orientation of the connector already != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) can be skipped, so that the cmdline overrides driver detecion code for this.

Regards,

Hans

Quoted 27 lines

-Daniel

Quoted 25 lines
---
  drivers/gpu/drm/drm_connector.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_connector.c +7 -0
index 40a985c411a6..591914f01cd4 100644
@@ -140,6 +140,13 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
  		connector->force = mode->force;
  	}
 
+	if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
+		DRM_INFO("setting connector %s panel_orientation to %d\n",
+			 connector->name, mode->panel_orientation);
+		drm_connector_set_panel_orientation(connector,
+						    mode->panel_orientation);
+	}
+
  	DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
  		      connector->name, mode->name,
  		      mode->xres, mode->yres,
Signature · 1 line
2.23.0
Quoted 5 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#21 lore raw

Re: [PATCH 12/12] drm/connector: Hookup the new drm_cmdline_mode panel_orientation member

Quoted 20 lines · Hans de Goede

Hi,

Quoted 11 lines · Daniel Vetter
Quoted 5 lines · Hans de Goede

If the new video=... panel_orientation option is set for a connector, honor it and setup a matching "panel orientation" property on the connector.

Don't we need one more patch here to create the panel orientation property if the driver doesn't do it? Otherwise this won't happen, and userspace can't look at it (only the internal fbdev stuff, which has it's own limitations wrt rotation).

That is what patch 11/12 is for, that patch renames drm_connector_init_panel_orientation to drm_set_panel_orientation and makes it both set, init and attach the property (unless called with DRM_MODE_PANEL_ORIENTATION_UNKNOWN in which case it is a no-op).

Quoted 5 lines

Patch 11/12 also makes drm_set_panel_orientation do the set only once, which is why the orientation to set is now passed instead of stored directly in the connector, so that a second set call (panel_orientation of the connector already != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) can be skipped, so that the cmdline overrides driver detecion code for this.

Oh, that's what I get for not reading the entire series ... Only risk with that is that drivers set this property after driver loading is done - we can't attach/create properties after drm_dev_register. But I've added the corresponding WARN_ON to these, so we should be all fine I think. So looks all good to me.
-Daniel

Quoted 40 lines

Regards,

Hans

Quoted 32 lines

-Daniel

Quoted 29 lines
---
  drivers/gpu/drm/drm_connector.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_connector.c +7 -1
index 40a985c411a6..591914f01cd4 100644
@@ -140,6 +140,13 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
             connector->force = mode->force;
     }
 
+    if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
+            DRM_INFO("setting connector %s panel_orientation to %d\n",
+                     connector->name, mode->panel_orientation);
+            drm_connector_set_panel_orientation(connector,
+                                                mode->panel_orientation);
+    }
+
     DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
                   connector->name, mode->name,
                   mode->xres, mode->yres,
--

2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#22 lore raw

Re: [PATCH 12/12] drm/connector: Hookup the new drm_cmdline_mode panel_orientation member

Hi,

Quoted 27 lines · Daniel Vetter
Quoted 20 lines · Hans de Goede

Hi,

Quoted 11 lines · Daniel Vetter
Quoted 5 lines · Hans de Goede

If the new video=... panel_orientation option is set for a connector, honor it and setup a matching "panel orientation" property on the connector.

Don't we need one more patch here to create the panel orientation property if the driver doesn't do it? Otherwise this won't happen, and userspace can't look at it (only the internal fbdev stuff, which has it's own limitations wrt rotation).

That is what patch 11/12 is for, that patch renames drm_connector_init_panel_orientation to drm_set_panel_orientation and makes it both set, init and attach the property (unless called with DRM_MODE_PANEL_ORIENTATION_UNKNOWN in which case it is a no-op).

Quoted 5 lines

Patch 11/12 also makes drm_set_panel_orientation do the set only once, which is why the orientation to set is now passed instead of stored directly in the connector, so that a second set call (panel_orientation of the connector already != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) can be skipped, so that the cmdline overrides driver detecion code for this.

Quoted 5 lines

Oh, that's what I get for not reading the entire series ... Only risk with that is that drivers set this property after driver loading is done - we can't attach/create properties after drm_dev_register. But I've added the corresponding WARN_ON to these, so we should be all fine I think. So looks all good to me.

Can I take that as your Acked-by for this patch and perhaps also for 11/12 ?

Also what about your remarks to 10/12? I'm happy to do a v2 with a memset, as said my main reason for dropping the specified=false in the early path is that we never init bpp_specified or refresh_specified explicitly to false I'm all for being explicit about that, but then lets just zero out the entire passed in drm_cmdline_mode struct.

Regards,

Hans

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
---
   drivers/gpu/drm/drm_connector.c | 7 +++++++
   1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_connector.c +7 -1
index 40a985c411a6..591914f01cd4 100644
@@ -140,6 +140,13 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
              connector->force = mode->force;
      }
 
+    if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
+            DRM_INFO("setting connector %s panel_orientation to %d\n",
+                     connector->name, mode->panel_orientation);
+            drm_connector_set_panel_orientation(connector,
+                                                mode->panel_orientation);
+    }
+
      DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
                    connector->name, mode->name,
                    mode->xres, mode->yres,
--

2.23.0

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#23 lore raw

Re: [PATCH 12/12] drm/connector: Hookup the new drm_cmdline_mode panel_orientation member

Quoted 31 lines · Hans de Goede

Hi,

Quoted 27 lines · Daniel Vetter
Quoted 25 lines · Hans de Goede

Hi,

Quoted 11 lines · Daniel Vetter
Quoted 5 lines · Hans de Goede

If the new video=... panel_orientation option is set for a connector, honor it and setup a matching "panel orientation" property on the connector.

Don't we need one more patch here to create the panel orientation property if the driver doesn't do it? Otherwise this won't happen, and userspace can't look at it (only the internal fbdev stuff, which has it's own limitations wrt rotation).

That is what patch 11/12 is for, that patch renames drm_connector_init_panel_orientation to drm_set_panel_orientation and makes it both set, init and attach the property (unless called with DRM_MODE_PANEL_ORIENTATION_UNKNOWN in which case it is a no-op).

Patch 11/12 also makes drm_set_panel_orientation do the set only once, which is why the orientation to set is now passed instead of stored directly in the connector, so that a second set call (panel_orientation of the connector already != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) can be skipped, so that the cmdline overrides driver detecion code for this.

Quoted 7 lines
Quoted 5 lines

Oh, that's what I get for not reading the entire series ... Only risk with that is that drivers set this property after driver loading is done - we can't attach/create properties after drm_dev_register. But I've added the corresponding WARN_ON to these, so we should be all fine I think. So looks all good to me.

Can I take that as your Acked-by for this patch and perhaps also for 11/12 ?

Uh I didn't really read the details, ack feels a bit thin to land this ...

Quoted 5 lines

Also what about your remarks to 10/12? I'm happy to do a v2 with a memset, as said my main reason for dropping the specified=false in the early path is that we never init bpp_specified or refresh_specified explicitly to false I'm all for being explicit about that, but then lets just zero out the entire passed in drm_cmdline_mode struct.

Hm yeah, clearing it all might be a good idea.
-Daniel

Quoted 41 lines

Regards,

Hans

Quoted 33 lines
Quoted 31 lines
Quoted 30 lines
Quoted 29 lines
---
   drivers/gpu/drm/drm_connector.c | 7 +++++++
   1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_connector.c +7 -1
index 40a985c411a6..591914f01cd4 100644
@@ -140,6 +140,13 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
              connector->force = mode->force;
      }
 
+    if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
+            DRM_INFO("setting connector %s panel_orientation to %d\n",
+                     connector->name, mode->panel_orientation);
+            drm_connector_set_panel_orientation(connector,
+                                                mode->panel_orientation);
+    }
+
      DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
                    connector->name, mode->name,
                    mode->xres, mode->yres,
--

2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#24 lore raw

Re: [PATCH 12/12] drm/connector: Hookup the new drm_cmdline_mode panel_orientation member

Hi,

Quoted 38 lines · Daniel Vetter
Quoted 37 lines · Hans de Goede

Hi,

Quoted 32 lines · Daniel Vetter
Quoted 20 lines · Hans de Goede

Hi,

Quoted 11 lines · Daniel Vetter
Quoted 5 lines · Hans de Goede

If the new video=... panel_orientation option is set for a connector, honor it and setup a matching "panel orientation" property on the connector.

Don't we need one more patch here to create the panel orientation property if the driver doesn't do it? Otherwise this won't happen, and userspace can't look at it (only the internal fbdev stuff, which has it's own limitations wrt rotation).

That is what patch 11/12 is for, that patch renames drm_connector_init_panel_orientation to drm_set_panel_orientation and makes it both set, init and attach the property (unless called with DRM_MODE_PANEL_ORIENTATION_UNKNOWN in which case it is a no-op).

Quoted 5 lines

Patch 11/12 also makes drm_set_panel_orientation do the set only once, which is why the orientation to set is now passed instead of stored directly in the connector, so that a second set call (panel_orientation of the connector already != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) can be skipped, so that the cmdline overrides driver detecion code for this.

Oh, that's what I get for not reading the entire series ... Only risk with that is that drivers set this property after driver loading is done - we can't attach/create properties after drm_dev_register. But I've added the corresponding WARN_ON to these, so we should be all fine I think. So looks all good to me.

Quoted 3 lines
Quoted 1 line

Can I take that as your Acked-by for this patch and perhaps also for 11/12 ?

Uh I didn't really read the details, ack feels a bit thin to land this ...

Ok, I will wait a bit for others to review this then. Note that Maxime has reviewed patches 1-9, with one small remark on patch 9 which I'm still awaiting an answer for. So most of the cmdline parsing stuff has been reviewed and if you are ok with the non cmdline parsing changes...

Quoted 7 lines
Quoted 5 lines

Also what about your remarks to 10/12? I'm happy to do a v2 with a memset, as said my main reason for dropping the specified=false in the early path is that we never init bpp_specified or refresh_specified explicitly to false I'm all for being explicit about that, but then lets just zero out the entire passed in drm_cmdline_mode struct.

Hm yeah, clearing it all might be a good idea.

Ok I will submit a v2 with this change.

Regards,

Hans

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
---
    drivers/gpu/drm/drm_connector.c | 7 +++++++
    1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_connector.c +7 -1
index 40a985c411a6..591914f01cd4 100644
@@ -140,6 +140,13 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
               connector->force = mode->force;
       }
 
+    if (mode->panel_orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) {
+            DRM_INFO("setting connector %s panel_orientation to %d\n",
+                     connector->name, mode->panel_orientation);
+            drm_connector_set_panel_orientation(connector,
+                                                mode->panel_orientation);
+    }
+
       DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
                     connector->name, mode->name,
                     mode->xres, mode->yres,
--

2.23.0

Quoted 11 lines
Quoted 9 lines
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel