linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 00/36] drm/connector: Create HDMI Connector infrastructure
@ 2024-02-22 18:13 Maxime Ripard
  2024-02-22 18:13 ` [PATCH v7 01/36] drm/tests: helpers: Include missing drm_drv header Maxime Ripard
                   ` (36 more replies)
  0 siblings, 37 replies; 93+ messages in thread
From: Maxime Ripard @ 2024-02-22 18:13 UTC (permalink / raw)
  To: Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Daniel Vetter, Jonathan Corbet, Sandy Huang, Heiko Stübner,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Hans Verkuil, Sebastian Wick, Ville Syrjälä,
	dri-devel, linux-arm-kernel, linux-doc, linux-kernel,
	linux-media, linux-rockchip, linux-sunxi, Maxime Ripard,
	Dave Stevenson, Sui Jingfeng

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 <mripard@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 (36):
      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/tests: connector: Add tests for drmm_connector_init
      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/tests: Add output bpc tests
      drm/connector: hdmi: Add support for output format
      drm/tests: Add output formats tests
      drm/connector: 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/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: 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          |  667 +++++++
 drivers/gpu/drm/drm_atomic_uapi.c                  |    4 +
 drivers/gpu/drm/drm_connector.c                    |  268 +++
 drivers/gpu/drm/drm_debugfs.c                      |  110 ++
 drivers/gpu/drm/rockchip/inno_hdmi.c               |  123 +-
 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c             |  203 +-
 drivers/gpu/drm/tests/Makefile                     |    1 +
 .../gpu/drm/tests/drm_atomic_state_helper_test.c   | 1944 ++++++++++++++++++++
 drivers/gpu/drm/tests/drm_connector_test.c         | 1227 +++++++++++-
 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                     |  638 +------
 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, 5414 insertions(+), 817 deletions(-)
---
base-commit: e31185ce00a96232308300008db193416ceb9769
change-id: 20230814-kms-hdmi-connector-state-616787e67927

Best regards,
-- 
Maxime Ripard <mripard@kernel.org>


^ permalink raw reply	[flat|nested] 93+ messages in thread
* [PATCH 0/4] Setting live video input format for ZynqMP DPSUB
@ 2024-02-27  4:44 Anatoliy Klymenko
  2024-02-27  4:44 ` [PATCH 1/4] drm: xlnx: zynqmp_dpsub: Set layer mode during creation Anatoliy Klymenko
                   ` (3 more replies)
  0 siblings, 4 replies; 93+ messages in thread
From: Anatoliy Klymenko @ 2024-02-27  4:44 UTC (permalink / raw)
  To: Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Daniel Vetter, Michal Simek,
	Andrzej Hajda, Neil Armstrong, Robert Foss, Jonas Karlman,
	Jernej Skrabec
  Cc: dri-devel, linux-arm-kernel, linux-kernel, Anatoliy Klymenko

Implement live video input format setting for ZynqMP DPSUB.

ZynqMP DPSUB can operate in 2 modes: DMA-based and live.

In the live mode, DPSUB receives a live video signal from FPGA-based CRTC.
DPSUB acts as a DRM encoder bridge in such a scenario. To properly tune
into the incoming video signal, DPSUB should be programmed with the proper
media bus format. This patch series addresses this task.

Patch 1/4: Set the DPSUB layer mode of operation prior to enabling the
layer. Allows to use layer operational mode before its enablement.

Patch 2/4: Announce supported input media bus formats via
drm_bridge_funcs.atomic_get_input_bus_fmts callback.

Patch 3/4: Program DPSUB live video input format based on selected bus
config in the new atomic bridge state.

Patch 4/4: New optional CRTC atomic helper proposal that will allow CRTC
to participate in DRM bridge chain format negotiation and impose format
restrictions. Incorporate this callback into the DRM bridge format
negotiation process.

Signed-off-by: Anatoliy Klymenko <anatoliy.klymenko@amd.com>
---
Anatoliy Klymenko (4):
      drm: xlnx: zynqmp_dpsub: Set layer mode during creation
      drm: xlnx: zynqmp_dpsub: Anounce supported input formats
      drm: xlnx: zynqmp_dpsub: Set input live format
      drm/atomic-helper: Add select_output_bus_format callback

 drivers/gpu/drm/drm_bridge.c             |  19 +++++-
 drivers/gpu/drm/xlnx/zynqmp_disp.c       | 109 +++++++++++++++++++++++++++++--
 drivers/gpu/drm/xlnx/zynqmp_disp.h       |  25 +++----
 drivers/gpu/drm/xlnx/zynqmp_disp_regs.h  |   8 +--
 drivers/gpu/drm/xlnx/zynqmp_dp.c         |  16 +++--
 drivers/gpu/drm/xlnx/zynqmp_kms.c        |   2 +-
 include/drm/drm_modeset_helper_vtables.h |  31 +++++++++
 7 files changed, 182 insertions(+), 28 deletions(-)
---
base-commit: bfa4437fd3938ae2e186e7664b2db65bb8775670
change-id: 20240226-dp-live-fmt-6415773b5a68

Best regards,
-- 
Anatoliy Klymenko <anatoliy.klymenko@amd.com>


^ permalink raw reply	[flat|nested] 93+ messages in thread

end of thread, other threads:[~2024-03-03 17:16 UTC | newest]

Thread overview: 93+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-22 18:13 [PATCH v7 00/36] drm/connector: Create HDMI Connector infrastructure Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 01/36] drm/tests: helpers: Include missing drm_drv header Maxime Ripard
2024-02-26 10:42   ` Maíra Canal
2024-02-28 15:40   ` (subset) " Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 02/36] drm/tests: helpers: Add atomic helpers Maxime Ripard
2024-02-26 12:23   ` Maíra Canal
2024-02-28 15:40   ` (subset) " Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 03/36] drm/tests: Add helper to create mock plane Maxime Ripard
2024-02-26 12:24   ` Maíra Canal
2024-02-28 15:40   ` (subset) " Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 04/36] drm/tests: Add helper to create mock crtc Maxime Ripard
2024-02-26 12:26   ` Maíra Canal
2024-02-28 15:40   ` (subset) " Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 05/36] drm/tests: connector: Add tests for drmm_connector_init Maxime Ripard
2024-02-26 12:27   ` Maíra Canal
2024-02-28 15:40   ` (subset) " Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 06/36] drm/connector: Introduce an HDMI connector initialization function Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 07/36] drm/tests: connector: Add tests for drmm_connector_hdmi_init Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 08/36] drm/connector: hdmi: Create an HDMI sub-state Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 09/36] drm/connector: hdmi: Add output BPC to the connector state Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 10/36] drm/tests: Add output bpc tests Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 11/36] drm/connector: hdmi: Add support for output format Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 12/36] drm/tests: Add output formats tests Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 13/36] drm/connector: hdmi: Add HDMI compute clock helper Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 14/36] drm/tests: Add HDMI TDMS character rate tests Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 15/36] drm/connector: hdmi: Calculate TMDS character rate Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 16/36] drm/tests: Add TDMS character rate connector state tests Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 17/36] drm/connector: hdmi: Add custom hook to filter TMDS character rate Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 18/36] drm/tests: Add HDMI connector rate filter hook tests Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 19/36] drm/connector: hdmi: Compute bpc and format automatically Maxime Ripard
2024-02-25 13:56   ` Alex Bee
2024-02-27 14:01     ` Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 20/36] drm/tests: Add HDMI connector bpc and format tests Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 21/36] drm/connector: hdmi: Add Broadcast RGB property Maxime Ripard
2024-02-23  9:28   ` Pekka Paalanen
2024-02-29 19:47   ` Sebastian Wick
2024-03-01  8:29     ` Hans Verkuil
2024-03-01 11:26       ` Sebastian Wick
2024-03-01 10:30     ` Maxime Ripard
2024-03-01 11:29       ` Sebastian Wick
2024-03-01 12:12         ` Maxime Ripard
2024-03-01 12:19           ` Pekka Paalanen
2024-03-01 13:15           ` Sebastian Wick
2024-02-22 18:14 ` [PATCH v7 22/36] drm/tests: Add tests for " Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 23/36] drm/connector: hdmi: Add RGB Quantization Range to the connector state Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 24/36] drm/tests: Add RGB Quantization tests Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 25/36] drm/connector: hdmi: Add Infoframes generation Maxime Ripard
2024-02-25 15:02   ` Dmitry Baryshkov
2024-02-27 12:08     ` Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 26/36] drm/tests: Add infoframes test Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 27/36] drm/connector: hdmi: Create Infoframe DebugFS entries Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 28/36] drm/vc4: hdmi: Switch to HDMI connector Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 29/36] drm/vc4: tests: Remove vc4_dummy_plane structure Maxime Ripard
2024-02-26 12:29   ` Maíra Canal
2024-02-27 13:02     ` Maxime Ripard
2024-02-27 22:45       ` Maíra Canal
2024-02-22 18:14 ` [PATCH v7 30/36] drm/vc4: tests: Convert to plane creation helper Maxime Ripard
2024-02-26 12:30   ` Maíra Canal
2024-02-22 18:14 ` [PATCH v7 31/36] drm/rockchip: inno_hdmi: Switch to HDMI connector Maxime Ripard
2024-02-23  9:40   ` Heiko Stübner
2024-02-22 18:14 ` [PATCH v7 32/36] drm/sun4i: hdmi: Convert encoder to atomic Maxime Ripard
2024-02-22 19:08   ` Jernej Škrabec
2024-02-26  9:55   ` (subset) " Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 33/36] drm/sun4i: hdmi: Move mode_set into enable Maxime Ripard
2024-02-22 19:08   ` Jernej Škrabec
2024-02-26  9:55   ` (subset) " Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 34/36] drm/sun4i: hdmi: Switch to container_of_const Maxime Ripard
2024-02-22 19:08   ` Jernej Škrabec
2024-02-26  9:55   ` (subset) " Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 35/36] drm/sun4i: hdmi: Consolidate atomic_check and mode_valid Maxime Ripard
2024-02-22 19:12   ` Jernej Škrabec
2024-02-26  9:55   ` (subset) " Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 36/36] drm/sun4i: hdmi: Switch to HDMI connector Maxime Ripard
2024-02-22 19:14   ` Jernej Škrabec
2024-02-23 13:24   ` Sui Jingfeng
2024-02-25 14:50 ` [PATCH v7 00/36] drm/connector: Create HDMI Connector infrastructure Dmitry Baryshkov
2024-02-26 13:22   ` Maxime Ripard
2024-02-27  4:44 [PATCH 0/4] Setting live video input format for ZynqMP DPSUB Anatoliy Klymenko
2024-02-27  4:44 ` [PATCH 1/4] drm: xlnx: zynqmp_dpsub: Set layer mode during creation Anatoliy Klymenko
2024-02-28 14:56   ` Laurent Pinchart
2024-02-27  4:44 ` [PATCH 2/4] drm: xlnx: zynqmp_dpsub: Anounce supported input formats Anatoliy Klymenko
2024-02-28 15:58   ` Laurent Pinchart
2024-02-29 20:07     ` Klymenko, Anatoliy
2024-02-27  4:44 ` [PATCH 3/4] drm: xlnx: zynqmp_dpsub: Set input live format Anatoliy Klymenko
2024-02-28 16:07   ` Laurent Pinchart
2024-02-28 22:17     ` Klymenko, Anatoliy
2024-03-03 17:15   ` kernel test robot
2024-02-27  4:44 ` [PATCH 4/4] drm/atomic-helper: Add select_output_bus_format callback Anatoliy Klymenko
2024-02-28 15:29   ` Maxime Ripard
2024-02-28 16:10     ` Laurent Pinchart
2024-02-28 16:16     ` [PATCH v7 29/36] drm/vc4: tests: Remove vc4_dummy_plane structure Maxime Ripard
2024-02-28 22:00     ` [PATCH 4/4] drm/atomic-helper: Add select_output_bus_format callback Klymenko, Anatoliy
2024-02-29  8:21       ` Maxime Ripard

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).