Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8609

Bare metal, Assembly language • Re: Dual HDMI output in bare metal RPi4

$
0
0
Addressing Dual HDMI on Raspberry Pi 4 (Bare Metal)
The Challenge Addressing both HDMI ports on the Raspberry Pi 4 in a bare-metal environment is significantly more complex than on previous generations due to the architectural shift in the BCM2711 SoC. Unlike the older VideoCore IV models, which offered a simple single-framebuffer abstraction via the mailbox property interface, the Pi 4 requires direct orchestration of the entire video pipeline.

To output signals to both screens, a developer must manually configure the Hardware Video Scaler (HVS) to manage multiple planes, synchronize the Pixel Valves (PV) for timing, and—crucially—initialize the HDMI PHY (physical layer) for each port. Since Broadcom’s register documentation for these components is sparse, the Linux VC4 DRM driver source code is often the only reliable reference. Consequently, writing a fully functional dual-HDMI driver from scratch is a massive undertaking that involves reverse-engineering and can easily consume months of development time.

The Workaround (config.txt) A potential solution involves leveraging config.txt. As previously mentioned, the firmware can initialize both screens during the boot process.

Here is an example configuration:

Code:

# config.txtmax_framebuffers=2hdmi_force_hotplug:0=1hdmi_force_hotplug:1=1# Optional: Force a fixed resolution to avoid timing issueshdmi_group=2hdmi_mode=82 # Example for 1080p60
Retrieving the Framebuffers When the system boots, the firmware reserves two framebuffers in RAM. You would typically query the dimensions and pointers sequentially via the Mailbox Interface (Tag 0x00040001 - Allocate Buffer).

The Catch: Standard mailbox calls often default to "Display 0" and ignore the second screen. However, there are extended tags or Device Tree entries (if you are able to parse a DTB) that reveal the address of the second buffer ("Simple Framebuffer").

Does anyone happen to know the specific IDs for these extended mailbox tags? I am only familiar with the theory and haven't attempted this implementation myself yet.

Otherwise, the only remaining option is to dig into the Linux Kernel source code: https://github.com/torvalds/linux/tree/ ... pu/drm/vc4 But be warned, that is a significantly more complex path.

Satyria

Statistics: Posted by satyria — Wed Dec 17, 2025 6:21 am



Viewing all articles
Browse latest Browse all 8609

Trending Articles