Fast Remote Desktop on the Raspberry Pi

I love network computing, so I decided to improve it with a slice of Pi.

Given that I’m very familiar with RDP and use it routinely (I’m prone to set up sessions across the Atlantic Ocean to this Linode, where I keep a copy of the Android SDK and a few extra things that I can access from my iPad), I’ve been searching for a way to use it properly on the Raspberry Pi – i.e., speedily and with the minimum amount of hassle.

Raspbian includes rdesktop and a couple of other clients, but they all require X11 – which at this point in time lacks hardware acceleration and is more of a hindrance than help.

However, FreeRDP includes a DirectFB client that is almost completely functional and that is vastly more performant than anything using X11 on the Pi – and considering that RDP updates are essentially highly optimized bitmap transfers, accessing the frame buffer directly is probably faster than trying to run those updates by the GPU.

So even though it would be nice to have accelerated X, it likely won’t be as fast as DirectFB. The only thing that’s likely to be somewhat faster is a fully native OpenGL ES implementation, but I haven’t found one yet (I’d love to be proven wrong on this, though, for the sake of completeness).

Building the client

After digging around a bit, I came up with the following recipe for setting it up using the latest stable tarball as of this writing1:

If cmake fails along the way simply apt-get the required libraries. When you’re done, you’ll have a dfreerdp executable that you can invoke with something like:

Granting Permissions

However, nothing–s quite that simple. For starters, dfreerdp will need access to a number of system devices (like /dev/fb0), so you’ll have to run it as sudo until you grant access to all required devices2 via udev:

And even then, you–d better make triply sure that all your graphics settings are correct - the Raspberry Pi lacks default directfbrc and complete fb.modes files, so there’s plenty more to do:

Massaging the Frame Buffer

First, begin by making sure /boot/config.txt sets the framebuffer size properly (herewzxhzdk:23s my settings wzxhzdk:22 I prefer 16 bit mode since itwzxhzdk:24s more responsive, and set the hardware depth accordingly to minimize overhead):

Then you have to make sure that /etc/fb.modes lists valid modes for your monitor (Iwzxhzdk:21m using a 1920x1080 LCD panel, and tend to work in TV-equivalent resolutions):

And, finally, you need to set /etc/directfbrc to:

You can learn more about these settings by reading the man page, if youwzxhzdk:20re so inclined.

Running it

Some experimentation may be in order (especially regarding keymaps, that bane of every remote user), but I think you’ll find this to be speedier and pleasanter than other remote desktop solutions for the Raspberry Pi wzxhzdk:17 Iwzxhzdk:18m using it against a native xrdp server, and itwzxhzdk:19s good enough to scroll a full-screen web browser without hassle (and much, much faster than anything you could possibly run locally on the Pi).

As usual, lowering your resolution will make a very significant difference wzxhzdk:16 I find 1280x720 to be almost as good as sitting at my server console, but prefer 1920x1080 for researching and coding.

Right now the only (minor) hassle I’ve come across is the lack of dynamic cursors in the DirectFB client, but Iwzxhzdk:15m hoping the FreeRDP folk will eventually get around to it.

  1. Judging from the Github repo, there were a few recent changes that add a bunch of dependencies wzxhzdk:14 none of which we actually need for running the DirectFB client. Still, you might want to check out the build instructions just the same. ↩︎

  2. Note that the pi user is already a member of the video group – so if youwzxhzdk:13re using another username, make sure you sudo usermod -a -G video username to add yourself to it. ↩︎