All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/modes: Add a switch to differentiate free standing options
@ 2019-08-27 11:58 Maxime Ripard
  2019-08-27 11:58 ` [PATCH 2/4] drm/modes: Fix the command line parser to take force options into account Maxime Ripard
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Maxime Ripard @ 2019-08-27 11:58 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Sean Paul,
	Maxime Ripard
  Cc: Maxime Ripard, jernej.skrabec, thomas.graichen, dri-devel

From: Maxime Ripard <maxime.ripard@bootlin.com>

Some extra command line options can be either specified without anything
else on the command line (basically all the force connection options), but
some other are only relevant when matched with a resolution (margin and
interlace).

Let's add a switch to restrict if needed the available option set.

Fixes: e08ab74bd4c7 ("drm/modes: Rewrite the command line parser")
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 drivers/gpu/drm/drm_modes.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 11acc9581977..e5997f35b779 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1454,6 +1454,7 @@ static int drm_mode_parse_cmdline_refresh(const char *str, char **end_ptr,
 }
 
 static int drm_mode_parse_cmdline_extra(const char *str, int length,
+					bool freestanding,
 					const struct drm_connector *connector,
 					struct drm_cmdline_mode *mode)
 {
@@ -1462,9 +1463,15 @@ static int drm_mode_parse_cmdline_extra(const char *str, int length,
 	for (i = 0; i < length; i++) {
 		switch (str[i]) {
 		case 'i':
+			if (freestanding)
+				return -EINVAL;
+
 			mode->interlace = true;
 			break;
 		case 'm':
+			if (freestanding)
+				return -EINVAL;
+
 			mode->margins = true;
 			break;
 		case 'D':
@@ -1542,6 +1549,7 @@ static int drm_mode_parse_cmdline_res_mode(const char *str, unsigned int length,
 			if (extras) {
 				int ret = drm_mode_parse_cmdline_extra(end_ptr + i,
 								       1,
+								       false,
 								       connector,
 								       mode);
 				if (ret)
@@ -1811,7 +1819,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
 	    extra_ptr != options_ptr) {
 		int len = strlen(name) - (extra_ptr - name);
 
-		ret = drm_mode_parse_cmdline_extra(extra_ptr, len,
+		ret = drm_mode_parse_cmdline_extra(extra_ptr, len, false,
 						   connector, mode);
 		if (ret)
 			return false;
-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-09-03 12:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-27 11:58 [PATCH 1/4] drm/modes: Add a switch to differentiate free standing options Maxime Ripard
2019-08-27 11:58 ` [PATCH 2/4] drm/modes: Fix the command line parser to take force options into account Maxime Ripard
2019-08-27 19:34   ` Thomas Graichen
2019-08-29 18:14   ` Jernej Škrabec
2019-08-27 11:58 ` [PATCH 3/4] drm/modes: Introduce a whitelist for the named modes Maxime Ripard
2019-08-27 19:35   ` Thomas Graichen
2019-08-29 18:15   ` Jernej Škrabec
2019-09-03 12:51     ` Jani Nikula
2019-08-27 11:58 ` [PATCH 4/4] drm/selftests: modes: Add more unit tests for the cmdline parser Maxime Ripard
2019-08-27 19:36   ` Thomas Graichen
2019-08-29 18:16   ` Jernej Škrabec
2019-08-27 19:33 ` [PATCH 1/4] drm/modes: Add a switch to differentiate free standing options Thomas Graichen
2019-08-29 18:13 ` Jernej Škrabec

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.