TL’DR: I tried to attach three monitors to Lenovo’s Ultra Dock. At least at the moment, that only works if one of the monitors is attached to the analog VGA port because the Intel Graphics Driver does not support nested MST.
For the better half of a decade, my primary laptop has been a Thinkpad Edge 11. The dedicated ATI graphics unit was a major pain: using the open source drivers, the GPU idled around 60°-70° C (even using DPM ) and constantly caused the fan to go bananas. The only way to make the battery last for more than 90 minutes was to use a specific (read: very old) version of the proprietary driver. If you ever think about using Linux on a Laptop with AMD graphics: do not.
So when I bought a new Laptop, I made sure it came with a plain Intel Graphics Adapter. Intel seems to be the only chip manufacturer who gives a damn about the Linux community, since they actively support the development of open source drivers for their graphics chips.
Now there it was, a brand new Lenovo X250 with the Broadwell HD5500 graphics adapter and the matching Ultra Dock. My joy knew no limits. That was until I tried to connect my monitors.
The Ultimate Dock has a multitude of display ports: 2 DisplayPort (DP 1.2 compatible), 1 DVI-I, 1 HDMI, and 1 VGA. Unfortunately, not all of those ports can be used at the same time. The DVI-I and the HDMI port are each mutual exclusive with one of the Display Ports. So you can actually only attach two monitors two the dock, if you do not want to use the analog VGA adapter.
To understand this limitation it helps to know a little bit about the Ultimate Dock’s graphics ports are implemented: Since the DisplayPort 1.2 standard, Display Port supports daisy chaining. That means you can attach several monitors to the same display port. So you attach your first monitor to the Display Port on your computer, the second monitor to an output-port of your first monitor and so on. The underlying protocol is called Multi-Stream-Transport (MST).
So, Lenovo used this protocol for their docks. The dock contains a three port MST hub. So the DVI-I and the HDMI ports are technically adapters attached to two of the DisplayPorts. They each share their port with a real Display Port outlet. If you use the DVI-I or the HDMI port, the according Display Port is therefore disabled. But it is a three port MST hub, so where is the third DP? It is the VGA port! They actually flanged a VGA port onto the Display Port.
That means if you want to attach three Monitors to the dock, one of them has to be attached to the VGA port. Also, you have to disable the integrated display first, because the HD5500 does only support three monitors at a time and that includes the laptops display.
Now, it is theoretically possible to nest those MST hubs. So in my juvenility, I bought an MST hub and attached it to the dock. The first reaction of my X-Server to that idea was to freeze completely to a degree where I had to hard reset the computer (reproducible). After about two hours, I achieved the summit of my success: a mirrored picture on all three monitors. Great.
Even better: the only way to not completely freeze the laptop when attaching a monitor to the MST hub was to first attach the monitor, then attach the MST to the same port the monitor was connected to and attach all monitors to the hub sequentially. For that to work, the display manager has to be loaded, but not yet the window manager. Seriously. WTF.
The funny thing is that everything actually works as designed if the MST hub is connected to the laptops Mini-DisplayPort instead of the Docks DisplayPort. That got me thinking. A year ago, there had been a lot of trouble with the new Lenovo Docks when using Linux. No Linux video driver supported MST yet. The Intel open source driver is actually the first driver to support MST. But obviously, that implementation does not support nesting.
After putting half the weekend into that discovery, I had two choices: Attach the monitors to the laptops Mini-DisplayPort or use the docks VGA/DisplayPort-freak. I went for the VGA port. Even though the video quality and brightness is visibly worse on the monitor attached to the VGA, the Mini-DisplayPort just seems too fragile to use it everytime I dock the laptop.
In order to switch the display layouts between docked and undocked state, I created two shell scripts:
Docked:
#!/bin/bash
xrandr --output DP2-3 --mode 1920x1200 --rotate left
xrandr --output eDP1 --off
xrandr --output DP2-2 --mode 1920x1200 --primary --pos 1200x400
xrandr --output DP2-1 --mode 1920x1200 --rotate left --pos 3120x0
and undocked:
#!/bin/bash
xrandr --output eDP1 --auto
xrandr --output DP2-1 --off
xrandr --output eDP1 --auto
xrandr --output DP2-2 --off
xrandr --output DP2-3 --off
When going from undocked to docked, a display has to be connected before disconnecting the internal display (eDP1), otherwise the window manager will terminate. When going from docked to undocked, you might also want to repeat the internal display connection sequence. It does not hurt to call that command if the display is already connected, it just does not do anything then. But if DP2-1 was disconnected in our example we might end up in the login manager, which can be really annoying if you have a lot of unsaved documents.
Another thing: At least for me, the disconnect of eDP1 did not release the CRTC (the channel which the monitor uses to speak to the graphics adapter). That means I could not connect another display, even though the internal display was disabled. I fixed this by installing the current development version of the Intel driver from Git. That broke my arandr, but at least I could use three external monitors then.
Do not get me wrong. I love my Linux, and I obviously always will. But the graphics adapter drivers seem just broken. They have been a nightmare for years and it does not look like that is going to change anytime soon.