TL;DR: this is a long rambling semi-rant of the sort I occasionally go off on. If you just want to get 4k 60Hz working under Ubuntu on the Pi, skip down here.
Your humble correspondent is, dear reader, something of a luddite when it comes to display technology. On my desk is a (by modern standards) positively pedestrian 1080p monitor attached to my PC, and another one attached to my main development Pi. Not for me, a high-DPI dual- or triple-monitor setup!
I’ve never found a particular need for multiple monitors on a machine and, every time I’ve tried it, the OS in question (whether Linux or Windows) has found some novel way to screw things up, whether it be with full-screen applications, moving things between monitors, or even positioning a centered dialog box.
The more recent advances in high-DPI displays have also done little to enthuse me. My little laptop with its 11.6” screen (no, I don’t want a huge 15”+ luggable with a numeric keypad, it’s meant to be portable!) has a high-DPI 1080p screen (~190dpi). As a result, the curves and lines of fonts on the screen are beautifully smooth … and too small to be legible to my aging eyes without cranking up the display scale . So when the Pi 4 was released with 4K display capability! and dual micro-HDMI ports! my interest was not exactly piqued until I got to dual USB3 ports! and more than 1GB of RAM!
Several people have commented, upon learning of my solo-screened predilections, “how do you cope with having to switch between applications? I need two screens so I can be working on one while looking something up on the other.” This is a reasonable concern. I always need a couple of windows open: the terminal I’m working in, and the web-browser I’m reading something from. But the answer has existed for a good long time, and is available in every modern OS and windowing system: tiling.
I stick my terminal on the left, my browser on the right and now, not only do I enjoy two windows together on the screen, they both have a pleasingly A4-paper-esque aspect ratio which is greatly preferable for reading . Naturally, there are downsides. The sheer number of websites which purport to have a responsive design but casually fall off the right of the screen is infuriating .
The Unbearable Lightness of Daytime TV
Thus I remain firmly unconvinced by the benefits of having multiple monitors. My friend Ben did, however, come up with a setup which I confess I would merrily steal were it not for a distinct lack of space on my desk … buy a TV.
Now, I don’t just mean any mere kitchen-suitable model, barely capable of the 1080p of yesteryear. No! A full-throated, red-blooded, 40 diagonal inches of ultra HD 4K-ready LED TV, ready to blast screaming rainbows at your reluctant retinas!
This makes use of 4K display outputs without producing text that requires squinting through a loupe to read. Furthermore, it doesn’t cost an arm and a leg like most multi-monitor setups (my frugality in computing extends beyond the mere computer!).
It sounds expensive, and if you’re purchasing a 40” monitor … it really is. You’ll be hard pushed to find anything at the 40” scale in monitors for less than 700 quid. If you do find something for less than that … you’re likely to find it’s actually just a TV being sold as a monitor . TVs, on the other hand, can be found at this scale for well under 400 of your finest pounds sterling.
Why the price difference? Surely TVs do a lot more than a monitor? They’ve all got speakers (unlike many monitors), they’ve all got tuners, and these days at this scale they’ll all have some “smart” functionality (i.e. some rubbish menu system to run their “apps”), not to mention some IR / Bluetooth remote thingy. Is it all a gigantic con? Slap “monitor” instead of “TV” on a screen and you can instantly sell it for twice the price?
The Need for Speed
Monitors at this scale all boast of their response time, and it’s usually something under 10 milliseconds. From the signal coming out of your computer, to it being beamed to your eager eyeballs, is typically less than one frame’s duration at a 60Hz refresh rate. But for a TV it doesn’t matter at all if it takes one (or more) frame’s time between Disney+ pumping a signal down your broadband connection, to The Bob’s Burgers Movie infesting your childrens’ brains.
This (allegedly) matters for gamers.
Being a gamer myself (though not the sort of twitchy adrenaline junkie who runs around pwning people in CoD … wandering around admiring the stark-yet-beautiful scenery in Fallout is more my speed), I suppose it ought to matter to me but I can’t say I’ve ever given it much thought. Then again, I’ve always used a monitor and not a TV so perhaps I’ve never had a display where it mattered?
But, hold fire! What about these “console” things? I’m reliably informed these are even more popular than a PC for gaming , yet … they typically plug into a TV. Are the inputs of console gamers all stuck several frames in the past? The lag ruining their reactions? Are they unable to compete with the might of the PC Gamer?
Erm … no. Or if they are, I certainly can’t notice it on my daughter’s Switch running Minecraft on the TV downstairs. Having said that, we’ve already established the acuity of my visual system is far from perfect. Still, the point stands. For my purposes (and thus presumably a few others): yes, it’s all a giant con and one can get a screen of twice the size for half the price simply by searching for “TV” instead of “monitor” when shopping.
This’ll Hertz Me More …
The Pi 4 is capable of running 4K at 60Hz, but it won’t do it out of the box, and it requires some gentle cajoling to get it in the mood for 60Hz operation. The reason for this is simple: 4K at 60Hz is pushing the absolute limits of the Pi 4’s display hardware and as a result there are limitations when using it.
Firstly, ensure you have an adequate cable. Specifically, you need an HDMI 2.0 or later cable in order to support 4K at 60Hz. Confusingly, HDMI 1.4 cables support the 1080p resolution at 60Hz, and the 4K resolution but only up to 30Hz. You need HDMI 2.0 (or later) cabling to support the 4K resolution at 60Hz. If, like me, you’ve been stuck in 1080p land for a while you may have amassed a small hoard of spare HDMI cables, only to find that none of them support HDMI 2.0. Sorry!
Next, use the HDMI-0 port on the Pi; the HDMI-1 port cannot be used when operating at 4K 60Hz. The HDMI-0 port is nearest the USB-C power port on the Pi 4, and nearest the micro-SD card slot on the Pi 400.
Now it’s time for some configuration changes. Firstly, add the following line to config.txt on the boot partition :
The line should appear under an [all] section (or I suppose more correctly a [pi4] section which would mean it only applies to a Pi 4, 400, CM4, or CM4S — however, it won’t cause any issues on older models as the bootloader will simply ignore the line on those).
Finally, reboot your Pi to apply these changes. When you’re back to your desktop you may note, if you are already in a 4K resolution, that you’re still operating at 30Hz (your mouse motion will not look smooth!). This is because you still need to tell your desktop to switch to the higher refresh rate. In Gnome, this is as simple as going to Settings, selecting “Screen Display” on the left, and then picking “60Hz” under the “Refresh Rate” option.
After your screen does its mode-switching dance, you should have buttery smooth mouse motion!
Be warned that 4K at 60Hz is not exactly a paradise on the Pi. This resolution requires significantly more memory for many things and, in particular, I’ve found that several things cannot operate full-screen. Notably, Firefox crashed quite painfully when I was attempting to test it playing a video full-screen. However, when Firefox was forced to run purely under Wayland  (as opposed to the XWayland server it defaults to currently), it did succeed in working (not smoothly, but at least it didn’t burst into flames).
The Pi will also run hotter and demand more power at this resolution and framerate. If you experience crashes, double-check you have a good power supply that isn’t dropping voltage at higher loads (even if you’ve never had problems before, that’s no guarantee you won’t with this configuration).
That’s all for this time! Next, I’ll be having a look at spinning up a custom desktop from cloud-init.
|||thank goodness Wayland makes fractional scaling on Gnome fast; 200% was too big, but 150% is perfect|
|||have you noticed how many websites limit their horizontal width? There’s a reason for this …|
|||GitHub recently fixed this after being broken for nearly a decade, meanwhile Google now frequently falls off the right after spending the last decade being perfect … oh well, you win some, you lose some|
|||… with a remote|
|||Oh look, it’s a “monitor” with … a remote for Netflix, Disney+ and Prime Video. Amazon, you really are the new flea-bay|
|||How this came to be when they lack even the most basic sort of mouse I have no idea|
|||This is typically mounted on /boot/firmware on Ubuntu, or /boot under RaspiOS|
|||This can be done by adding export MOZ_ENABLE_WAYLAND=1 to your ~/.profile script and re-logging in. Hopefully this mode will become the default in the near future, as Firefox operates visibly more smoothly under pure Wayland|