Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp386271imn; Fri, 29 Jul 2022 09:50:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR5u/QlfBxd3guzXkLsw7v0OqqCbhrISiMm039OJt/vtoWcXOVnVqSs0jd7ZpwlR/Nc9W4Wf X-Received: by 2002:a17:902:f652:b0:156:701b:9a2a with SMTP id m18-20020a170902f65200b00156701b9a2amr4748359plg.14.1659113403747; Fri, 29 Jul 2022 09:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659113403; cv=none; d=google.com; s=arc-20160816; b=caWjnTwdoeDwQ5rHADjqodXjOgbcUXs/KzKPUMp/QPQzey4Kasl0M6u7DT11z3U6Uy RTay5JnEEUViB3lCOhSR2PUoV5o8i8sqlYQIAo/rYIxXRTWB7fl3EvtPlc9FfehmzmCF 31K6KrAQtdh18e2E0CXrhgroXmysyPpv3hbwHFlTrNQVCPxT9RN/nPtIB8xt9XK14fN4 od0d9MBxbjsNx8zvcrA/r2E/k/8sLSVTrfFOTPjqvx0EgTbWNcVqOqmDTAd/XFCJWjrl BWYl0Z8zGfA+3Nathp7sVSIvcd8llUtV5GF1mrXo9viFY6NZ05arkIKMhYU3xaTc2RuE P6ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=C+jYJd9Wl4W0Bkfo1PkjL8TjpKm/fWgkUOf3TUKzFyM=; b=CNOFcLppUrh7zvopI5QHRq4GaBZ9sF46qd4JGSBOpwOnFukwgJyE8h8zf6iIO/pqQn xA7H/qe7HJWbQXbgU6Uf4U6lnMwbVkU4hiQjlOPhJLYUeE4E7iIJns2hm06BVwtycW9Z GI7yw3pY4zSi2hB5ooDeySgvzdSD29V9EFU2a2ri2Buk+ajaDPefWfhKbREumoyBjI/V i4oRg+VYQKo1pUMEurb2vcFXXAi/b8z20Z4+jZZEGoQRMUP9EqqcYdQt868Grom6dnJG s4Pk7NFqnwkiq055ZGAnVtWBwS3FUuf0yfLpP3xx5EMU5z2oRMNAoodjPoh3YU1XtYZX f6PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=DdzWy2FJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=0hzRTYxu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a170903234500b0015ef71934fdsi4682747plh.180.2022.07.29.09.49.47; Fri, 29 Jul 2022 09:50:03 -0700 (PDT) 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=pass header.i=@cerno.tech header.s=fm2 header.b=DdzWy2FJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=0hzRTYxu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238061AbiG2QlQ (ORCPT + 99 others); Fri, 29 Jul 2022 12:41:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237718AbiG2Qkw (ORCPT ); Fri, 29 Jul 2022 12:40:52 -0400 Received: from new4-smtp.messagingengine.com (new4-smtp.messagingengine.com [66.111.4.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F4581D0EE for ; Fri, 29 Jul 2022 09:40:47 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 46506580897; Fri, 29 Jul 2022 12:35:26 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 29 Jul 2022 12:35:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm2; t=1659112526; x=1659119726; bh=C+jYJd9Wl4 W0Bkfo1PkjL8TjpKm/fWgkUOf3TUKzFyM=; b=DdzWy2FJrRnhVSk2PuB20leyMs LAJ0CpCpMV4sUP0q5x4VUToFQK4HcyKBIAAeUs/ea9oOEcS82Ux2npZLQE1krJ/J c1pOHywZR+RXbbhIswbAXdVIi4A5XG9pr9lGtwD7QexmzWSCvu27D0N5SPj1/p6j aQEmJS5W+SVu0izC/2lAHI9w9hUVfFX1IzkFQN0a1DP0tFNbf6eJD3ZCpI3aDKHt ms0bcPom61SgjdE1zPJZvKzE4WJiH6/wDAYJK62M2i/7Aoe5rPeejYoR0podU/6y wc98iFpiWyEtCK7CcyPj4qeU/mPNMKtf1YW2IZisoGxgPkkWuddQoQaURdDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1659112526; x=1659119726; bh=C+jYJd9Wl4W0B kfo1PkjL8TjpKm/fWgkUOf3TUKzFyM=; b=0hzRTYxuABZCCa2X82Xi4Cz2bz6xU zmmuBf+0g7Ly80aNp15UxfXPqeVBCvX75o2xF1b9PTMx0LHVhrAqzWUjjnIb5LZW sl0pVzRk9ZDi4pcLumRPdg3fUXIJIBjzjAOEjeVIsVlXuS8PKfkMdV9Pt3ds4RH+ D6ZTQbnkqzw3wHOIxXT2kIjzApYOPGeemxMBVTciO5g5l08EZUcZSh+SEJ2T1tgA KakrCj2oiwmvOmah0CDfnS9S+sISl8a+qNrTY6h53nQhL6r3yJjblE9iT7RC0Wfe P5NnmYVbH4TmG/HxDNRdLrg4UgBz8wIKvZ0Cy9Sc64ZJtTmixBtzTDCPw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvddujedguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffogggtoffgsehtkeertdertdejnecuhfhrohhmpeforgig ihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrf grthhtvghrnhepffekvddvteekuedujefhtdfgffevkefgvdevieejgfetgfefjefftddu ueevkeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 29 Jul 2022 12:35:23 -0400 (EDT) From: Maxime Ripard To: Jernej Skrabec , Martin Blumenstingl , Chen-Yu Tsai , Philipp Zabel , Jerome Brunet , Samuel Holland , Thomas Zimmermann , Daniel Vetter , Emma Anholt , David Airlie , Maarten Lankhorst , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Kevin Hilman , Neil Armstrong , Maxime Ripard Cc: Maxime Ripard , linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Phil Elwell , Mateusz Kwiatkowski , linux-arm-kernel@lists.infradead.org, Geert Uytterhoeven , Dave Stevenson , linux-amlogic@lists.infradead.org, dri-devel@lists.freedesktop.org, Dom Cobley Subject: [PATCH v1 00/35] drm: Analog TV Improvements Date: Fri, 29 Jul 2022 18:34:43 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v1-0-3d53ae722097@cerno.tech> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.10.0-dev-49460 X-Developer-Signature: v=1; a=openpgp-sha256; l=6103; i=maxime@cerno.tech; h=from:subject:message-id; bh=oyH2EBYkTjIG+9yKJt/0byzyaDW2WxQwQX0bPCZ5n1g=; b=owGbwMvMwCHc4XzqmfnC7acZT6slMSQ94VH6F3vJp+Tlnxie3Zt/WM3udno3M/LmF8Mdp1UOPdQ4 VLNlR0cpC4MwB4OsmCLLdcG3dnxhUW4RPB82w8xhZQIZwsDFKQATCZvCyLBGP39fX0vEM13dpvbixx n74rtqrz+aedpzdp3OpHjfedwMf8Uqj5nuvHXi8ewLJ80T/D2k2beLCxRVFjs6sT09/TTk7nwA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, 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 Hi, Here's a series aiming at improving the command line named modes support, and more importantly how we deal with all the analog TV variants. The named modes support were initially introduced to allow to specify the analog TV mode to be used. However, this was causing multiple issues: * The mode name parsed on the command line was passed directly to the driver, which had to figure out which mode it was suppose to match; * Figuring that out wasn't really easy, since the video= argument or what the userspace might not even have a name in the first place, but instead could have passed a mode with the same timings; * The fallback to matching on the timings was mostly working as long as we were supporting one 525 lines (most likely NSTC) and one 625 lines (PAL), but couldn't differentiate between two modes with the same timings (NTSC vs PAL-M vs NSTC-J for example); * There was also some overlap with the tv mode property registered by drm_mode_create_tv_properties(), but named modes weren't interacting with that property at all. * Even though that property was generic, its possible values were specific to each drivers, which made some generic support difficult. Thus, I chose to tackle in multiple steps: * A new TV norm property was introduced, with generic values, each driver reporting through a bitmask what standard it supports to the userspace; * This option was added to the command line parsing code to be able to specify it on the kernel command line, and new atomic_check and reset helpers were created to integrate properly into atomic KMS; * The named mode parsing code is now creating a proper display mode for the given named mode, and the TV standard will thus be part of the connector state; * Two drivers were converted and tested for now (vc4 and sun4i), with some backward compatibility code to translate the old TV mode to the new TV mode; Unit tests were created along the way. Nouveau, ch7006 and gud are currently broken for now since I expect that work to be reworked fairly significantly. I'm also not entirely sure about how to migrate GUD to the new property. Let me know what you think, Maxime Cc: Geert Uytterhoeven Cc: "Noralf Trønnes" Cc: Dave Stevenson Cc: Dom Cobley Cc: Phil Elwell Cc: Maarten Lankhorst Cc: Thomas Zimmermann Cc: Daniel Vetter Cc: David Airlie Cc: Signed-off-by: Maxime Ripard --- Mateusz Kwiatkowski (5): drm/vc4: vec: Refactor VEC TV mode setting drm/vc4: vec: Remove redundant atomic_mode_set drm/vc4: vec: Fix timings for VEC modes drm/vc4: vec: Fix definition of PAL-M mode drm/vc4: vec: Add support for more analog TV standards Maxime Ripard (30): drm/atomic-helper: Rename drm_atomic_helper_connector_tv_reset to avoid ambiguity drm/connector: Rename subconnector state variable drm/atomic: Add TV subconnector property to get/set_property drm/modes: Introduce 480i and 576i modes drm/connector: Add TV standard property drm/connector: Only register TV mode property if present drm/modes: Only consider bpp and refresh before options drm/client: Add some tests for drm_connector_pick_cmdline_mode() drm/modes: Move named modes parsing to a separate function drm/modes: Switch to named mode descriptors drm/modes: Fill drm_cmdline mode from named modes drmi/modes: Properly generate a drm_display_mode from a named mode drm/atomic-helper: Add a TV properties reset helper drm/atomic-helper: Add an analog TV atomic_check implementation drm/vc4: vec: Remove empty mode_fixup drm/vc4: vec: Convert to atomic helpers drm/vc4: vec: Switch for common modes drm/vc4: vec: Use TV Reset implementation drm/vc4: vec: Convert to the new TV mode property drm/sun4i: tv: Remove unused mode_valid drm/sun4i: tv: Convert to atomic hooks drm/sun4i: tv: Merge mode_set into atomic_enable drm/sun4i: tv: Remove useless function drm/sun4i: tv: Remove useless destroy function drm/sun4i: tv: Rename error label drm/sun4i: tv: Add missing reset assertion drm/sun4i: tv: Convert to the new TV mode property drm/connector: Remove TV modes property drm/modes: Introduce the tv_mode property as a command-line option drm/modes: Introduce more named modes drivers/gpu/drm/drm_atomic_state_helper.c | 166 +++++++++- drivers/gpu/drm/drm_atomic_uapi.c | 12 +- drivers/gpu/drm/drm_client_modeset.c | 4 + drivers/gpu/drm/drm_connector.c | 46 ++- drivers/gpu/drm/drm_modes.c | 198 +++++++++-- drivers/gpu/drm/gud/gud_connector.c | 2 +- drivers/gpu/drm/meson/meson_encoder_cvbs.c | 18 +- drivers/gpu/drm/meson/meson_encoder_cvbs.h | 2 +- drivers/gpu/drm/sun4i/sun4i_tv.c | 173 +++------- drivers/gpu/drm/tests/drm_cmdline_parser_test.c | 295 +++++++++++++++++ drivers/gpu/drm/tests/drm_mode_test.c | 255 +++++++++++++++ drivers/gpu/drm/vc4/vc4_hdmi.c | 2 +- drivers/gpu/drm/vc4/vc4_vec.c | 418 ++++++++++++++++-------- include/drm/drm_atomic_state_helper.h | 4 + include/drm/drm_connector.h | 40 ++- include/drm/drm_mode_config.h | 6 + include/drm/drm_modes.h | 3 + 17 files changed, 1314 insertions(+), 330 deletions(-) --- base-commit: 37b355fdaf31ee18bda9a93c2a438dc1cbf57ec9 change-id: 20220728-rpi-analog-tv-properties-0914dfcee460 Best regards, -- Maxime Ripard