Use DisplayLink in Gentoo

I've been using Gentoo on my desktop for over five years. The computer connects to a 1080p monitor. Recently I use a DisplayLink 6xxx dock station to connect to a 4k monitor.

Current Configurations

I don't have any plans to replace the computrt. The only option is to make it work with my current configurations.

  1. The graphic card can only support 1080p.
  2. I have two monitors. One is 1080p, the other 4k.
  3. I have a Dell Universal Dock - D6000. It's using DisplayLink and can support 4K monitors.
  4. I'm using i3wm. There aren't any display managers. Instead, I start x11 when I login on console. Only i3wm is used.

Given the existing configurations, I decide to connect to the 1080p monitor from the graphic card, and connect to the 4k monitor as a second monitor via the dock.

Install the Driver

I follow Gentoo DisplayLink wiki to set up the kernel. The wiki however looks outdated in general.

The only official driver for Linux is for Ubuntu. This article suggests to adapt the script to port the driver to other distributions. It's easier said than done. There is an overlay zyrenth that has ebuilds for displaylink-driver and evdi packages. The ebuilds are solid. But there are some issues with evdi and displaylink manager themselves.

  1. evdi version 17.0 fails to compile with kernel 5.10. It's fixed in later versions.
  2. evdi version 19.0 is not compatible to Display Manager 5.3.1, which is the version from the displaylink-driver ebuild.

The only viable option is the evdi version 17.2. It's not provided in the overlay zyrenth. But build on top of others' work, I'm able to create my own ebuild. I follow the wiki custom ebuild repository to create a local repository. How to create a 17.2 ebuild? Just copy the 17.0 from overlay zyrenth and rename it 17.2. Then I have the ebuild for evdi version 17.2 and install it.

Configure HiDPI

The 4k monitor's maximium resolution is 3840 × 2160. Everything seems quite small on it. It's unpleasant to use. We need to conifure it for HiDPI. According to HiDPI document, I make this changes.

  1. Pass --dpi 196 when using xrandr.
  2. Set the xft.dpi: 196 in .Xresource and merge it with xrdb.
  3. Set the scaling factor for Gnome environment.
    gsettings set org.gnome.desktop.interface scaling-factor 2
    gsettings set org.gnome.desktop.interface text-scaling-factor 2
  4. Set the scaling factor for Qt.
      export QT_FONT_DPI=196
      export QT_SCALE_FACTOR=2
  5. Set the scaling factor for GTK based applications.
    export GDK_DPI_SCALE=2

I don't use Gnome or KDE and haven't verified how the settings for Gnome and Qt work. It seems xft.dpi setting makes the status bar in my i3wm larger and nicerr. But it doesn't make Firefox or Thunderbird or other GTK based appliations more legible. I have to use GDK_DPI_SCALE.

Probably it's because of my own configuration, I spend quite a while setting the HiDPI. I haven't tried other desktop environments. While I'm searching online, I feel like some desktop environment has the configuration from the GUI. That may make it easier for those desktop environments.

Connect to the Second Monitor

The second monitor is connected via the dock. The monitor capability in the dock isn't hotplug-able. So it's important to connect it to the computer when the system boots. After that, we can disconnect and re-connect the dock and we still can use the second monitor.

There are some extra work to connect to the second monitor. It's needed only one time when x11 starts.

  1. The displaylink-driver installs a dlm systemd service. The service has to be started after x11 starts. Since I start x11 from the console, I have to run systemctl start dlm once i3wm starts.
  2. I have to run xrandr --dpi 196 --output DVI-I-1-1 --mode 3840x2160 --rate 60 --right-of VGA-0 once after i3wm starts.

After running that, the second monitor is ready. I can disconnect and re-connect the dock at any time.

There are some research involved. It's not too difficult to find them. But overall, there are documents I can borrow to set up the DisplayLink for Gentoo.


Leave a comment

Your email address will not be published. Required fields are marked *