Xilinx DRM KMS HDMI-Tx Driver

Table of Contents


Introduction

The purpose of this page is to describe the Linux DRM driver for Xilinx HDMI Tx Soft IP for Zynq Ultrascale+ MPSOC
The HDMI 1.4/2.0 Transmitter Subsystem is a feature-rich soft IP incorporating all the necessary logic to properly interface with PHY layers and provide HDMI® encoding functionality. The subsystem is a hierarchical IP that bundles a collection of HDMI TX-related IP sub-cores and outputs them as a single IP. The subsystem takes incoming video and audio streams and transfers them to an HDMI stream. The stream is then forwarded to the video PHY layer.

The HDMI 1.4/2.0 Transmitter Subsystem is a MAC subsystem which works with a Video PHY Controller (PHY) to create a video connectivity system. The HDMI 1.4/2.0 Transmitter Subsystem is tightly coupled with the Xilinx Video PHY Controller, which itself is independent and offer flexible architecture with multiple-protocol support. Both MAC and PHY are dynamically programmable through the AXI4-Lite interface.

MAC Interface with PHY


Driver Overview

HDMI Tx is the last node in the display pipeline. The linux driver is implemented as a sub-component of the Xilinx DRM KMS bridge driver and implements the encoder/connector interface. The subsystem includes the video timing generator and Tx sub-core. Driver implements the DRM callbacks to read the display EDID and present it to the framework anytime a display is connected. It works in tandem with the DRM bridge driver to validates each mode listed in the EDID and reject unsupported modes.

On mode change request from user application driver works in conjunction with DRM framework to validate the requested mode to ensure the stream can be generated by Tx core and is supported by the attached display. If requested mode is supported the driver will configure Tx sub-core for new mode and the internal video timing controller (VTC) to generate requisite video timing for it. It also configures the PHY layer for the new mode and manages all required interaction between MAC & PHY layer.

After mode setup is complete PHY state machine is reset and put into a wait state awaiting the reference clock for the new mode from an external clock source. DRM framework requests the registered clock producer (SI5324/SI5319 for Xilinx HDMI) to generate the clock for desired mode. Availability of this clock is checked by PHY using tx_refclk_rdy port pin. After this pin is asserted HIGH PHY’s internal state machine is triggered to lock onto the incoming frequency and stream transmission starts. As a last step the driver then configures the external LVDS to TMDS level shifter component (DP159), via CCF framework, which will convert the GT output signals to HDMI interface.

IP/Driver Features


IP Feature2018.1 hdmi-modules2018.3 and onward hdmi-modules
IP Version Supported3.13.1
HDMI 2.0 and 1.4 compatibleYY
2 or 4 symbol/pixel per clock input (PPC)2 PPC Only2 PPC Only
Supports resolutions up to 4,096 x 2,160 @60 fpsYY
8, 10, 12, and 16-bit Deep-color support8 & 10-bit Only8 & 10-bit Only
Support color space for RGB, YUV 4:4:4, YUV 4:2:2, YUV 4:2:0Support all color spaces Support all color spaces
Support AXI4-Stream Video output stream and
Native Video output stream
Axi-Stream Video OnlyAxi-Stream Video Only
Optional High Bandwidth Digital Copy Protection (HDCP) 1.4 supportYY
Optional HDCP 2.2 supportYY
Optional Video over AXIS compliant NTSC/PAL SupportYY
Optional Video over AXIS compliantYUV420 SupportYY

Missing Features / Known issues / Limitations in Driver

  • This driver doesn't support Xilinx DRM bridge. So display pipelines like Framebuffer Read → VPSS Scaler → HDMI Tx will not work.


Kernel Configuration Options for Driver


2018.1 and onwards Kernel brings-in the support for the new component based DRM framework from Xilinx. HDMI driver has been updated to work with the new framework and is not backward compatible with the old Xilinx drm framework.

2018.1 and onwards: Supports ONLY the new Xilinx DRM framework driver and PL crtc and can be enabled via following configurations options
CONFIG_DRM_XLNX and CONFIG_DRM_XLNX_PL_DISP

The above defined options will only enable the new DRM framework. Since HDMI Tx driver is now added as an out-of-tree kernel module, there is not kernel configuration required. Instead user must include the driver in the rootfs. Following steps are required enable the driver
  • Make sure the meta-user layer has the recipe-hdmi included
  • For 2019.2 onwards
    • Add the recipe to petalinux image. Edit ./meta-user/conf/user-rootfsconfig and add the new recipe at the end

CONFIG_kernel-module-hdmi
  • For 2018.1 to 2019.1
    • Add the recipe to petalinux image. Edit ./meta-user/recipes-core/images/petalinux-image-full.bbappend and add the new recipe at the end
      • NOTE - While using 2018.1 petalinux, the file name was ./meta-user/recipes-core/images/petalinux-image.bbappend
IMAGE_INSTALL_append = " kernel-module-hdmi"
  • Next include the driver in the rootfs
% petalinux-config -c rootfs
  • Select "user-pakages->modules->kernel-module-hdmi", save and exit
  • Build the project
%petalinux-build

Device Tree Binding

The dts node should be defined with correct hardware configuration. How to define the node is documented in
2018.1: Documentation/devicetree/bindings/xlnx%2Cv-hdmi-tx-ss.txt

Device Control

Sysfs interface has been added to the driver to enable the user to query the current device status and/or change certain properties. Below table describes the available commands and the access permissions available

Command Name Permission Description
hdmi_infoRead-Only by allShows detected stream properties
hdmi_logRead-Only by allShows event logs captured by the driver
hdcp_logRead-Only by allShows event logs captured by the driver
hdcp_debugenWrite-Only by group and owner1: Enable detailed logging of hdcp events
0: Disable detailed logging of hdcp events
(0 is the default)
hdcp_authenticateWrite by group and owner

Read by all
1: enable authentication upon stream up
0: disable
hdcp_encryptWrite by group and owner

Read by all
1: enable encryption after authentication
0: do not enable encryption after authentication
hdcp_authenticated Read-Only by all 1: Authentication successful
0: Un-authenticated
hdcp_encrypted Read-Only by all 1: Input stream is encrypted
0: Input stream is unencrypted
hdcp_protectWrite by group and owner

Read by all
1: content must be protected - If the encrypted flag is not set, then the output will be blanked
0: no protection is required – disable hdcp blank
hdcp_keyR/W by owner onlyAllows owner to write the HDCP key binary data (read from EEPROM) to IP
hdcp_passwordR/W by owner onlyAllows owner to set a password for the hdcp key in eeprom. After writing (first) password
and (then) key, upon reading back hdcp_password it returns "accepted" when the password
could decrypt the key. It reads back "rejected" in all other cases.
vphy_infoRead-Only by allShows video_phy status for both Rx and Tx
vphy_logRead-Only by allShows event logs captured by both Rx and Tx

Sysfs entries are accessible at /sys/devices/platform/amba_pl\@0/<device_addr>/

For ex:
To read out information on current set output stream
%> cat /sys/devices/platform/amba_pl\@0/<device_addr>/hdmi_info
To enable detailed logging of hdcp events


%> echo 1 > /sys/devices/platform/amba_pl\@0/<device_addr>/hdcp_debug

HDCP Support

Driver supports HDCP1.4 and 2.2 Protocols and exposes the sysfs controls to allow user space to load the encrypted HDCP production keys and read-in the requisite password to decrypt the keys. If the provided password is able to decrypt the keys, keys will be loaded into the required IP blocks and the HDCP feature will be enabled. The driver boots with HDCP disabled as default state. User can load the keys any time after the system is running. An example application that demonstrates the HDCP key loading process from user space will be provided by Xilinx for customer reference. For details on HDCP Support provided by the soft IP please refer product guide pg235 on Xilinx.com

Disclaimer: It is user’s responsibility to provide and protect the confidential key data. HDCP Keys must be programmed into the EEPROM on the board.

Test procedure

HDMI-Tx can be manually configured to generate the required mode. An open source utility like modetest can be used to configure the display pipeline.
  • DDR ==> FB_Rd (DMA) ==> HDMI_Tx

Note: Since 2018.1 introduces a new Xilinx drm driver, below test procedure will cover details for 2018.1 and later versions.
2018.1 and onwards: xlnx

2018.1 and onwards
Sample command to set a mode is shown below
%> modetest -M xlnx -s <connector_id>[@<crtc_id>]:<mode>[-<vrefresh>][@<format>


For ex:


%> modetest -M xlnx -s 30@28:1920x1080-60@YUYV &

Above command will generate a color bar pattern at requested resolution in DDR, configures the DMA to read the frame from DDR and configures the HDMI Tx for said resolution. As a final result Color Bar at defined resolution should be visible on screen.

Driver also supports changing output color formats dynamically. Available output color formats supported by DMA engine can be determined using modetest utility as shown below
root@zcu102:~# modetest -M xlnx
Encoders:
id      crtc    type    possible crtcs  possible clones
29      28      TMDS    0x00000001      0x00000000
 
Connectors:
id      encoder status          name            size (mm)       modes   encoders
30      29      connected       HDMI-A-1        600x340         28      29
  modes:
        name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  3840x2160 60 3840 4016 4104 4400 2160 2168 2178 2250 594000 flags: phsync, pvsync; type: preferred, driver
  3840x2160 60 3840 4016 4104 4400 2160 2168 2178 2250 593407 flags: phsync, pvsync; type: driver
  3840x2160 50 3840 4896 4984 5280 2160 2168 2178 2250 594000 flags: phsync, pvsync; type: driver
  3840x2160 30 3840 4016 4104 4400 2160 2168 2178 2250 297000 flags: phsync, nvsync; type: driver
  3840x2160 30 3840 4016 4104 4400 2160 2168 2178 2250 297000 flags: phsync, pvsync; type: driver
  3840x2160 30 3840 4016 4104 4400 2160 2168 2178 2250 296703 flags: phsync, pvsync; type: driver
  3840x2160 25 3840 4896 4984 5280 2160 2168 2178 2250 297000 flags: phsync, pvsync; type: driver
  3840x2160 24 3840 5116 5204 5500 2160 2168 2178 2250 297000 flags: phsync, pvsync; type: driver
  3840x2160 24 3840 5116 5204 5500 2160 2168 2178 2250 296703 flags: phsync, pvsync; type: driver
  1920x1080 60 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, nvsync; type: driver
  1920x1080 60 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: driver
  1920x1080 60 1920 2008 2052 2200 1080 1084 1089 1125 148352 flags: phsync, pvsync; type: driver
  1920x1080 30 1920 2008 2052 2200 1080 1084 1089 1125 74250 flags: phsync, pvsync; type: driver
  1920x1080 30 1920 2008 2052 2200 1080 1084 1089 1125 74176 flags: phsync, pvsync; type: driver
  1920x1080 24 1920 2558 2602 2750 1080 1084 1089 1125 74250 flags: phsync, pvsync; type: driver
  1920x1080 24 1920 2558 2602 2750 1080 1084 1089 1125 74176 flags: phsync, pvsync; type: driver
  1600x900 60 1600 1624 1704 1800 900 901 904 1000 108000 flags: phsync, pvsync; type: driver
  1280x1024 60 1280 1328 1440 1688 1024 1025 1028 1066 108000 flags: phsync, pvsync; type: driver
  1280x800 60 1280 1328 1360 1440 800 803 809 823 71000 flags: phsync, nvsync; type: driver
  1152x864 60 1152 1216 1336 1520 864 865 868 895 81579 flags: nhsync, pvsync; type:
  1280x720 60 1280 1390 1430 1650 720 725 730 750 74250 flags: phsync, pvsync; type: driver
  1280x720 60 1280 1390 1430 1650 720 725 730 750 74176 flags: phsync, pvsync; type: driver
  1024x768 60 1024 1048 1184 1344 768 771 777 806 65000 flags: nhsync, nvsync; type: driver
  800x600 60 800 840 968 1056 600 601 605 628 40000 flags: phsync, pvsync; type: driver
  720x480 60 720 736 798 858 480 489 495 525 27027 flags: nhsync, nvsync; type: driver
  720x480 60 720 736 798 858 480 489 495 525 27000 flags: nhsync, nvsync; type: driver
  640x480 60 640 656 752 800 480 490 492 525 25200 flags: nhsync, nvsync; type: driver
  640x480 60 640 656 752 800 480 490 492 525 25175 flags: nhsync, nvsync; type: driver
  props:
        1 EDID:
                flags: immutable blob
                blobs:
 
                value:
                        00ffffffffffff001e6d085b92a10400
                        031a0103803c2278ea3035a7554ea326
                        0f50542108007140818081c0a9c0d1c0
                        81000101010108e80030f2705a80b058
                        8a0058542100001e04740030f2705a80
                        b0588a0058542100001a000000fd0038
                        3d1e873c000a202020202020000000fc
                        004c4720556c7472612048440a2001d9
                        020330714d902220050403020161605d
                        5e5f230907076d030c001000b83c2000
                        6001020367d85dc401788003e30f0003
                        023a801871382d40582c450058542100
                        001a0000000000000000000000000000
                        00000000000000000000000000000000
                        00000000000000000000000000000000
                        00000000000000000000000000000026
        2 DPMS:
                flags: enum
                enums: On=0 Standby=1 Suspend=2 Off=3
                value: 0
        5 link-status:
                flags: enum
                enums: Good=0 Bad=1
                value: 0
 
CRTCs:
id      fb      pos     size
28      47      (0,0)   (3840x2160)
  3840x2160 60 3840 4016 4104 4400 2160 2168 2178 2250 594000 flags: phsync, pvsync; type: preferred, driver
  props:
 
Planes:
id      crtc    fb      CRTC x,y        x,y     gamma size      possible crtcs
27      28      47      0,0             0,0     0               0x00000001
  formats: XB24 XB30 XR24 XV24 VU24 XV30 YUYV UYVY NV16 NV12 XV15 XV20 BG24 GREY Y10  RG24
  props:
        6 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 1
 
Frame buffers:
id      size    pitch

Refer Line "formats" that indicates the FrameBuffer DMA IP configuration supports XB24 XB30 XR24 XV24 VU24 XV30 YUYV UYVY NV16 NV12 XV15 XV20 BG24 GREY Y10 color formats. This setting is configured by the DMA driver device tree node property xlnx,vid-formats

DEBUG Capability

HDMI Linux driver implements the capability to tap IP status at pre-defined points in the control flow. User can enable the debug taps by uncommenting the pre-processor directive (#define DEBUG) to monitor the progress within the driver. All debug prints are sent to serial console and can be viewed in kernel dmesg buffer

Boards Supported

Driver has been tested on following boards
  • zcu102 Rev 1.0
  • zcu106 Rev 1.0

Driver has been tested with HDMI FrameBuffer Example Design design

Change Log

2020.2

2020.1

2019.2

  • Summary
    • Driver updated for 2019.2
    • Enabled suspend and resume
    • Updated license file for 2019.2
  • Commits
    • be354c license: Update the license 2019.2
    • 55a308 phy: Enabling 4th GT channel in TX
    • 7eeeb1 hdmitx:hdmirx:vphy: Enabling suspend and resume
    • b608fb hdmitx:hdmirx:phy: remove "addtogroup" from files
    • e8da36 hdmitx:hdmirx:vphy: Driver update till 20190814

2019.1

  • Summary
    • Fixed a bug so that HDMI/DVI mode is selected according to the connected monitor EDID
    • Updated lookup table for audio ACR N parameters
    • Made HDMI driver compliant with 4.19 linux kernel version
    • Made driver compliant with DTG tool generated Device tree nodes and updated the documentation.
    • Added support for NTSC and PAL resolutions
    • Added 10bpc media bus format support
    • Changed TX HPD to interrupt based
    • Updated license file for 2019.1
  • Commits
    • 21c537 hdmitx:hdmirx: 10 bit format support
    • cf0a56 hdmitx: hdmirx: vphy: Driver update 5Apr2019
    • 6f65b2 hdmitx: modify lookup table for audio N parameter
    • fe84ed license: Update the license obtained from legal
    • 3b3484 dt:bindings: Updated the documentation on DT bindings
    • 947f4f tx: hdmirx: vphy: Driver update 14Mar2018
    • 53af3d hdmitx: Changing tx hpd interrupt based
    • e96b83 hdmitx:hdmirx:vphy: Support for auto DTG
    • 1701dc hdmitx: HdmiTx is not put in DVI mode when attached to a DVI monitor
    • e6284b hdmirx:hdmitx: NTSC and PAL resolution support
    • cccf4a hdmitx:hdmirx: Adaptation to 4.19 kernel version

2018.3

  • Summary
    • Added interlace resolution support (except NTSC and PAL)
    • Added support for audio using Xilinx PL Audio Formatter IP
    • Removed si5324 driver from hdmi-module and now its part of kernel.
    • Fixed bugs in 2018.1 and earlier release
  • Commits
    • 2a05aa hdmitx: use TMDS clock ratio flag for 4k in audio driver
    • 5d42de hdmitx:hdmirx:vphy:dt:bindings: Drivers update 20181004
    • 80dbb6 hdmirx:hdmitx: Interlace field 1 calculation fixed
    • 47bff5 hdmitx: Enabling audio in TXstreamupCb
    • f0a2a7 clk: Removing si5324 from hdmi_module
    • aa2455 hdmitx: Changed error to warning for non supported fourcc
    • 74a4c6 dt:bindings: Update related to snd-pcm name
    • 1c0710 hdmitx:hdmirx:phy: Update driver version 20180817
    • 99b8e7 hdmitx:hdmirx:dt:bindings: Updating comments and doc for audio
    • f9994e hdmitx:hdmirx:phy: Updated driver IP version
    • 5bc312 hdmitx: Disable IbufD when cable disconnect
    • b8508a hdmitx:hdmirx:dt:bindings: Integration of audio
    • a0771b hdmitx: Correction in XVidC_GetVideoModeIdExtensive

 2018.1

  • Summary
    • Updated to support v3.1 HDMI-Tx IP. This is the default IP version in the catalogue
    • Moved to new component based drm framework interface from Xilinx. This driver is not backward compatible with the older framework
  • Commits
    • 20a28a hdmitx: add gcp avmute capability
    • c58ab7 add BGR8 memory format to video common
    • ebee44 Initial release of 2018.1 hdmi drivers as kernel modules

Related Links