Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2066340lqb; Mon, 27 May 2024 06:58:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXMMmLf1/96OqoGboUYa1J3xooVEUFCXL6sCzr9Lo9IHZS5xnktOu0gEbv6WSXVA03mgWAfIDu68pbVdFjA72qtcTmxuqGnt0a42l2RKg== X-Google-Smtp-Source: AGHT+IFB9QaLgu84rjEKlwV+uU4ZBwCuZXeMILF3rn7iFZ/Z5UR+9tL9H+JbcopZ8xU4qc1cm6pW X-Received: by 2002:a17:906:c217:b0:a62:2ef9:139 with SMTP id a640c23a62f3a-a6262f5c244mr601942766b.0.1716818302404; Mon, 27 May 2024 06:58:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716818302; cv=pass; d=google.com; s=arc-20160816; b=qndrd3lUeqfNhZxlJoSCPKxwEx4Fb9m97ktU/64FBE2hSz290XSSo1K9A8trQHEOMt JsnsDMcErBm/QTn9YitD7KGp5Y3fOkyx29+Kj7B0F5kM8kv4MHY47hhyV5ZbCmE0Sflc 8N1C/eQ2J+ckM/AXtddPRJ2Z/L+Q5uVMOE/bHd9JSlbaAwutqavCPIrCyXBCxYudg1MG 0i6roHuiiFAQQw3q8NqkGETJoZA8auvDUJwaOj7hLHvCH+jvMALn1iXj7pKfyNkmIQ0X l8/4UyKp/HYDc5U+kjt0a6L0ZhHTFPa8wzw5mQkEYhzyBwRRPnTdxX4LHZ9x3TcpjYv0 NYmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=7CyviKBL67t9FNgX7m0wjMjSDJ2iHjG5lKqCBB6VzfQ=; fh=8Km3SgsDgF6VXW7Co3+gUmsnFka4af/la2qDFRYIHR4=; b=HVX0ahsqTIM7IFNp31UgweBvanZNLA2e/dQXX1Fvh6Aj3PKS6kbKJkKKAFh2B3zHj4 vqK02dWP3aY9bCYcqHX2DBJjx4Tk512BXqkK0TQyfVAXx+RE7JAo1u/3zI+TYbWlVdjF 7qePFl5e+YyW5GlRcwxHQIz4SvbXdi6Zl1CSAfnYNvoy7z5s44ea4AigGjIP3b7Sjx2b zJgZPMUW/QsqYBv1EzKEMoCzApbMGd0WMKNzK1fFSi4TlMzzWlHnV+4QXE7oHpdLpn1J WXZP/jGIaHXb8YY22da5z8yC/6XJT863jqOdfeXG7bA99xXyz4q2ffTO/lA+eUkChIFg YUiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ggsy90vI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-190762-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190762-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cd93154si385220866b.806.2024.05.27.06.58.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 06:58:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190762-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ggsy90vI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-190762-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190762-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F31011F21519 for ; Mon, 27 May 2024 13:58:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFC6115EFD5; Mon, 27 May 2024 13:58:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ggsy90vI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 629181640B; Mon, 27 May 2024 13:58:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716818288; cv=none; b=o2GOlgAliz8u+UYtJxj5mavhPFYRZAo4bwuCHn3L6gEawB16Ptnb3TMv+LSNSEOoZLN+Y3cAAEGxnSrz3LmTfUr+IQtn/2eyQyGSXHt775qKCmLxRMLgHO0N7dqocJ/aMZZ7WyDR6P8qLy1h003Seyxm1R9gAOYxZSjR2ksURDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716818288; c=relaxed/simple; bh=XMjmzWFIyU5+xo6dDo3Oz66O+liT3J0YlkPIzMV6RCI=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=GfJPOAXfvg46oBH/lzRgpvNt5bzDMq3QoSqNCxkq+KbwPCPip55mCUYQhqpY3YvZ2W63yZL9JmuKIb9/Vi1irtf+BoOFql+SErZPjH2eDrCA0ANEi5+9US1HGRLiHu5hQbW4uGoAOULEPTLxt7On/oteee9F7vHSSm2/U0+j1GI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ggsy90vI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9B90C2BBFC; Mon, 27 May 2024 13:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716818288; bh=XMjmzWFIyU5+xo6dDo3Oz66O+liT3J0YlkPIzMV6RCI=; h=From:Subject:Date:To:Cc:From; b=Ggsy90vIE43puQCvwWJhwFAHG6yukUtPlGlBJ3BEevIXQe/O+12QCQXSDj4pNU+ko Y3aBUZqamyNfBUDSqDpbh4Odx2crid8RTMKAxBgXBjk+G85nfYqjK58ril3I3RD8Zd PzTUZdg72eSbCx9jY79C0MdPPTG1ivslxi/QAOfvRKzCVxRe9mAr1YZWGZWUxnPQg2 RWkE/3xTkRElj1NoyadQ2qnucj7rCvEF44gN/FoZ3AE1d/2GMcoUExalNxd5A9U4kl yKVfaRJwo5RuTm4I+NQlcHyQlUtlxh0Jo0nIbRgKd7NgvSMU7Fg1xnTKuufd9RXPox OKo5MTcDghBlQ== From: Maxime Ripard Subject: [PATCH v15 00/29] drm/connector: Create HDMI Connector infrastructure Date: Mon, 27 May 2024 15:57:49 +0200 Message-Id: <20240527-kms-hdmi-connector-state-v15-0-c5af16c3aae2@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAF6RVGYC/43SzWrEIBAH8FcpOTfF+XDUnvoepYdEx25om4VkW SjLvnvdQpsUQXoSFX+Ozv/SrbpMunaPd5du0fO0Tse5TMDe33XxMMyv2k+pLHRokIwH7t8+1v6 QPqY+HudZ4+m49OtpOGkvIM47FRfQdeX4YVrL5uc3fYYyPP8DOUNvesPeWE6ZxPLTmy6zvj8cl 9fupahn3KSApiFhkcAFwjSklFyqJPqVwBA0JCoSoR9NHpRpcJXEmwToGxIXKToxCNaTEa0ku0l oXEOyRRJLXiEkIa5fJz8Sl9uwIUmRMo8xxeCCSq4kt5OwJbki+cxDts7mqFhJfpOo+TpfJM0yS CYIwmMlhZ0Erd6FIiW2PhhCIq7zBGZHYYsCc6tKIjhPAj742oK9JS3rlvNoxZucY0aB2sLNYqS WdUs6UckCRzOWwmqLNss2Px7ou4dDjlaz+rFOKPDOav/XLe0WgjVp5Kzpbxev1+sXVuBfCn4EA AA= To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jonathan Corbet , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andy Yan Cc: Hans Verkuil , Sebastian Wick , =?utf-8?q?Ville_Syrj=C3=A4l=C3=A4?= , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Maxime Ripard , Dave Stevenson , Sui Jingfeng , Dmitry Baryshkov , Pekka Paalanen , =?utf-8?q?Ma=C3=ADra_Canal?= , Andy Yan X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=11626; i=mripard@kernel.org; h=from:subject:message-id; bh=XMjmzWFIyU5+xo6dDo3Oz66O+liT3J0YlkPIzMV6RCI=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDGkhE+ODNwnzp9vvFgioTZpz27vr/nHRLauPCb1N2XVRd FnA63ePOqayMAhzMsiKKbI8kQk7vbx9cZWD/cofMHNYmUCGMHBxCsBEZogw1mdujtFq6JtuW14i dFa645TE1vaeHpbK3/HmMcpf5f7bfXnXVcNq9EDSQ+ivwA4PTe1Qxjo9r5naXOkGkgb3o6rK1A/ O3Rn7zMhV37di223b2zfiA89/3flqveAErU2Wf5Iagxbr3gQA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Hi, Here's a series that creates some extra infrastructure specifically targeted at HDMI controllers. The idea behind this series came from a recent discussion on IRC during which we discussed infoframes generation of i915 vs everything else. Infoframes generation code still requires some decent boilerplate, with each driver doing some variation of it. In parallel, while working on vc4, we ended up converting a lot of i915 logic (mostly around format / bpc selection, and scrambler setup) to apply on top of a driver that relies only on helpers. While currently sitting in the vc4 driver, none of that logic actually relies on any driver or hardware-specific behaviour. The only missing piece to make it shareable are a bunch of extra variables stored in a state (current bpc, format, RGB range selection, etc.). The initial implementation was relying on some generic subclass of drm_connector to address HDMI connectors, with a bunch of helpers that will take care of all the "HDMI Spec" related code. Scrambler setup is missing at the moment but can easily be plugged in. The feedback was that creating a connector subclass like was done for writeback would prevent the adoption of those helpers since it couldn't be used in all situations (like when the connector driver can implement multiple output) and required more churn to cast between the drm_connector and its subclass. The decision was thus to provide a set of helper and to store the required variables in drm_connector and drm_connector_state. This what has been implemented now. Hans Verkuil also expressed interest in implementing a mechanism in v4l2 to retrieve infoframes from HDMI receiver and implementing a tool to decode (and eventually check) infoframes. His current work on edid-decode to enable that based on that series can be found here: https://git.linuxtv.org/hverkuil/edid-decode.git/log/?h=hverkuil And some more context here: https://lore.kernel.org/dri-devel/50db7366-cd3d-4675-aaad-b857202234de@xs4all.nl/ This series thus leverages the infoframe generation code to expose it through debugfs. I also used the occasion to unit-test everything but the infoframe generation, which can come later once I get a proper understanding of what the infoframe are supposed to look like. This required to add some extra kunit helpers and infrastructure to have multiple EDIDs and allow each test to run with a particular set of capabilities. This entire series has been tested on a Pi4, passes all its unittests (125 new tests), and has only been build-tested for sunxi and rockchip. Let me know what you think, Maxime Signed-off-by: Maxime Ripard --- Changes in v15: - Fix YUV422 bpc check - Mention explicitly (and in the logs) that YUV420 isn't supported for now - Fix warning when running the bpc test - Change the order of the drm_mode_obj_find_prop_id export patch - Fix some sun4i changes having made their way into the rockchip patch - Drop spurious Broadcast RGB documentation - Link to v14: https://lore.kernel.org/r/20240521-kms-hdmi-connector-state-v14-0-51950db4fedb@kernel.org Changes in v14: - Warn instead of rejecting the configuration if RGB is missing due to some bad or faulty EDID - Link to v13: https://lore.kernel.org/r/20240507-kms-hdmi-connector-state-v13-0-8fafc5efe8be@kernel.org Changes in v13: - Adapt to latest Kconfig helper changes - Fixes for sun4i and rockchip - Rebase on current drm-misc-next - Link to v12: https://lore.kernel.org/r/20240423-kms-hdmi-connector-state-v12-0-3338e4c0b189@kernel.org Changes in v12: - Rebase on current drm-misc-next - Remove VIC check in clock rate computation function - Invert RGB range logic to signal limited range instead of full like before - Link to v11: https://lore.kernel.org/r/20240326-kms-hdmi-connector-state-v11-0-c5680ffcf261@kernel.org Changes in v11: - Turn the HDMI state helpers into a separate C file under drivers/gpu/drm/display - Rework the Kconfig options too to prevent configuration breakages. - Link to v10: https://lore.kernel.org/r/20240321-kms-hdmi-connector-state-v10-0-e6c178361898@kernel.org Changes in v10: - Drop the YUV422 fallback, and adjust the tests accordingly - Fix HDMI infoframe handling - Remove the infoframe copy in drm_connector - Add a TODO that drm_hdmi_avi_infoframe_quant_range() only works for RGB - Add a TODO for the YUV420 selection - Fix a few bugs in vc4 - Change the logging from driver to KMS for the helpers - Drop UPDATE_INFOFRAME macro - Add infoframe code logging - Document the selection of 8bpc for VIC1 - Rename state to conn_state where relevant - Link to v9: https://lore.kernel.org/r/20240311-kms-hdmi-connector-state-v9-0-d45890323344@kernel.org Changes in v9: - Generate every infoframe but the HDMI vendor one if has_hdmi_infoframe isn't set - Fix typos in the doc - Removed undef for inexisting macro - Improve the Broadcast RGB sanitation test - Make EDID bytes array const - Link to v8: https://lore.kernel.org/r/20240307-kms-hdmi-connector-state-v8-0-ef6a6f31964b@kernel.org Changes in v8: - Drop applied patches - Drop the YUV limited range mention in the Broadcast RGB documentation - Rephrase the vc4_dummy_plane removal commit log - Move infroframe mutex initialisation to the main drm_connector_init function to make sure it's always initialised - Link to v7: https://lore.kernel.org/r/20240222-kms-hdmi-connector-state-v7-0-8f4af575fce2@kernel.org Changes in v7: - Rebased on top of current next - Only consider the Broadcast RGB property if the output format is RGB, and use a limited range otherwise - Document the fact that Broadcast RGB only applies if the output format is RGB - Add some test to make sure we always get a limited range if we have a YCbCr output format. - Link to v6: https://lore.kernel.org/r/20240212-kms-hdmi-connector-state-v6-0-f4bcdc979e6f@kernel.org Changes in v6: - Rebased on top of current next - Split the tests into separate patches - Improve the Broadcast RGB documentation - Link to v5: https://lore.kernel.org/r/20231207-kms-hdmi-connector-state-v5-0-6538e19d634d@kernel.org Changes in v5: - Dropped the connector init arg checking patch, and the related kunit tests - Dropped HDMI Vendor infoframes in rockchip inno_hdmi - Fixed the build warnings - Link to v4: https://lore.kernel.org/r/20231128-kms-hdmi-connector-state-v4-0-c7602158306e@kernel.org Changes in v4: - Create unit tests for everything but infoframes - Fix a number of bugs identified by the unit tests - Rename DRM (Dynamic Range and Mastering) infoframe file to HDR_DRM - Drop RFC status - Link to v3: https://lore.kernel.org/r/20231031-kms-hdmi-connector-state-v3-0-328b0fae43a7@kernel.org Changes in v3: - Made sure the series work on the RaspberryPi4 - Handle YUV420 in the char clock rate computation - Use the maximum bpc value the connector allows at reset - Expose the RGB Limited vs Full Range value in the connector state instead of through a helper - Fix Broadcast RGB documentation - Add more debug logging - Small fixes here and there - Link to v2: https://lore.kernel.org/r/20230920-kms-hdmi-connector-state-v2-0-17932daddd7d@kernel.org Changes in v2: - Change from a subclass to a set of helpers for drm_connector and drm_connector state - Don't assume that all drivers support RGB, YUV420 and YUV422 but make them provide a bitfield instead. - Don't assume that all drivers support the Broadcast RGB property but make them call the registration helper. - Document the Broacast RGB property - Convert the inno_hdmi and sun4i_hdmi driver. - Link to v1: https://lore.kernel.org/r/20230814-kms-hdmi-connector-state-v1-0-048054df3654@kernel.org --- Maxime Ripard (29): drm/connector: Introduce an HDMI connector initialization function drm/tests: connector: Add tests for drmm_connector_hdmi_init drm/connector: hdmi: Create an HDMI sub-state drm/connector: hdmi: Add output BPC to the connector state drm/mode_object: Export drm_mode_obj_find_prop_id for tests drm/tests: Add output bpc tests drm/connector: hdmi: Add support for output format drm/tests: Add output formats tests drm/display: hdmi: Add HDMI compute clock helper drm/tests: Add HDMI TDMS character rate tests drm/connector: hdmi: Calculate TMDS character rate drm/tests: Add TDMS character rate connector state tests drm/connector: hdmi: Add custom hook to filter TMDS character rate drm/tests: Add HDMI connector rate filter hook tests drm/connector: hdmi: Compute bpc and format automatically drm/tests: Add HDMI connector bpc and format tests drm/doc: Remove unused Broadcast RGB Property drm/connector: hdmi: Add Broadcast RGB property drm/tests: Add tests for Broadcast RGB property drm/connector: hdmi: Add RGB Quantization Range to the connector state drm/tests: Add RGB Quantization tests drm/connector: hdmi: Add Infoframes generation drm/tests: Add infoframes test drm/connector: hdmi: Create Infoframe DebugFS entries drm/vc4: hdmi: Switch to HDMI connector drm/vc4: tests: Remove vc4_dummy_plane structure drm/vc4: tests: Convert to plane creation helper drm/rockchip: inno_hdmi: Switch to HDMI connector drm/sun4i: hdmi: Switch to HDMI connector Documentation/gpu/kms-properties.csv | 2 - drivers/gpu/drm/Kconfig | 1 + drivers/gpu/drm/display/Kconfig | 7 + drivers/gpu/drm/display/Makefile | 2 + drivers/gpu/drm/display/drm_hdmi_helper.c | 61 + drivers/gpu/drm/display/drm_hdmi_state_helper.c | 716 ++++++++ drivers/gpu/drm/drm_atomic.c | 11 + drivers/gpu/drm/drm_atomic_uapi.c | 4 + drivers/gpu/drm/drm_connector.c | 194 +++ drivers/gpu/drm/drm_debugfs.c | 152 ++ drivers/gpu/drm/drm_mode_object.c | 1 + drivers/gpu/drm/rockchip/Kconfig | 3 + drivers/gpu/drm/rockchip/inno_hdmi.c | 172 +- drivers/gpu/drm/sun4i/Kconfig | 3 + drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 84 +- drivers/gpu/drm/tests/Makefile | 1 + drivers/gpu/drm/tests/drm_connector_test.c | 1051 +++++++++++- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 1743 ++++++++++++++++++++ drivers/gpu/drm/tests/drm_kunit_edid.h | 482 ++++++ drivers/gpu/drm/vc4/Kconfig | 1 + drivers/gpu/drm/vc4/tests/vc4_mock.c | 6 +- drivers/gpu/drm/vc4/tests/vc4_mock.h | 9 +- drivers/gpu/drm/vc4/tests/vc4_mock_plane.c | 44 +- drivers/gpu/drm/vc4/vc4_hdmi.c | 644 +------- drivers/gpu/drm/vc4/vc4_hdmi.h | 44 +- drivers/gpu/drm/vc4/vc4_hdmi_phy.c | 6 +- include/drm/display/drm_hdmi_helper.h | 4 + include/drm/display/drm_hdmi_state_helper.h | 23 + include/drm/drm_connector.h | 229 +++ 29 files changed, 4911 insertions(+), 789 deletions(-) --- base-commit: 533db32499de1618443b2249bc20011cd5abc9d9 change-id: 20230814-kms-hdmi-connector-state-616787e67927 Best regards, -- Maxime Ripard