Getting an LG UltraFine 5K working on Hyprland
The LG UltraFine 5K was designed for Macs. It has a Thunderbolt 3 port, no brightness buttons, and a 5120×2880 panel. Driving that panel takes two DisplayPort streams: when the monitor came out, a single DisplayPort 1.2 stream could not carry 5K at 60 Hz. Each stream drives one 2560×2880 half of the panel. The monitor identifies these as two tiles in its EDID, with positions (0, 0) and (1, 0) in the same enclosure.
macOS presents the two tiles as one display. My ThinkPad, running Arch and Hyprland on an AMD 780M, treated them as separate monitors.
What Linux sees
hyprctl monitors listed two outputs, DP-3 and DP-4, with the same make,
model and serial. The left one ran at 3840×2160 and the right one at
2560×2880, with different scales. The left half of the panel was a stretched
4K picture, and the right half was a separate desktop that did not line up
with it.
The 3840×2160 mode is the monitor's single-stream fallback. When only one tile gets a signal, the monitor scales that picture across the whole panel. This gives me one desktop with the stock setup, but at a lower resolution than the panel supports. Text looks noticeably soft.
I could also run both tiles at their native 2560×2880, at scale 2, and place them next to each other. Text is sharp that way, but Hyprland still treats each half as a separate monitor. Each gets its own workspace, and fullscreen video fills only half the panel.
I wanted the third option: one 5120×2880 output.
Reading the source
Hyprland talks to the kernel's display API (KMS) through a library called
aquamarine. A search through the
Hyprland source for tiled displays only finds window tiling. Aquamarine is
more interesting. It already reads the TILE property of each connector, and
it has a function called markRedundantTiles().
That function handles one case: a GPU driver that merges the tiles itself and
exposes one connector with the full 5120×2880 mode. Then aquamarine hides the
other connectors so the compositor does not see duplicates. amdgpu does not do
that. It exposes each tile as its own connector with its own modes, so
markRedundantTiles() finds nothing to do, and Hyprland gets two monitors.
What the hardware can already do
KMS planes provide a way to do this. Each plane scans out a framebuffer, using a
source rectangle (SRC_X, SRC_Y, SRC_W, SRC_H) to select the region to
display. Aquamarine always set that rectangle to the whole buffer. Two CRTCs,
one per connector, could instead read from the same 5120×2880 buffer, each
displaying its own half.
So the plan for the patch was:
- When both connectors of a tile group are connected and the driver does not merge them, make the tile at (0, 0) the output. Hide the other tile from the compositor, but keep a CRTC assigned to it.
- Give the output one extra mode, 5120×2880, marked as preferred. Each CRTC still runs its own tile's real 2560×2880 timing.
- In that mode, every frame is one atomic commit that updates both CRTCs, each primary plane with its own source rectangle. Atomic commits are all or nothing, so the two halves always show the same frame.
- Count a frame as presented only after both CRTCs have delivered their page-flip event, so the next commit cannot hit a CRTC that is still busy.
- Copy gamma and the colour matrix to both CRTCs, so a night-light tool does not turn one half orange.
- Use a software cursor. The hardware cursor plane belongs to one CRTC and would vanish on the right half.
An existing function helped with item 3: aquamarine already has code that restates other connectors' CRTCs and planes inside one commit, for drivers that only accept a modeset when every head is configured at once. The tiled commit follows the same pattern.
Hyprland itself needed no changes. It uses the mode's pixel dimensions to size its render buffer and leaves the kernel timings to aquamarine. That lets aquamarine advertise a 5120×2880 output while programming each tile with its real 2560×2880 timing.
Does the kernel agree?
I still needed to check whether amdgpu would accept two CRTCs reading from
different regions of one buffer. I built the patched aquamarine against version
0.15.1, the version my Hyprland binary uses. It exported all the symbols
Hyprland needed, so I could test it without rebuilding the compositor. I started
a second Hyprland session on another TTY, with LD_LIBRARY_PATH pointing to the
patched library. The log showed both tiles being configured:
drm: Connector DP-4 is tile (1, 0) of DP-3
drm: connected slot 2 crtc 386 assigned to DP-4
drm: DP-3 drives 2 tiles as one output, mode 5120x2880@60.00Hz
drm: Modesetting DP-3 with 5120x2880@60.00Hz
hyprctl monitors showed one monitor at 5120×2880, scale 2: 2560×1440 of
desktop at the panel's full sharpness. On screen it was one display, with no
seam.
To make it the default without replacing a system library, ~/.profile sets
LD_LIBRARY_PATH for the session, but only while the system aquamarine is
still exactly 0.15.1:
if [ "$(readlink -f /usr/lib/libaquamarine.so.14)" = /usr/lib/libaquamarine.so.0.15.1 ] && [ -f "$HOME/.local/lib/aquamarine-tiled/libaquamarine.so.0.15.1" ]; then
export LD_LIBRARY_PATH="$HOME/.local/lib/aquamarine-tiled${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
If a system update changes that library version, the guard stops loading the patch. I lose the combined 5K output until I rebuild it, but Hyprland can still start.
Brightness is a USB HID report
The UltraFine has no brightness buttons at all. On a Mac the brightness keys
just work. On Linux the monitor shows up as a USB hub with a camera, audio,
and a device called "LG UltraFine Display Controls" (043e:9a70). Its HID
report descriptor declares a VESA brightness control: a feature report with a
32-bit value and a 16-bit transition time.
Two details took a couple of tries:
- The descriptor says the range is 4 to 540. The device actually works in hundredths of that, 400 to 54000. I first tried to guess the scale from the current value. That worked until the brightness got low enough to look like the small scale, and from then on every write landed below the real minimum and did nothing.
- After a write, the device keeps reporting the old value for about half a second. Two quick steps in a row both started from the stale value, so holding a key did nothing useful. The script now remembers its own last value for a second.
The result is lgbright, a small Python script that talks directly to
/dev/hidraw*, plus a udev rule that gives the logged-in user access to this
device. Shift plus the brightness keys now adjusts the UltraFine, and a Waybar
widget shows its brightness.
Colour
The panel looked too white to me next to the laptop screen. Its EDID gives Display P3 primaries and a D65 white point. Hyprland treats every monitor as sRGB by default, so it sent sRGB colours to the wide-gamut panel unconverted, which oversaturates them. One line in the monitor rule makes Hyprland use the primaries from the EDID:
hl.monitor({ output = "DP-5", mode = "[email protected]", scale = 2.0, cm = "edid" })
That only changes saturated colours. White and grey stay exactly the same, so it did nothing for the whites. What helped was hyprsunset at 6500 K, which I now start with the session. It applies to every output, not just the 5K.
Sharing it
I had planned to submit the patch to aquamarine, but the project's contribution policy rules that out for this patch.
The hyprwm projects (Hyprland, aquamarine and the rest) have an AI usage policy. An AI model may not submit pull requests or issues, or write their descriptions, and the human contributor has to understand and be able to defend every decision in the change on their own. They are explicit that "Supervision is NOT authorship". On top of that, pull requests are only accepted from vouched contributors.
The patch was written by Claude in a Claude Code session, with me testing it on my hardware. I can explain what it does, but the design decisions came from that session. Under hyprwm's policy, this is not a contribution I can submit. I think that is a reasonable boundary.
I have put the patch in a public gist, along with build instructions, the brightness script, the udev rule, and the same authorship disclosure. It may be useful to others with this monitor and an AMD GPU, or as a reference for an upstream implementation.
What is still broken
The combined output works, but I have seen two problems involving the tiles.
Sync. On one login, the two halves of the panel were visibly out of step. The kernel plane state showed each CRTC reading the intended region of the buffer, and screenshots looked correct. That suggests the problem happened during scanout, after composition. Replugging the cable fixed it. My best guess is that the CRTCs started out of vblank sync: the patch commits both together, but does not ensure they start their frames together.
Resume. After suspend, the 5K did not come back. The log shows the
sequence: amdgpu prints Skip DMUB HPD IRQ callback in suspend/resume, so it
ignores the DisplayPort-over-USB4 hotplug events that arrive while it wakes
up. Hyprland's first 5120×2880 modeset then fails with ENOMEM, even as a
test-only commit, and a few seconds later the second tile's connector drops
out entirely. Hyprland falls back to the 3840×2160 single-tile mode. Again,
replugging fixes it.
I suspect this is in the kernel's handling of the second DisplayPort tunnel,
though I have not confirmed that. The workaround forces detection again after
resume. amdgpu exposes a trigger_hotplug debugfs file for each connector:
writing 0 drops the sink, and writing 1 runs detection. A systemd sleep hook
waits ten seconds after resume, checks whether both tiles are connected and
driven, and re-detects them if needed. The Waybar widget turns red when a tile
is missing, and clicking it runs the same recovery manually.
What a day of suspend cycles showed
Update, 2026-10-16.
The hook never ran. After the first two resumes, the journal had no line
from it at all, and I had replugged the cable both times. The hook started the
re-detect in the background with & and returned. Sleep hooks run inside
systemd-suspend.service, and when that service finishes, systemd kills every
process still left in it. That happened 0.4 seconds after resume, long before
the ten-second wait was over. Starting the re-detect as its own transient unit
fixed it:
systemd-run --no-block --collect --unit=lg5k-redetect-resume \
/usr/local/bin/lg5k-redetect --if-broken
The recovery crashed my apps. On the next resume the hook ran, found no live tiles, re-detected them, and the 5K came back. hyprpaper and hyprpolkitagent segfaulted at the same moment, and Firefox closed. Hyprland itself survived.
The cause was in my patch. The two tiles are detected about 0.3 seconds apart,
whether after a software re-detect or a real replug. When the left tile appeared
alone, the patch announced it as a normal output in its 3840×2160 fallback mode.
A tenth of a second later the right tile arrived, and the patch removed that
output to replace it with the combined one. Wayland clients that tried to bind
the short-lived output as it disappeared got a protocol error
(global wl_output (85) is unavailable) and died.
The same race explained an earlier failure: a physical replug had left the 5K dark, with every modeset failing. On that replug, the rebuild found the right tile without its 2560×2880 mode, so the combined mode was never built. My guess, which I have not confirmed, is that driving the left tile alone in single-stream mode briefly cost the right tile its modes.
The fix is to hold back a tile group until it is complete. The patched aquamarine now announces no output for the 5K until every tile is connected and reports its tile mode:
drm: Tile group 1 has 1 of 2 tiles ready, holding it back
drm: Connector DP-6 is tile (1, 0) of DP-5
drm: DP-5 drives 2 tiles as one output, mode 5120x2880@60.00Hz
Since then, a replug brings back one 5120×2880 output with no intermediate output and no crashed clients.
One failure is still open. After one resume, the right tile came back connected but offering only 640×480. Its EDID still lists the 2560×2880 timing, so the kernel must have pruned the mode, probably because it decided the link could not carry it. The software re-detect did not change that, and the patch now correctly shows nothing rather than a broken output. A physical replug fixed it. I have not found a software reset that reaches this state. When it happens, I click the Waybar widget once, and replug if the 5K stays dark.
The open failure was the Thunderbolt driver
Update, 2026-10-22.
The 640×480 state turned out to be the normal outcome of a resume, not a rare
one. amdgpu's link_settings debugfs file showed why the mode was pruned: the
left tile's link reported HBR2 on four lanes (17.28 Gb/s), the right tile's
only HBR (8.64 Gb/s). 2560×2880 at 60 Hz needs about 11.6 Gb/s.
The Thunderbolt driver's debug messages showed who chose that rate. Both DisplayPort streams share the cable's 36 Gb/s. On resume the driver rebuilds the two tunnels a moment apart. It has to size the first one before the graphics side has read the monitor's capabilities through it, so it books the theoretical maximum. The second tunnel is then sized against what is left:
0:6 <-> 2:10 (DP): consumed bandwidth 0/25920 Mb/s
available bandwidth for new DP tunnel 36000/10080 Mb/s
0:7 <-> 2:11 (DP): bandwidth reduced to 2700 Mb/s x4 = 8640 Mb/s
0:6 <-> 2:10 (DP): DPRX capabilities read completed
0:6 <-> 2:10 (DP): consumed bandwidth 0/17280 Mb/s
Within the same second the first tunnel settles at its real 17.28 Gb/s, which leaves room for the second at full speed. The driver never revisits the cap. On a fresh plug the capability read finishes before the second tunnel is built, which is why replugging always worked.
Nothing I could reach from user space rebuilds a single tunnel. Re-detecting
the connector, putting the right tile's receiver into standby and back over
/dev/drm_dp_aux6, rebinding the Thunderbolt host controller, turning off
the driver's bandwidth allocation mode and keeping the monitor's router out of
runtime suspend all left the right tile at HBR. Rebinding the controller even
capped both tiles. I also first blamed runtime power management for the
monitor "dropping off the bus" twenty seconds after each resume, until I
noticed that those disconnects were me, replugging the cable.
So the fix is to avoid the bug. With the 5K attached, my power menu's suspend entry now locks the session and turns the screens off instead, and a key press or a mouse move turns them back on. The laptop runs on the monitor's power anyway, and hypridle only suspends on battery. Away from the desk, suspend works as before. The proper fix belongs in the kernel's Thunderbolt driver: size the second tunnel only after the first one's capabilities are known, or raise a reduced tunnel once bandwidth frees up.
I also saw one amdgpu REG_WAIT timeout warning in
dcn31_program_compbuf_size, while the display engine was programming its
compressed buffer for the new bandwidth. There was no crash or visible glitch.
It occurred during a commit driving both tiles, so I am noting it here in case
it recurs.
Versions
| Laptop | ThinkPad, AMD Radeon 780M (amdgpu) |
| Kernel | 7.2.10-arch1 |
| Hyprland | 0.56.2 |
| aquamarine | 0.15.1, patched |
| Monitor | LG UltraFine 5K over Thunderbolt 3 |