hotplug-displaylink

Mon, 09 Jul 2012 17:03:20 -0700
tags/fdo

Getting Hotplugging working with a DisplayLink USB to DVI adapter

I merged Dave Airlie's randr provider patches to the server and pushed them out in preparation for freezing the X server for the version 1.13 release. Before freezing, I figured I should at least test hotplugging my DisplayLink adapter. Well, that took all day...

Sources

For the impatient, here's where all of the bits are. These work on my machine.

Upstream bits:

1. randrproto. git://anongit.freedesktop.org/git/xorg/proto/randrproto master

Bits from Dave Airlie's trees:

1. libdrm. git://people.freedesktop.org/~airlied/drm.git prime

2. libXrandr. git://people.freedesktop.org/~airlied/libXrandr.git prime

3. xrandr. git://people.freedesktop.org/~airlied/xrandr.git prime

4. xf86-video-intel. git://people.freedesktop.org/~airlied/xf86-video-intel prime

Bits from my trees:

1. xf86-video-modesetting. git://people.freedesktop.org/~keithp/xf86-video-modesetting prime

2. kernel. git://people.freedesktop.org/~keithp/linux prime

3. X server. git://people.freedesktop.org/~keithp/xserver master

Kernel adventures

The 3.5-rc6 bits have all of the necessary driver changes to support DisplayLink hot-plug. At least, they do if you're not running 32-bit user space atop a 64-bit kernel. If you are, then most of the DRM drivers don't work at all—they're missing the '.compat_ioctl' entry in the file_operations structure, which makes all ioctl calls return -ENOTTY. In particular, the udl driver is missing this entry, so when you plug in the device, the server tries to talk to it and nothing works.

X server adventures

Once I got the kernel working, I discovered some nice crashing behaviour in the X server. If I started the server with the DisplayLink device plugged in, as soon as I tried to enable the output, the server would segfault. Turns out this cases requires special code in the server to ensure that the DisplayLink screen privates are adjust correctly while the intel driver loads.

Modesetting driver fixup

The modesetting driver was missing a rename that happened to a structure member in the last couple of days. I'd bet Dave has the same patch sitting on a disk somewhere.

xrandr changes

The command line additions to xrandr are 'sufficient' to get this stuff working, but I think it could use some improvements to make the interface a bit friendlier. In particular, requiring you to use XIDs to identify providers is a bit harsh.

Schedules

I'll be pushing the X server changes out this evening; review would be appreciated, but I don't think any of the patches I made there are scary. I sent the kernel patches necessary to lkml, but with Dave in transit, I'm not sure who is minding the store.

As for the rest of the bits, they're sitting in Dave's repositories, presumably they'll get pushed upstream soon.

But, does it actually work?

Almost. Everything says it's working, but I'm not getting any signal to my DVI monitor. My DisplayLink device is ancient, and the kernel complains about it, saying

[drm:udl_parse_vendor_descriptor] *ERROR* Unrecognized vendor firmware descriptor".

So close, and yet...