dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: "Maxime Ripard" <mripard@kernel.org>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Emma Anholt" <emma@anholt.net>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>, "Chen-Yu Tsai" <wens@csie.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v4 00/45] drm/connector: Create HDMI Connector infrastructure
Date: Tue, 28 Nov 2023 11:45:40 +0100	[thread overview]
Message-ID: <50db7366-cd3d-4675-aaad-b857202234de@xs4all.nl> (raw)
In-Reply-To: <20231128-kms-hdmi-connector-state-v4-0-c7602158306e@kernel.org>

On 28/11/2023 11:24, Maxime Ripard wrote:
> 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 an
> infoframe-decode tool.

For those who are interested in the InfoFrame parser:

https://git.linuxtv.org/hverkuil/edid-decode.git/log/?h=hverkuil

This is work-in-progress, and will definitely be rebased at times.

It is integrated into edid-decode since I want to be able to check the
InfoFrames against the EDID capabilities. If no EDID is given, then
those checks are skipped.

You can parse the InfoFrames with -I <path-to-if-file>. All known InfoFrames
are parsed, and I am working on adding the checks against the EDID whenever
time permits.

It's quite handy already as a parser, but it is really the checks against the
EDID that will make this really useful.

A related note: exposing InfoFrames is equally useful for the media subsystem
for video receivers (and the odd V4L2 video transmitter driver). I did look
at whether any of this drm code could be generalized, but it is too different
and frankly not worth the effort.

Also, when receiving InfoFrames you don't want to use the hdmi.h functions,
you want to dump the raw unprocessed InfoFrame.

I did a proof-of-concept for the adv7511-v4l2 tx and adv7604 rx drivers here:

https://git.linuxtv.org/hverkuil/media_tree.git/commit/?h=infoframe&id=19c80e21b30e2cafc0669cfae093a0b7a17c6b55

I am using debugfs here as well, but I am not actually certain whether that's
the best approach, esp. for receivers where access to InfoFrames can be very
useful for userspace. Options are e.g. /sys/class/video4linux/<devnode>/infoframes
or perhaps using V4L2 controls. TBD.

Regards,

	Hans

> 
> 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 <mripard@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 (45):
>       drm/tests: helpers: Include missing drm_drv header
>       drm/tests: helpers: Add atomic helpers
>       drm/tests: Add helper to create mock plane
>       drm/tests: Add helper to create mock crtc
>       drm/connector: Check drm_connector_init pointers arguments
>       drm/tests: connector: Add tests for drmm_connector_init
>       drm/connector: Introduce an HDMI connector initialization function
>       drm/connector: hdmi: Create an HDMI sub-state
>       drm/connector: hdmi: Add Broadcast RGB property
>       drm/connector: hdmi: Add RGB Quantization Range to the connector state
>       drm/connector: hdmi: Add output BPC to the connector state
>       drm/connector: hdmi: Add support for output format
>       drm/connector: hdmi: Add HDMI compute clock helper
>       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
>       drm/vc4: tests: Remove vc4_dummy_plane structure
>       drm/vc4: tests: Convert to plane creation helper
>       drm/rockchip: inno_hdmi: Remove useless mode_fixup
>       drm/rockchip: inno_hdmi: Remove useless copy of drm_display_mode
>       drm/rockchip: inno_hdmi: Switch encoder hooks to atomic
>       drm/rockchip: inno_hdmi: Get rid of mode_set
>       drm/rockchip: inno_hdmi: no need to store vic
>       drm/rockchip: inno_hdmi: Remove unneeded has audio flag
>       drm/rockchip: inno_hdmi: Remove useless input format
>       drm/rockchip: inno_hdmi: Remove useless output format
>       drm/rockchip: inno_hdmi: Remove useless colorimetry
>       drm/rockchip: inno_hdmi: Remove useless enum
>       drm/rockchip: inno_hdmi: Remove tmds rate from structure
>       drm/rockchip: inno_hdmi: Remove useless coeff_csc matrix
>       drm/rockchip: inno_hdmi: Remove useless mode_valid
>       drm/rockchip: inno_hdmi: Move infoframe disable to separate function
>       drm/rockchip: inno_hdmi: Create mask retrieval functions
>       drm/rockchip: inno_hdmi: Switch to infoframe type
>       drm/rockchip: inno_hdmi: Remove unused drm device pointer
>       drm/rockchip: inno_hdmi: Switch to HDMI connector
>       drm/sun4i: hdmi: Convert encoder to atomic
>       drm/sun4i: hdmi: Move mode_set into enable
>       drm/sun4i: hdmi: Switch to container_of_const
>       drm/sun4i: hdmi: Consolidate atomic_check and mode_valid
>       drm/sun4i: hdmi: Switch to HDMI connector
> 
>  Documentation/gpu/kms-properties.csv               |    1 -
>  drivers/gpu/drm/Kconfig                            |    1 +
>  drivers/gpu/drm/drm_atomic.c                       |   11 +
>  drivers/gpu/drm/drm_atomic_state_helper.c          |  659 ++++++++
>  drivers/gpu/drm/drm_atomic_uapi.c                  |    4 +
>  drivers/gpu/drm/drm_connector.c                    |  249 +++
>  drivers/gpu/drm/drm_debugfs.c                      |  110 ++
>  drivers/gpu/drm/rockchip/inno_hdmi.c               |  409 ++---
>  drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c             |  203 ++-
>  drivers/gpu/drm/tests/Makefile                     |    1 +
>  .../gpu/drm/tests/drm_atomic_state_helper_test.c   | 1728 ++++++++++++++++++++
>  drivers/gpu/drm/tests/drm_connector_test.c         | 1345 ++++++++++++++-
>  drivers/gpu/drm/tests/drm_kunit_edid.h             |  482 ++++++
>  drivers/gpu/drm/tests/drm_kunit_helpers.c          |  150 ++
>  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                     |  624 +------
>  drivers/gpu/drm/vc4/vc4_hdmi.h                     |   44 +-
>  drivers/gpu/drm/vc4/vc4_hdmi_phy.c                 |    6 +-
>  include/drm/drm_atomic_state_helper.h              |   12 +
>  include/drm/drm_connector.h                        |  257 +++
>  include/drm/drm_kunit_helpers.h                    |   23 +
>  23 files changed, 5389 insertions(+), 989 deletions(-)
> ---
> base-commit: 815d8b0425ad1164e45953ac3d56a9f6f63792cc
> change-id: 20230814-kms-hdmi-connector-state-616787e67927
> 
> Best regards,


      parent reply	other threads:[~2023-11-28 10:45 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 10:24 [PATCH v4 00/45] drm/connector: Create HDMI Connector infrastructure Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 01/45] drm/tests: helpers: Include missing drm_drv header Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 02/45] drm/tests: helpers: Add atomic helpers Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 03/45] drm/tests: Add helper to create mock plane Maxime Ripard
2023-11-28 14:57   ` kernel test robot
2023-11-28 10:24 ` [PATCH v4 04/45] drm/tests: Add helper to create mock crtc Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 05/45] drm/connector: Check drm_connector_init pointers arguments Maxime Ripard
2023-11-28 12:54   ` Jani Nikula
2023-11-28 13:29     ` Maxime Ripard
2023-11-28 13:49       ` Ville Syrjälä
2023-11-29  9:11         ` Maxime Ripard
2023-11-29  9:18           ` Ville Syrjälä
2023-12-01  9:01             ` Maxime Ripard
2023-12-01 15:15               ` Ville Syrjälä
2023-11-29  9:38           ` Jani Nikula
2023-11-29 11:10             ` Maxime Ripard
2023-11-29 11:40               ` Jani Nikula
2023-11-29 13:26                 ` Maxime Ripard
2023-11-29 10:12         ` Pekka Paalanen
2023-11-29 10:25           ` Ville Syrjälä
2023-12-01 15:17             ` Ville Syrjälä
2023-11-28 10:24 ` [PATCH v4 06/45] drm/tests: connector: Add tests for drmm_connector_init Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 07/45] drm/connector: Introduce an HDMI connector initialization function Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 08/45] drm/connector: hdmi: Create an HDMI sub-state Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 09/45] drm/connector: hdmi: Add Broadcast RGB property Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 10/45] drm/connector: hdmi: Add RGB Quantization Range to the connector state Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 11/45] drm/connector: hdmi: Add output BPC " Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 12/45] drm/connector: hdmi: Add support for output format Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 13/45] drm/connector: hdmi: Add HDMI compute clock helper Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 14/45] drm/connector: hdmi: Calculate TMDS character rate Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 15/45] drm/connector: hdmi: Add custom hook to filter " Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 16/45] drm/connector: hdmi: Compute bpc and format automatically Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 17/45] drm/connector: hdmi: Add Infoframes generation Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 18/45] drm/connector: hdmi: Create Infoframe DebugFS entries Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 19/45] drm/vc4: hdmi: Create destroy state implementation Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 20/45] drm/vc4: hdmi: Switch to HDMI connector Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 21/45] drm/vc4: tests: Remove vc4_dummy_plane structure Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 22/45] drm/vc4: tests: Convert to plane creation helper Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 23/45] drm/rockchip: inno_hdmi: Remove useless mode_fixup Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 24/45] drm/rockchip: inno_hdmi: Remove useless copy of drm_display_mode Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 25/45] drm/rockchip: inno_hdmi: Switch encoder hooks to atomic Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 26/45] drm/rockchip: inno_hdmi: Get rid of mode_set Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 27/45] drm/rockchip: inno_hdmi: no need to store vic Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 28/45] drm/rockchip: inno_hdmi: Remove unneeded has audio flag Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 29/45] drm/rockchip: inno_hdmi: Remove useless input format Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 30/45] drm/rockchip: inno_hdmi: Remove useless output format Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 31/45] drm/rockchip: inno_hdmi: Remove useless colorimetry Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 32/45] drm/rockchip: inno_hdmi: Remove useless enum Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 33/45] drm/rockchip: inno_hdmi: Remove tmds rate from structure Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 34/45] drm/rockchip: inno_hdmi: Remove useless coeff_csc matrix Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 35/45] drm/rockchip: inno_hdmi: Remove useless mode_valid Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 36/45] drm/rockchip: inno_hdmi: Move infoframe disable to separate function Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 37/45] drm/rockchip: inno_hdmi: Create mask retrieval functions Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 38/45] drm/rockchip: inno_hdmi: Switch to infoframe type Maxime Ripard
2023-11-28 11:45   ` Johan Jonker
2023-11-28 10:24 ` [PATCH v4 39/45] drm/rockchip: inno_hdmi: Remove unused drm device pointer Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 40/45] drm/rockchip: inno_hdmi: Switch to HDMI connector Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 41/45] drm/sun4i: hdmi: Convert encoder to atomic Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 42/45] drm/sun4i: hdmi: Move mode_set into enable Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 43/45] drm/sun4i: hdmi: Switch to container_of_const Maxime Ripard
2023-11-28 14:11   ` [v4,43/45] " Sui Jingfeng
2023-11-28 10:24 ` [PATCH v4 44/45] drm/sun4i: hdmi: Consolidate atomic_check and mode_valid Maxime Ripard
2023-11-28 10:24 ` [PATCH v4 45/45] drm/sun4i: hdmi: Switch to HDMI connector Maxime Ripard
2023-11-28 10:45 ` Hans Verkuil [this message]

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=50db7366-cd3d-4675-aaad-b857202234de@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=airlied@gmail.com \
    --cc=corbet@lwn.net \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=samuel@sholland.org \
    --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).