Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2206475rwb; Mon, 7 Nov 2022 10:23:29 -0800 (PST) X-Google-Smtp-Source: AMsMyM55+QsZGOzQIOCF3JlgZV+yp0TI/P3poZlLNaNJpGxDp75wiTs81kZ3O8ZIo9d0NQiZ/zVV X-Received: by 2002:a63:5341:0:b0:46f:d05d:55cf with SMTP id t1-20020a635341000000b0046fd05d55cfmr34915721pgl.356.1667845409159; Mon, 07 Nov 2022 10:23:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667845409; cv=none; d=google.com; s=arc-20160816; b=tZ0gUBQmG0HGlD3ib5DfNy5NeqVQKpdNDV8pQujb8VOJu1xUHtnE+SFbLMaKID8AbO Bo9gJCFoJpW6YMIz8u156G2KSPgdPvRSa6qdSpSF6tjVL9lyc/hpdHaGObDXbxg5/Ur1 J5K52vV6aPn9Ee/DXvgIa3zT6u/+oIyttmPjKUZCVcuh7T6+9sl04pC2OhdAvsaStr7D upR1SRoUpnZUJxQORNY/9GRokv9MlTRF/DOB6uzyABkoFL9sbKTLeCaAIra/4U8NXwAZ 8BBjR+WncGK1KU4Z6SWpumKY4zP7mnorunkn8ht2XT2gXFkYwPl9mpH52bls3XPBGrSt 6LOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=3Bf+KcHaW9GVk8+e0qwYG7pDVa7qGqnwKbjfeHC+JJg=; b=EG07hRRatHnVN8pxdUz39FfT2TesDQuDCiXaMGewfrTPJL2JPtag+pCzt1uVi7W2yn MajDpRUdvWBAvtMGre5GtJdWy9wcTAXgSgc5wlBMKf9PfPSEABhX/ZXysR5aErvpCvYp XxRg7qlwquDB8DyX1vokSPe8z0yLIwYM9opsojGwJNbj3u5dOLWKHBtl2smAsDEXVaGy nBWxQz2YS7YlEPstZsv+9XT42+9bQXcno26kBCuY1x+DxIFhELsa2nLs1qFieG2rQmuU BMmzSn/8dvU0c+XaaBxaDvZppVgC3cj1AfsvVoRs62oN4lwPz3REDi/LuJp+pCtIqlkj bKdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@tronnes.org header.s=ds202112 header.b="J/2pe6qY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=tronnes.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a170902e54500b0016c474690cfsi12467083plf.318.2022.11.07.10.23.16; Mon, 07 Nov 2022 10:23:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@tronnes.org header.s=ds202112 header.b="J/2pe6qY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=tronnes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232913AbiKGSIB (ORCPT + 93 others); Mon, 7 Nov 2022 13:08:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231579AbiKGSHp (ORCPT ); Mon, 7 Nov 2022 13:07:45 -0500 Received: from smtp.domeneshop.no (smtp.domeneshop.no [IPv6:2a01:5b40:0:3005::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 066632C669 for ; Mon, 7 Nov 2022 10:03:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tronnes.org ; s=ds202112; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=3Bf+KcHaW9GVk8+e0qwYG7pDVa7qGqnwKbjfeHC+JJg=; b=J/2pe6qYb5J7p2zVDvNn2y2J2z nOUYFLV3uh28gG/8jdajK+ENWZXy4cnCy5f8yIZZisUtv8a6oX6QYsy6dTBPVZsawqeDDyWnLC5LZ Lj71hcQnXQcJRwdxn2RTEdxJB7vHLhBzj1s97uAqUGTKNH5ch8GbJlqF7VaVAu5245EbIPRx6HQk2 KKaLpA1YjAAaRnHSFn3F0iCK/29HrLGAYo17Yxytus4J5ulx5hRzLSEj1SVWyRe7kMnmhOqWFlLQf A/UNuLiiTnbVG+/ePVNcCCZ3GhyHPJ36YAT63jSmGknUWy3cwAIIq0WuJ2NESE+CSNhVwzSAfbtqp Un8MhtCA==; Received: from [2a01:799:95a:cb00:cca0:57ac:c55d:a485] (port=63947) by smtp.domeneshop.no with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1os6TP-0001Dd-AZ; Mon, 07 Nov 2022 19:03:51 +0100 Message-ID: <262f0953-1e05-e68e-3e96-2ac2132a1e57@tronnes.org> Date: Mon, 7 Nov 2022 19:03:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v7 15/23] drm/modes: Introduce more named modes To: Maxime Ripard , Jani Nikula , Joonas Lahtinen , Tvrtko Ursulin , Ben Skeggs , Rodrigo Vivi , Maxime Ripard , Samuel Holland , Jernej Skrabec , Maarten Lankhorst , Emma Anholt , Karol Herbst , Daniel Vetter , Chen-Yu Tsai , Lyude Paul , Thomas Zimmermann , David Airlie Cc: Phil Elwell , Hans de Goede , linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Geert Uytterhoeven , Dave Stevenson , linux-arm-kernel@lists.infradead.org, Dom Cobley , Mateusz Kwiatkowski , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= References: <20220728-rpi-analog-tv-properties-v7-0-7072a478c6b3@cerno.tech> <20220728-rpi-analog-tv-properties-v7-15-7072a478c6b3@cerno.tech> From: =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= In-Reply-To: <20220728-rpi-analog-tv-properties-v7-15-7072a478c6b3@cerno.tech> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Den 07.11.2022 15.16, skrev Maxime Ripard: > Now that we can easily extend the named modes list, let's add a few more > analog TV modes that were used in the wild, and some unit tests to make > sure it works as intended. > > Signed-off-by: Maxime Ripard > > --- > Changes in v6: > - Renamed the tests to follow DRM test naming convention > > Changes in v5: > - Switched to KUNIT_ASSERT_NOT_NULL > --- > drivers/gpu/drm/drm_modes.c | 2 + > drivers/gpu/drm/tests/drm_client_modeset_test.c | 54 +++++++++++++++++++++++++ > 2 files changed, 56 insertions(+) > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c > index 49441cabdd9d..17c5b6108103 100644 > --- a/drivers/gpu/drm/drm_modes.c > +++ b/drivers/gpu/drm/drm_modes.c > @@ -2272,7 +2272,9 @@ struct drm_named_mode { > > static const struct drm_named_mode drm_named_modes[] = { > NAMED_MODE("NTSC", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_NTSC), > + NAMED_MODE("NTSC-J", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_NTSC_J), > NAMED_MODE("PAL", 13500, 720, 576, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_PAL), > + NAMED_MODE("PAL-M", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_PAL_M), > }; I'm now having second thoughts about the tv_mode commandline option. Can we just add all the variants to this table and drop the tv_mode option? IMO this will be more user friendly and less confusing. The named modes needs to be documented in modedb.rst. Noralf. > > static int drm_mode_parse_cmdline_named_mode(const char *name, > diff --git a/drivers/gpu/drm/tests/drm_client_modeset_test.c b/drivers/gpu/drm/tests/drm_client_modeset_test.c > index fdfe9e20702e..b3820d25beca 100644 > --- a/drivers/gpu/drm/tests/drm_client_modeset_test.c > +++ b/drivers/gpu/drm/tests/drm_client_modeset_test.c > @@ -133,6 +133,32 @@ static void drm_test_pick_cmdline_named_ntsc(struct kunit *test) > KUNIT_EXPECT_TRUE(test, drm_mode_equal(drm_mode_analog_ntsc_480i(drm), mode)); > } > > +static void drm_test_pick_cmdline_named_ntsc_j(struct kunit *test) > +{ > + struct drm_client_modeset_test_priv *priv = test->priv; > + struct drm_device *drm = priv->drm; > + struct drm_connector *connector = &priv->connector; > + struct drm_cmdline_mode *cmdline_mode = &connector->cmdline_mode; > + struct drm_display_mode *mode; > + const char *cmdline = "NTSC-J"; > + int ret; > + > + KUNIT_ASSERT_TRUE(test, > + drm_mode_parse_command_line_for_connector(cmdline, > + connector, > + cmdline_mode)); > + > + mutex_lock(&drm->mode_config.mutex); > + ret = drm_helper_probe_single_connector_modes(connector, 1920, 1080); > + mutex_unlock(&drm->mode_config.mutex); > + KUNIT_ASSERT_GT(test, ret, 0); > + > + mode = drm_connector_pick_cmdline_mode(connector); > + KUNIT_ASSERT_NOT_NULL(test, mode); > + > + KUNIT_EXPECT_TRUE(test, drm_mode_equal(drm_mode_analog_ntsc_480i(drm), mode)); > +} > + > static void drm_test_pick_cmdline_named_pal(struct kunit *test) > { > struct drm_client_modeset_test_priv *priv = test->priv; > @@ -159,10 +185,38 @@ static void drm_test_pick_cmdline_named_pal(struct kunit *test) > KUNIT_EXPECT_TRUE(test, drm_mode_equal(drm_mode_analog_pal_576i(drm), mode)); > } > > +static void drm_test_pick_cmdline_named_pal_m(struct kunit *test) > +{ > + struct drm_client_modeset_test_priv *priv = test->priv; > + struct drm_device *drm = priv->drm; > + struct drm_connector *connector = &priv->connector; > + struct drm_cmdline_mode *cmdline_mode = &connector->cmdline_mode; > + struct drm_display_mode *mode; > + const char *cmdline = "PAL-M"; > + int ret; > + > + KUNIT_ASSERT_TRUE(test, > + drm_mode_parse_command_line_for_connector(cmdline, > + connector, > + cmdline_mode)); > + > + mutex_lock(&drm->mode_config.mutex); > + ret = drm_helper_probe_single_connector_modes(connector, 1920, 1080); > + mutex_unlock(&drm->mode_config.mutex); > + KUNIT_ASSERT_GT(test, ret, 0); > + > + mode = drm_connector_pick_cmdline_mode(connector); > + KUNIT_ASSERT_NOT_NULL(test, mode); > + > + KUNIT_EXPECT_TRUE(test, drm_mode_equal(drm_mode_analog_ntsc_480i(drm), mode)); > +} > + > static struct kunit_case drm_test_pick_cmdline_tests[] = { > KUNIT_CASE(drm_test_pick_cmdline_res_1920_1080_60), > KUNIT_CASE(drm_test_pick_cmdline_named_ntsc), > + KUNIT_CASE(drm_test_pick_cmdline_named_ntsc_j), > KUNIT_CASE(drm_test_pick_cmdline_named_pal), > + KUNIT_CASE(drm_test_pick_cmdline_named_pal_m), > {} > }; > >