mbox series

[v15,00/29] drm/connector: Create HDMI Connector infrastructure

Message ID 20240527-kms-hdmi-connector-state-v15-0-c5af16c3aae2@kernel.org (mailing list archive)
Headers show
Series drm/connector: Create HDMI Connector infrastructure | expand

Message

Maxime Ripard May 27, 2024, 1:57 p.m. UTC
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 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,

Comments

Maxime Ripard May 28, 2024, 8:34 a.m. UTC | #1
On Mon, 27 May 2024 15:57:49 +0200, Maxime Ripard wrote:
> 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.
> 
> [...]

Applied to misc/kernel.git (drm-misc-next).

Thanks!
Maxime
Jani Nikula May 31, 2024, 6:43 p.m. UTC | #2
On Mon, 27 May 2024, Maxime Ripard <mripard@kernel.org> wrote:
> Let me know what you think,

Sorry to report that this series generates a bunch of kernel-doc
warnings in include/drm/drm_connector.h. Documenting nested struct
members doesn't work as smoothly as you'd expect:

../include/drm/drm_connector.h:1138: warning: Excess struct member 'broadcast_rgb' description in 'drm_connector_state'
../include/drm/drm_connector.h:1138: warning: Excess struct member 'infoframes' description in 'drm_connector_state'
../include/drm/drm_connector.h:1138: warning: Excess struct member 'avi' description in 'drm_connector_state'
../include/drm/drm_connector.h:1138: warning: Excess struct member 'hdr_drm' description in 'drm_connector_state'
../include/drm/drm_connector.h:1138: warning: Excess struct member 'spd' description in 'drm_connector_state'
../include/drm/drm_connector.h:1138: warning: Excess struct member 'vendor' description in 'drm_connector_state'
../include/drm/drm_connector.h:1138: warning: Excess struct member 'is_limited_range' description in 'drm_connector_state'
../include/drm/drm_connector.h:1138: warning: Excess struct member 'output_bpc' description in 'drm_connector_state'
../include/drm/drm_connector.h:1138: warning: Excess struct member 'output_format' description in 'drm_connector_state'
../include/drm/drm_connector.h:1138: warning: Excess struct member 'tmds_char_rate' description in 'drm_connector_state'
../include/drm/drm_connector.h:2112: warning: Excess struct member 'vendor' description in 'drm_connector'
../include/drm/drm_connector.h:2112: warning: Excess struct member 'product' description in 'drm_connector'
../include/drm/drm_connector.h:2112: warning: Excess struct member 'supported_formats' description in 'drm_connector'
../include/drm/drm_connector.h:2112: warning: Excess struct member 'infoframes' description in 'drm_connector'
../include/drm/drm_connector.h:2112: warning: Excess struct member 'lock' description in 'drm_connector'
../include/drm/drm_connector.h:2112: warning: Excess struct member 'audio' description in 'drm_connector'

Noticed this when I was rebasing [1]. Having that merged would find
issues in headers at build time instead of 'make htmldocs'.

In the mean time, this is the quick reproducer:

$ scripts/kernel-doc -none include/drm/drm_connector.h


BR,
Jani.

[1] https://lore.kernel.org/r/20240402140136.1722533-1-jani.nikula@intel.com
Maxime Ripard June 3, 2024, 9:19 a.m. UTC | #3
Hi Jani,

On Fri, May 31, 2024 at 09:43:16PM GMT, Jani Nikula wrote:
> On Mon, 27 May 2024, Maxime Ripard <mripard@kernel.org> wrote:
> > Let me know what you think,
> 
> Sorry to report that this series generates a bunch of kernel-doc
> warnings in include/drm/drm_connector.h. Documenting nested struct
> members doesn't work as smoothly as you'd expect:
>
> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'broadcast_rgb' description in 'drm_connector_state'
> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'infoframes' description in 'drm_connector_state'
> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'avi' description in 'drm_connector_state'
> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'hdr_drm' description in 'drm_connector_state'
> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'spd' description in 'drm_connector_state'
> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'vendor' description in 'drm_connector_state'
> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'is_limited_range' description in 'drm_connector_state'
> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'output_bpc' description in 'drm_connector_state'
> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'output_format' description in 'drm_connector_state'
> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'tmds_char_rate' description in 'drm_connector_state'
> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'vendor' description in 'drm_connector'
> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'product' description in 'drm_connector'
> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'supported_formats' description in 'drm_connector'
> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'infoframes' description in 'drm_connector'
> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'lock' description in 'drm_connector'
> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'audio' description in 'drm_connector'
> 
> Noticed this when I was rebasing [1]. Having that merged would find
> issues in headers at build time instead of 'make htmldocs'.
> 
> In the mean time, this is the quick reproducer:
> 
> $ scripts/kernel-doc -none include/drm/drm_connector.h

Thanks for the report and the reproducer. I have to admit I have no idea
how to fix it, do you have a suggestion?

Maxime
Jani Nikula June 3, 2024, 9:28 a.m. UTC | #4
On Mon, 03 Jun 2024, Maxime Ripard <mripard@kernel.org> wrote:
> Hi Jani,
>
> On Fri, May 31, 2024 at 09:43:16PM GMT, Jani Nikula wrote:
>> On Mon, 27 May 2024, Maxime Ripard <mripard@kernel.org> wrote:
>> > Let me know what you think,
>> 
>> Sorry to report that this series generates a bunch of kernel-doc
>> warnings in include/drm/drm_connector.h. Documenting nested struct
>> members doesn't work as smoothly as you'd expect:
>>
>> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'broadcast_rgb' description in 'drm_connector_state'
>> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'infoframes' description in 'drm_connector_state'
>> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'avi' description in 'drm_connector_state'
>> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'hdr_drm' description in 'drm_connector_state'
>> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'spd' description in 'drm_connector_state'
>> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'vendor' description in 'drm_connector_state'
>> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'is_limited_range' description in 'drm_connector_state'
>> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'output_bpc' description in 'drm_connector_state'
>> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'output_format' description in 'drm_connector_state'
>> ../include/drm/drm_connector.h:1138: warning: Excess struct member 'tmds_char_rate' description in 'drm_connector_state'
>> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'vendor' description in 'drm_connector'
>> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'product' description in 'drm_connector'
>> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'supported_formats' description in 'drm_connector'
>> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'infoframes' description in 'drm_connector'
>> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'lock' description in 'drm_connector'
>> ../include/drm/drm_connector.h:2112: warning: Excess struct member 'audio' description in 'drm_connector'
>> 
>> Noticed this when I was rebasing [1]. Having that merged would find
>> issues in headers at build time instead of 'make htmldocs'.
>> 
>> In the mean time, this is the quick reproducer:
>> 
>> $ scripts/kernel-doc -none include/drm/drm_connector.h
>
> Thanks for the report and the reproducer. I have to admit I have no idea
> how to fix it, do you have a suggestion?

Some of them can be fixed by adding the parent struct name, like so:

-                * @broadcast_rgb: Connector property to pass the
+                * @hdmi.broadcast_rgb: Connector property to pass the

but I think even that falls apart at some point. :(

In the end might be easier to separate the struct definitions to reduce
nesting.


BR,
Jani.
Hans Verkuil July 31, 2024, 2:56 p.m. UTC | #5
Hi Maxime,

On 27/05/2024 15:57, Maxime Ripard wrote:
<snip>

> 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

Since this patch series is now merged in mainline I also pushed support
for parsing InfoFrames to the edid-decode git repo.

I believe the parsing part of the InfoFrames is complete, but the conformity
checks for the AVI and HDMI InfoFrames are still work-in-progress. But it
should be easier to develop this now that is merged.

The git repo for edid-decode is here: https://git.linuxtv.org/edid-decode.git/

I added test files to the test/if directory, and if you run:

edid-decode -I audio.test -I avi.test -I vendor.test -I spd.test edid.test -c

you'll get the output below.

Regards,

	Hans

edid-decode (hex):

00 ff ff ff ff ff ff 00 4c 2d 01 0c 01 06 00 01
2a 18 01 03 80 69 3b 78 0a 23 ad a4 54 4d 99 26
0f 47 4a bd ef 80 71 4f 81 c0 81 00 81 80 95 00
a9 c0 b3 00 01 01 08 e8 00 30 f2 70 5a 80 b0 58
8a 00 50 1d 74 00 00 1e 02 3a 80 18 71 38 2d 40
58 2c 45 00 50 1d 74 00 00 1e 00 00 00 fd 00 18
4b 0f 87 3c 00 0a 20 20 20 20 20 20 00 00 00 fc
00 53 41 4d 53 55 4e 47 0a 20 20 20 20 20 01 56

02 03 58 f1 57 61 10 1f 04 13 05 14 20 21 22 5d
5e 5f 60 65 66 62 63 64 07 16 03 12 29 09 07 07
15 07 50 3d 04 c0 83 01 00 00 e2 00 0f e3 05 c0
00 76 03 0c 00 30 00 b8 3c 21 d0 88 01 02 03 04
01 40 3f ff 50 60 80 90 67 d8 5d c4 01 78 80 03
e3 06 05 01 e3 0f 01 e0 01 1d 80 d0 72 1c 16 20
10 2c 25 80 50 1d 74 00 00 9e 66 21 56 aa 51 00
1e 30 46 8f 33 00 50 1d 74 00 00 1e 00 00 00 86

----------------

Block 0, Base EDID:
  EDID Structure Version & Revision: 1.3
  Vendor & Product Identification:
    Manufacturer: SAM
    Model: 3073
    Serial Number: 16778753 (0x01000601)
    Made in: week 42 of 2014
  Basic Display Parameters & Features:
    Digital display
    Maximum image size: 105 cm x 59 cm
    Gamma: 2.20
    RGB color display
    First detailed timing is the preferred timing
  Color Characteristics:
    Red  : 0.6406, 0.3300
    Green: 0.3007, 0.6005
    Blue : 0.1503, 0.0605
    White: 0.2802, 0.2900
  Established Timings I & II:
    IBM     :   720x400    70.081663 Hz   9:5     31.467 kHz     28.320000 MHz
    DMT 0x04:   640x480    59.940476 Hz   4:3     31.469 kHz     25.175000 MHz
    Apple   :   640x480    66.666667 Hz   4:3     35.000 kHz     30.240000 MHz
    DMT 0x05:   640x480    72.808802 Hz   4:3     37.861 kHz     31.500000 MHz
    DMT 0x06:   640x480    75.000000 Hz   4:3     37.500 kHz     31.500000 MHz
    DMT 0x09:   800x600    60.316541 Hz   4:3     37.879 kHz     40.000000 MHz
    DMT 0x0a:   800x600    72.187572 Hz   4:3     48.077 kHz     50.000000 MHz
    DMT 0x0b:   800x600    75.000000 Hz   4:3     46.875 kHz     49.500000 MHz
    Apple   :   832x624    74.551266 Hz   4:3     49.726 kHz     57.284000 MHz
    DMT 0x10:  1024x768    60.003840 Hz   4:3     48.363 kHz     65.000000 MHz
    DMT 0x11:  1024x768    70.069359 Hz   4:3     56.476 kHz     75.000000 MHz
    DMT 0x12:  1024x768    75.028582 Hz   4:3     60.023 kHz     78.750000 MHz
    DMT 0x24:  1280x1024   75.024675 Hz   5:4     79.976 kHz    135.000000 MHz
    Apple   :  1152x870    75.061550 Hz 192:145   68.681 kHz    100.000000 MHz
  Standard Timings:
    DMT 0x15:  1152x864    75.000000 Hz   4:3     67.500 kHz    108.000000 MHz
    DMT 0x55:  1280x720    60.000000 Hz  16:9     45.000 kHz     74.250000 MHz
    DMT 0x1c:  1280x800    59.810326 Hz  16:10    49.702 kHz     83.500000 MHz
    DMT 0x23:  1280x1024   60.019740 Hz   5:4     63.981 kHz    108.000000 MHz
    DMT 0x2f:  1440x900    59.887445 Hz  16:10    55.935 kHz    106.500000 MHz
    DMT 0x53:  1600x900    60.000000 Hz  16:9     60.000 kHz    108.000000 MHz (RB)
    DMT 0x3a:  1680x1050   59.954250 Hz  16:10    65.290 kHz    146.250000 MHz
  Detailed Timing Descriptors:
    DTD 1:  3840x2160   60.000000 Hz  16:9    135.000 kHz    594.000000 MHz (1872 mm x 1053 mm)
                 Hfront  176 Hsync  88 Hback  296 Hpol P
                 Vfront    8 Vsync  10 Vback   72 Vpol P
    DTD 2:  1920x1080   60.000000 Hz  16:9     67.500 kHz    148.500000 MHz (1872 mm x 1053 mm)
                 Hfront   88 Hsync  44 Hback  148 Hpol P
                 Vfront    4 Vsync   5 Vback   36 Vpol P
    Display Range Limits:
      Monitor ranges (GTF): 24-75 Hz V, 15-135 kHz H, max dotclock 600 MHz
    Display Product Name: 'SAMSUNG'
  Extension blocks: 1
Checksum: 0x56

----------------

Block 1, CTA-861 Extension Block:
  Revision: 3
  Underscans IT Video Formats by default
  Basic audio support
  Supports YCbCr 4:4:4
  Supports YCbCr 4:2:2
  Native detailed modes: 1
  Video Data Block:
    VIC  97:  3840x2160   60.000000 Hz  16:9    135.000 kHz    594.000000 MHz
    VIC  16:  1920x1080   60.000000 Hz  16:9     67.500 kHz    148.500000 MHz
    VIC  31:  1920x1080   50.000000 Hz  16:9     56.250 kHz    148.500000 MHz
    VIC   4:  1280x720    60.000000 Hz  16:9     45.000 kHz     74.250000 MHz
    VIC  19:  1280x720    50.000000 Hz  16:9     37.500 kHz     74.250000 MHz
    VIC   5:  1920x1080i  60.000000 Hz  16:9     33.750 kHz     74.250000 MHz
    VIC  20:  1920x1080i  50.000000 Hz  16:9     28.125 kHz     74.250000 MHz
    VIC  32:  1920x1080   24.000000 Hz  16:9     27.000 kHz     74.250000 MHz
    VIC  33:  1920x1080   25.000000 Hz  16:9     28.125 kHz     74.250000 MHz
    VIC  34:  1920x1080   30.000000 Hz  16:9     33.750 kHz     74.250000 MHz
    VIC  93:  3840x2160   24.000000 Hz  16:9     54.000 kHz    297.000000 MHz
    VIC  94:  3840x2160   25.000000 Hz  16:9     56.250 kHz    297.000000 MHz
    VIC  95:  3840x2160   30.000000 Hz  16:9     67.500 kHz    297.000000 MHz
    VIC  96:  3840x2160   50.000000 Hz  16:9    112.500 kHz    594.000000 MHz
    VIC 101:  4096x2160   50.000000 Hz 256:135  112.500 kHz    594.000000 MHz
    VIC 102:  4096x2160   60.000000 Hz 256:135  135.000 kHz    594.000000 MHz
    VIC  98:  4096x2160   24.000000 Hz 256:135   54.000 kHz    297.000000 MHz
    VIC  99:  4096x2160   25.000000 Hz 256:135   56.250 kHz    297.000000 MHz
    VIC 100:  4096x2160   30.000000 Hz 256:135   67.500 kHz    297.000000 MHz
    VIC   7:  1440x480i   59.940060 Hz  16:9     15.734 kHz     27.000000 MHz
    VIC  22:  1440x576i   50.000000 Hz  16:9     15.625 kHz     27.000000 MHz
    VIC   3:   720x480    59.940060 Hz  16:9     31.469 kHz     27.000000 MHz
    VIC  18:   720x576    50.000000 Hz  16:9     31.250 kHz     27.000000 MHz
  Audio Data Block:
    Linear PCM:
      Max channels: 2
      Supported sample rates (kHz): 48 44.1 32
      Supported sample sizes (bits): 24 20 16
    AC-3:
      Max channels: 6
      Supported sample rates (kHz): 48 44.1 32
      Maximum bit rate: 640 kb/s
    DTS:
      Max channels: 6
      Supported sample rates (kHz): 48
      Maximum bit rate: 1536 kb/s
  Speaker Allocation Data Block:
    FL/FR - Front Left/Right
  Video Capability Data Block:
    YCbCr quantization: No Data
    RGB quantization: No Data
    PT scan behavior: No Data
    IT scan behavior: Supports both over- and underscan
    CE scan behavior: Supports both over- and underscan
  Colorimetry Data Block:
    BT2020YCC
    BT2020RGB
  Vendor-Specific Data Block (HDMI), OUI 00-0C-03:
    Source physical address: 3.0.0.0
    Supports_AI
    DC_36bit
    DC_30bit
    DC_Y444
    Maximum TMDS clock: 300 MHz
    Supported Content Types:
      Graphics
    Extended HDMI video details:
      3D present
      3D-capable-VIC mask present
      Base EDID image size is in units of 1 cm
      HDMI VICs:
        HDMI VIC 1:  3840x2160   30.000000 Hz  16:9     67.500 kHz    297.000000 MHz
        HDMI VIC 2:  3840x2160   25.000000 Hz  16:9     56.250 kHz    297.000000 MHz
        HDMI VIC 3:  3840x2160   24.000000 Hz  16:9     54.000 kHz    297.000000 MHz
        HDMI VIC 4:  4096x2160   24.000000 Hz 256:135   54.000 kHz    297.000000 MHz
      3D: Side-by-side (half, horizontal)
      3D: Top-and-bottom
      3D VIC indices that support these capabilities:
        VIC  97:  3840x2160   60.000000 Hz  16:9    135.000 kHz    594.000000 MHz
        VIC  16:  1920x1080   60.000000 Hz  16:9     67.500 kHz    148.500000 MHz
        VIC  31:  1920x1080   50.000000 Hz  16:9     56.250 kHz    148.500000 MHz
        VIC   4:  1280x720    60.000000 Hz  16:9     45.000 kHz     74.250000 MHz
        VIC  19:  1280x720    50.000000 Hz  16:9     37.500 kHz     74.250000 MHz
        VIC   5:  1920x1080i  60.000000 Hz  16:9     33.750 kHz     74.250000 MHz
        VIC  20:  1920x1080i  50.000000 Hz  16:9     28.125 kHz     74.250000 MHz
        VIC  32:  1920x1080   24.000000 Hz  16:9     27.000 kHz     74.250000 MHz
        VIC  33:  1920x1080   25.000000 Hz  16:9     28.125 kHz     74.250000 MHz
        VIC  34:  1920x1080   30.000000 Hz  16:9     33.750 kHz     74.250000 MHz
        VIC  93:  3840x2160   24.000000 Hz  16:9     54.000 kHz    297.000000 MHz
        VIC  94:  3840x2160   25.000000 Hz  16:9     56.250 kHz    297.000000 MHz
        VIC  95:  3840x2160   30.000000 Hz  16:9     67.500 kHz    297.000000 MHz
        VIC  96:  3840x2160   50.000000 Hz  16:9    112.500 kHz    594.000000 MHz
      3D VIC indices with specific capabilities:
        VIC   5:  1920x1080i  60.000000 Hz  16:9     33.750 kHz     74.250000 MHz (frame packing)
        VIC  20:  1920x1080i  50.000000 Hz  16:9     28.125 kHz     74.250000 MHz (frame packing)
        VIC  33:  1920x1080   25.000000 Hz  16:9     28.125 kHz     74.250000 MHz (frame packing)
        VIC  34:  1920x1080   30.000000 Hz  16:9     33.750 kHz     74.250000 MHz (frame packing)
  Vendor-Specific Data Block (HDMI Forum), OUI C4-5D-D8:
    Version: 1
    Maximum TMDS Character Rate: 600 MHz
    SCDC Present
    Supports 12-bits/component Deep Color 4:2:0 Pixel Encoding
    Supports 10-bits/component Deep Color 4:2:0 Pixel Encoding
  HDR Static Metadata Data Block:
    Electro optical transfer functions:
      Traditional gamma - SDR luminance range
      SMPTE ST2084
    Supported static metadata descriptors:
      Static metadata type 1
  YCbCr 4:2:0 Capability Map Data Block:
    VIC  97:  3840x2160   60.000000 Hz  16:9    135.000 kHz    594.000000 MHz
    VIC  96:  3840x2160   50.000000 Hz  16:9    112.500 kHz    594.000000 MHz
    VIC 101:  4096x2160   50.000000 Hz 256:135  112.500 kHz    594.000000 MHz
    VIC 102:  4096x2160   60.000000 Hz 256:135  135.000 kHz    594.000000 MHz
  Detailed Timing Descriptors:
    DTD 3:  1920x1080i  50.000000 Hz  16:9     28.125 kHz     74.250000 MHz (1872 mm x 1053 mm)
                 Hfront  528 Hsync  44 Hback  148 Hpol P
                 Vfront    2 Vsync   5 Vback   15 Vpol P Vfront +0.5 Odd Field
                 Vfront    2 Vsync   5 Vback   15 Vpol P Vback  +0.5 Even Field
    DTD 4:  1366x768    59.789541 Hz 683:384   47.712 kHz     85.500000 MHz (1872 mm x 1053 mm)
                 Hfront   70 Hsync 143 Hback  213 Hpol P
                 Vfront    3 Vsync   3 Vback   24 Vpol P
Checksum: 0x86  Unused space in Extension Block: 3 bytes

----------------

edid-decode SHA: 303b033f9268 2024-07-31 14:47:43

Warnings:

Block 1, CTA-861 Extension Block:
  Video Capability Data Block: Set Selectable YCbCr Quantization to avoid interop issues.
  Colorimetry Data Block: Set the sRGB colorimetry bit to avoid interop issues.

Failures:

Block 0, Base EDID:
  Detailed Timing Descriptor #1: Mismatch of image size 1872x1053 mm vs display size 1050x590 mm.
  Detailed Timing Descriptor #2: Mismatch of image size 1872x1053 mm vs display size 1050x590 mm.
Block 1, CTA-861 Extension Block:
  Video Capability Data Block: Set Selectable RGB Quantization to avoid interop issues.
  Detailed Timing Descriptor #3: Mismatch of image size 1872x1053 mm vs display size 1050x590 mm.
  Detailed Timing Descriptor #4: Mismatch of image size 1872x1053 mm vs display size 1050x590 mm.
EDID:
  Base EDID: The DTD max image size is 1872x1053mm, which is larger than the display size 1050.0x590.0mm.

EDID conformity: FAIL

================

edid-decode InfoFrame (hex):

84 01 0a 70 01 00 00 00 00 00 00 00 00 00

----------------

HDMI InfoFrame Checksum: 0x70

Audio InfoFrame
  Version: 1
  Length: 10
  CT: Audio Coding Type: Refer to Stream Header
  CC: Audio Channel Count: 2
  SF: Sampling Frequency: Refer to Stream Header
  SS: Bits/Sample: Refer to Stream Header
  CXT: Audio Coding Extension Type: Refer to Audio Coding Type (CT) Field
  CA: Channel Allocation: FR/FL
  LSV: Level Shift Value: 0 dB
  DM_INH: Allow the Down Mixed Stereo Output: Yes
  LFEPBL: LFE Playback Level compared to other channels: Unknown or refer to other information

----------------

Audio InfoFrame conformity: PASS

================

edid-decode InfoFrame (hex):

82 02 0d b1 12 08 00 64 40 00 00 00 00 00 00 00
00

----------------

HDMI InfoFrame Checksum: 0xb1

AVI InfoFrame
  Version: 2
  Length: 13
  VIC 100:  4096x2160   30.000000 Hz 256:135   67.500 kHz    297.000000 MHz
  Y: Color Component Sample Format: RGB
  A: Active Format Information Present: Yes
  B: Bar Data Present: Bar Data not present
  S: Scan Information: Composed for an underscanned display
  C: Colorimetry: No Data
  M: Picture Aspect Ratio: No Data
  R: Active Portion Aspect Ratio: 8
  ITC: IT Content: No Data
  EC: Extended Colorimetry: xvYCC601
  Q: RGB Quantization Range: Default
  SC: Non-Uniform Picture Scaling: No Known non-uniform scaling
  YQ: YCC Quantization Range: Full Range
  CN: IT Content Type: Graphics
  PR: Pixel Data Repetition Count: 0
  Line Number of End of Top Bar: 0
  Line Number of Start of Bottom Bar: 0
  Pixel Number of End of Left Bar: 0
  Pixel Number of Start of Right Bar: 0

----------------

AVI InfoFrame conformity: PASS

================

edid-decode InfoFrame (hex):

81 01 04 6b 03 0c 00 00

----------------

HDMI InfoFrame Checksum: 0x6b

Vendor-Specific InfoFrame (HDMI), OUI 00-0C-03
  Version: 1
  Length: 4
  HDMI Video Format: No additional data

----------------

Vendor-Specific InfoFrame (HDMI), OUI 00-0C-03 conformity: PASS

================

edid-decode InfoFrame (hex):

83 01 19 c9 43 69 73 63 6f 00 00 00 56 69 64 65
6f 63 6f 72 65 00 00 00 00 00 00 00 09

----------------

HDMI InfoFrame Checksum: 0xc9

Source Product Description InfoFrame
  Version: 1
  Length: 25
  Vendor Name: 'Cisco'
  Product Description: 'Videocore'
  Source Information: PC general

----------------

Source Product Description InfoFrame conformity: PASS
Maxime Ripard Aug. 1, 2024, 8:23 a.m. UTC | #6
Hi Hans,

On Wed, Jul 31, 2024 at 04:56:16PM GMT, Hans Verkuil wrote:
> Hi Maxime,
> 
> On 27/05/2024 15:57, Maxime Ripard wrote:
> <snip>
> 
> > 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
> 
> Since this patch series is now merged in mainline I also pushed support
> for parsing InfoFrames to the edid-decode git repo.
> 
> I believe the parsing part of the InfoFrames is complete, but the conformity
> checks for the AVI and HDMI InfoFrames are still work-in-progress. But it
> should be easier to develop this now that is merged.
> 
> The git repo for edid-decode is here: https://git.linuxtv.org/edid-decode.git/
> 
> I added test files to the test/if directory, and if you run:
> 
> edid-decode -I audio.test -I avi.test -I vendor.test -I spd.test edid.test -c
> 
> you'll get the output below.

That's awesome to hear, I'll send a patch for the KMS documentation to
mention it 

Thanks!
Maxime