From patchwork Mon Aug 14 13:56:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2797542vqi; Mon, 14 Aug 2023 07:55:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDQnheA9IPGIUGd/G6/5kD0ctl1gXxy61R5Y/rB0G77OVhQ9H4d+pZ8MomVKgwiUlyyDpg X-Received: by 2002:a17:902:c3cd:b0:1b8:6987:de84 with SMTP id j13-20020a170902c3cd00b001b86987de84mr10619709plj.48.1692024930193; Mon, 14 Aug 2023 07:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692024930; cv=none; d=google.com; s=arc-20160816; b=LnguGV9W0yi/OhMopU861pjBxAYchlVR31JtnSeLgVUGnwQcVUXHW3ZvBkKgauPwt+ Z1+ZUm3vrP0pSTwx5y74G65V7iHbS2XZBBSRfPkBKwIzPkWbhdW7eoS4/UO8jtD2X75m tfmt5vlPeS+v5geWz5Io/37AxJN97JT4DLT+CoREVaJqWBWJJS3ZUEG5GDTyfFtp9+1G Vdqt0JAcdk4k1YnZ2N/X52BEH0IF5BGOl//lzEYGFqEHb4lBYhgnPYhu6Vy1F7wKXRl8 fAFyG3g9MIAIWcjUl+V4hu/WiQa9Y7n0pJna56v/AOXOM5iBqJqCtvm4EomGlBGyTWR6 L85g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:dkim-signature; bh=DrDPuXLpPeA0MWguaMZ/qR8kV41NfDIooRU1/dvc1jw=; fh=XsS7fCnS6jyV48OHq4AWazZQaFUKJmjcq7fZaQkmGOY=; b=w1Mkvm0P21EDT/tywedkTCP10k2II71r41bnp53XOiYNbZPsedYYMhiQDeznbQT8wl JRE/o9AZWPJW3xMSRuGX2Nr8Qj6cSphJvWY4nDMC6zPqGabMScQDACav07azVNr1vaDN VyX3YXnVtGwKUVuBOM3sJ8q+tFUwI/BRNxR7U0X16VQS2YiRvBCFXN2XUURSIs5rcbrV UmQ6qq7hzEB49SUyBhmeS5BTSilpKix6K4M3cbE8MlPl3U9M2GyP6NOT9UfOo/sPALDp 3k3VOnUFbn92XUzocgGfZbt45ecB/v5E3KkDa8QA5cqfoKeLgaug6fuzVcJ3abXykIlf R8iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gTedmIqz; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020a170902b7c100b001bd949bcd75si8288006plz.575.2023.08.14.07.55.15; Mon, 14 Aug 2023 07:55:30 -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=@kernel.org header.s=k20201202 header.b=gTedmIqz; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231665AbjHNN4v (ORCPT + 99 others); Mon, 14 Aug 2023 09:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231704AbjHNN42 (ORCPT ); Mon, 14 Aug 2023 09:56:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E921E10E2 for ; Mon, 14 Aug 2023 06:56:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B118620E7 for ; Mon, 14 Aug 2023 13:56:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60183C433C7; Mon, 14 Aug 2023 13:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692021385; bh=JQvrkvdcjT+72APqdKAF12E5jYqVDgzA9uIhLzFUaSg=; h=From:Subject:Date:To:Cc:From; b=gTedmIqzIsxwscoice2qOuAw4wCUF2X0RhgGsJ85iollJtEZP5A2ROt21WLtuNQ2R QUyYNbNr4kGMZRb4BUAVNRNw0Mihp3h8Y3pdNUIdShIPESx4ZqpbVnsD8sf6Kw9uG6 iarYhAOqCQN0thxaIC4KHpp7rUxOyEelzb8rgW+HKFRN9aPWaa1TEr0aV4N+6nu9L6 amlz3Q0n7qqXozXBKLUZEgVwRMYrEAbDKAUuCqf4waZE/Xq4f59bJrzV9zuL0xD/4Q aP4tRVadPdnVLpF1XtZmfhqFtZ3zYwPN7wsVGsN6YFMbkylVqS3NuE4EVLIaLO8vP9 h7GagRvnyhVGA== From: Maxime Ripard Subject: [PATCH RFC 00/13] drm/connector: Create HDMI Connector infrastructure Date: Mon, 14 Aug 2023 15:56:12 +0200 Message-Id: <20230814-kms-hdmi-connector-state-v1-0-048054df3654@kernel.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAHwy2mQC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI2MDC0MT3ezcYt2MlNxM3eT8vLzU5JL8It3iksSSVF0zQzNzC/NUM3NLI3M loPaCotS0zAqw0dFKQW7OSrG1tQAEmt6NbwAAAA== To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Emma Anholt Cc: Hans Verkuil , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Maxime Ripard X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2844; i=mripard@kernel.org; h=from:subject:message-id; bh=JQvrkvdcjT+72APqdKAF12E5jYqVDgzA9uIhLzFUaSg=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCm3jNpWxOXveGnWbyLKeWqrYVpH5JZ/V8Ueqyxi0DNqX Z38cMvUjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEzkcDIjw5O5dVJuiV/FCjzi Fm8vZEp0Feksj955v1RORuhcWYy0IyPDP/Y/7Aee76m9nvBJ48vNRQf+5K1g3rtR/t/7ZW6b7gc 84wAA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774216733273443951 X-GMAIL-MSGID: 1774216733273443951 Hi, Here's a series that creates a subclass of drm_connector 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 piec to make it shareable are a bunch of extra variables stored in a state (current bpc, format, RGB range selection, etc.). Thus, I decided to create 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. Last week, Hans Verkuil also expressed interest in retrieving the infoframes generated from userspace to create an infoframe-decode tool. This series thus leverages the infoframe generation code to expose it through debugfs. This entire series is only build-tested at the moment. Let me know what you think, Maxime Signed-off-by: Maxime Ripard --- Maxime Ripard (13): drm/connector: Introduce an HDMI connector drm/connector: hdmi: Create a custom state drm/connector: hdmi: Add Broadcast RGB property drm/connector: hdmi: Add helper to get the RGB range drm/connector: hdmi: Add output BPC to the connector state drm/connector: hdmi: Add support for output format drm/connector: hdmi: Calculate TMDS character rate drm/connector: hdmi: Add custom hook to filter TMDS character rate drm/connector: hdmi: Compute bpc and format automatically drm/connector: hdmi: Add Infoframes generation drm/connector: hdmi: Create Infoframe DebugFS entries drm/vc4: hdmi: Create destroy state implementation drm/vc4: hdmi: Switch to HDMI connector drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_hdmi_connector.c | 1112 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_hdmi.c | 720 ++++------------------ drivers/gpu/drm/vc4/vc4_hdmi.h | 37 +- drivers/gpu/drm/vc4/vc4_hdmi_phy.c | 4 +- include/drm/drm_connector.h | 256 ++++++++ 6 files changed, 1508 insertions(+), 622 deletions(-) --- base-commit: 5d0c230f1de8c7515b6567d9afba1f196fb4e2f4 change-id: 20230814-kms-hdmi-connector-state-616787e67927 Best regards,