dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	 Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	Ben Skeggs <bskeggs@redhat.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	 Maxime Ripard <mripard@kernel.org>,
	Samuel Holland <samuel@sholland.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Emma Anholt <emma@anholt.net>, Karol Herbst <kherbst@redhat.com>,
	 Daniel Vetter <daniel@ffwll.ch>, Chen-Yu Tsai <wens@csie.org>,
	Lyude Paul <lyude@redhat.com>,
	 Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@linux.ie>
Cc: Dom Cobley <dom@raspberrypi.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Phil Elwell <phil@raspberrypi.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Noralf Trønnes <noralf@tronnes.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Maxime Ripard <maxime@cerno.tech>,
	Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>,
	linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 09/23] drm/modes: Switch to named mode descriptors
Date: Mon, 07 Nov 2022 15:16:35 +0100	[thread overview]
Message-ID: <20220728-rpi-analog-tv-properties-v7-9-7072a478c6b3@cerno.tech> (raw)
In-Reply-To: <20220728-rpi-analog-tv-properties-v7-0-7072a478c6b3@cerno.tech>

The current named mode parsing relies only on the mode name, and doesn't
allow to specify any other parameter.

Let's convert that string list to an array of a custom structure that will
hold the name and some additional parameters in the future.

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>

---
Changes in v7:
- Fix typo in the commit log
- Add Noralf Reviewed-by
---
 drivers/gpu/drm/drm_modes.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 37542612912b..7594b657f86a 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -2224,9 +2224,13 @@ static int drm_mode_parse_cmdline_options(const char *str,
 	return 0;
 }
 
-static const char * const drm_named_modes_whitelist[] = {
-	"NTSC",
-	"PAL",
+struct drm_named_mode {
+	const char *name;
+};
+
+static const struct drm_named_mode drm_named_modes[] = {
+	{ "NTSC", },
+	{ "PAL", },
 };
 
 static int drm_mode_parse_cmdline_named_mode(const char *name,
@@ -2258,14 +2262,15 @@ static int drm_mode_parse_cmdline_named_mode(const char *name,
 	 * We're sure we're a named mode at this point, iterate over the
 	 * list of modes we're aware of.
 	 */
-	for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) {
+	for (i = 0; i < ARRAY_SIZE(drm_named_modes); i++) {
+		const struct drm_named_mode *mode = &drm_named_modes[i];
 		int ret;
 
-		ret = str_has_prefix(name, drm_named_modes_whitelist[i]);
+		ret = str_has_prefix(name, mode->name);
 		if (ret != name_end)
 			continue;
 
-		strcpy(cmdline_mode->name, drm_named_modes_whitelist[i]);
+		strcpy(cmdline_mode->name, mode->name);
 		cmdline_mode->specified = true;
 
 		return 1;

-- 
b4 0.11.0-dev-99e3a

  parent reply	other threads:[~2022-11-07 14:18 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 14:16 [PATCH v7 00/23] drm: Analog TV Improvements Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 01/23] drm/tests: Add Kunit Helpers Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 02/23] drm/connector: Rename legacy TV property Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 03/23] drm/connector: Only register TV mode property if present Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 04/23] drm/connector: Rename drm_mode_create_tv_properties Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 05/23] drm/connector: Add TV standard property Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 06/23] drm/modes: Add a function to generate analog display modes Maxime Ripard
2022-11-08 13:28   ` [Nouveau] " Lukas Satin
2022-11-08 21:51     ` Mateusz Kwiatkowski
2022-11-07 14:16 ` [PATCH v7 07/23] drm/client: Add some tests for drm_connector_pick_cmdline_mode() Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 08/23] drm/modes: Move named modes parsing to a separate function Maxime Ripard
2022-11-07 14:16 ` Maxime Ripard [this message]
2022-11-07 14:16 ` [PATCH v7 10/23] drm/modes: Fill drm_cmdline mode from named modes Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 11/23] drm/connector: Add pixel clock to cmdline mode Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 12/23] drm/connector: Add a function to lookup a TV mode by its name Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 13/23] drm/modes: Introduce the tv_mode property as a command-line option Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 14/23] drm/modes: Properly generate a drm_display_mode from a named mode Maxime Ripard
2022-11-07 17:49   ` Noralf Trønnes
2022-11-08  9:40     ` Noralf Trønnes
2022-11-10 10:36       ` Maxime Ripard
2022-11-10  9:31     ` Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 15/23] drm/modes: Introduce more named modes Maxime Ripard
2022-11-07 18:03   ` Noralf Trønnes
2022-11-08  9:38     ` Noralf Trønnes
2022-11-08 21:27       ` Mateusz Kwiatkowski
2022-11-09 11:18         ` Maxime Ripard
2022-11-09 14:09   ` Noralf Trønnes
2022-11-07 14:16 ` [PATCH v7 16/23] drm/probe-helper: Provide a TV get_modes helper Maxime Ripard
2022-11-07 18:11   ` Noralf Trønnes
2022-11-09 15:41     ` Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 17/23] drm/atomic-helper: Add a TV properties reset helper Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 18/23] drm/atomic-helper: Add an analog TV atomic_check implementation Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 19/23] drm/vc4: vec: Use TV Reset implementation Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 20/23] drm/vc4: vec: Check for VEC output constraints Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 21/23] drm/vc4: vec: Convert to the new TV mode property Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 22/23] drm/vc4: vec: Add support for more analog TV standards Maxime Ripard
2022-11-08 13:17   ` [Nouveau] " Lukas Satin
2022-11-08 22:16     ` Mateusz Kwiatkowski
2022-11-09  1:15   ` Mateusz Kwiatkowski
2022-11-09 16:55     ` [Nouveau] " Lukas Satin
2022-11-10 10:39       ` Maxime Ripard
2022-11-10 10:57     ` Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 23/23] drm/sun4i: tv: Convert to the new TV mode property Maxime Ripard
2022-11-08 13:20 ` [Nouveau] [PATCH v7 00/23] drm: Analog TV Improvements Lukas Satin
2022-11-08 13:42   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220728-rpi-analog-tv-properties-v7-9-7072a478c6b3@cerno.tech \
    --to=maxime@cerno.tech \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dom@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=geert@linux-m68k.org \
    --cc=hdegoede@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kfyatek+publicgit@gmail.com \
    --cc=kherbst@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=noralf@tronnes.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=phil@raspberrypi.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=samuel@sholland.org \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=tzimmermann@suse.de \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).