Displaylink: Difference between revisions

From NixOS Wiki
imported>Lillecarl
xorg configuration added, required for me to get displaylink working on 21.05
remove note about pending pr that was merged https://github.com/NixOS/nixpkgs/pull/324121
 
(15 intermediate revisions by 9 users not shown)
Line 1: Line 1:
===DisplayLink monitors===
===DisplayLink monitors===
In order to use Displaylink monitors over USB, such as the ASUS MB16AC, the displaylink driver needs to be installed:
In order to use DisplayLink monitors over USB, such as the ASUS MB16AC, the DisplayLink driver needs to be installed:<syntaxhighlight lang="nixos">
services.xserver.videoDrivers = [ "displaylink" "modesetting" ];
</syntaxhighlight>The module <code>nixos/modules/hardware/video/displaylink.nix</code> should also work for wlroots compositors.


{{bc|<nowiki>$ services.xserver.videoDrivers = [ "displaylink" "modesetting" ];</nowiki>}}
Since these drivers depend on binary unfree blobs, you will need to first add it to your Nix store. Go to https://www.displaylink.com/downloads/ubuntu to get the appropriate driver version and note the download URL you get after accepting the EULA.


Since these drivers depend on binary unfree blobs, you will need to first add it to your nix-store. Go to https://www.displaylink.com/downloads/ubuntu to get the appropriate driver version and note the download URL you get after accepting the EULA. Then (example):
As of 2024-05-01, the current latest version for the driver can be found at https://www.synaptics.com/products/displaylink-graphics/downloads/ubuntu-6.0?filetype=exe.


{{bc|<nowiki>
After you have downloaded the driver, run something like the following, adjusting the version number in <code>displaylink-600.zip</code> to match the version supported in NixOS at the moment:<syntaxhighlight lang="console">
$ nix-prefetch-url --name displaylink.zip http://assets.displaylink.com/live/downloads/software/f1369_DisplayLink%20USB%20Graphics%20Software%20for%20Ubuntu%205.2.zip\?AWSAccessKeyId\=AKIAJHGQWPVXWHEDJUEA\&Expires\=1579838008\&Signature\=4UidRIwBYLZPHSf2EkcyLFKb%2B8o%3D
$ nix-prefetch-url --name displaylink-600.zip https://www.synaptics.com/sites/default/files/exe_files/2024-05/DisplayLink%20USB%20Graphics%20Software%20for%20Ubuntu6.0-EXE.zip
</nowiki>}}
</syntaxhighlight>
 
Before the monitor can be used by {{ic|xrandr}}, you will need to run the following command, which can be added to e.g. your {{ic|~/.xprofile}} (this is not necessary since NixOS 20.03):
 
{{bc|<nowiki>$ xrandr --setprovideroutputsource 1 0</nowiki>}}


====Connecting a second external monitor====
====Connecting a second external monitor====
Line 21: Line 19:
'';</syntaxhighlight>
'';</syntaxhighlight>


====xorg configuration====
==Sway==
After some experimentation at work getting our Dell D6000 docks to work i had to create an xorg configuration file as follows
Identify which card has the render device, <code>evdi</code> is the DisplayLink interface, so it's not <code>card0</code>, but <code>card1</code>.
 
<syntaxhighlight lang="nix">environment.etc."X11/xorg.conf.d/20-evdi.conf" = {
  enable = true;
  text = ''
    Section "OutputClass"
      Identifier "DisplayLink"
      MatchDriver "evdi"
      Driver "modesetting"
      Option "AccelMethod" "none"
    EndSection
  '';
};</syntaxhighlight>


Taken from arch wiki (https://wiki.archlinux.org/title/DisplayLink#Configuring_X_Server)
<syntaxhighlight lang="console">
$ ls -l /dev/dri/by-path
lrwxrwxrwx - root  2 Nov 13:38 pci-0000:00:02.0-card -> ../card1
lrwxrwxrwx - root  2 Nov 13:38 pci-0000:00:02.0-render -> ../renderD128
lrwxrwxrwx - root  2 Nov 13:38 platform-evdi.0-card -> ../card0
</syntaxhighlight>


Note that modesetting is the modern Intel iGPU driver, read further into the Arch wiki if you're experiencing issues.
<syntaxhighlight lang="nix">
environment.variables = {   
  WLR_EVDI_RENDER_DEVICE = "/dev/dri/card1";                                                                                                 
};
nixpkgs.overlays = [
  (final: prev: {   
    wlroots_0_17 = prev.wlroots_0_17.overrideAttrs (old: { # you may need to use 0_18
      patches = (old.patches or [ ]) ++ [
        (prev.fetchpatch {
          url = "https://gitlab.freedesktop.org/wlroots/wlroots/uploads/bd115aa120d20f2c99084951589abf9c/DisplayLink_v2.patch";
              hash = "sha256-vWQc2e8a5/YZaaHe+BxfAR/Ni8HOs2sPJ8Nt9pfxqiE=";
            })     
          ];
        });
      })
];
services.xserver.videoDrivers = [ "displaylink" ];
systemd.services.dlm.wantedBy = [ "multi-user.target" ];
</syntaxhighlight>


evdi is automatically pulled in as a dependency from the displaylink package, you might need to add it to boot.kernelModules.
Note as of [https://github.com/NixOS/nixpkgs/pull/351752 2014-10-30] nixos-unstable sway uses <code>wlroots_0_18</code>. The patch above applies correctly but you will need to invoke sway with the <code>--unsupported-gpu</code> flag.


====Status of the package====
[https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1823#note_2146862 Source]
As of right now (2020-01-24), the package in the {{ic|nixos}} stable channel is out of date, so you may need to override it from {{ic|nixpkgs}}.


Since '''NixOS 20.03''' this package is working out of the box again.
[[Category:Video]]
[[Category:Video]]

Latest revision as of 21:33, 9 November 2024

DisplayLink monitors

In order to use DisplayLink monitors over USB, such as the ASUS MB16AC, the DisplayLink driver needs to be installed:

services.xserver.videoDrivers = [ "displaylink" "modesetting" ];

The module nixos/modules/hardware/video/displaylink.nix should also work for wlroots compositors.

Since these drivers depend on binary unfree blobs, you will need to first add it to your Nix store. Go to https://www.displaylink.com/downloads/ubuntu to get the appropriate driver version and note the download URL you get after accepting the EULA.

As of 2024-05-01, the current latest version for the driver can be found at https://www.synaptics.com/products/displaylink-graphics/downloads/ubuntu-6.0?filetype=exe.

After you have downloaded the driver, run something like the following, adjusting the version number in displaylink-600.zip to match the version supported in NixOS at the moment:

$ nix-prefetch-url --name displaylink-600.zip https://www.synaptics.com/sites/default/files/exe_files/2024-05/DisplayLink%20USB%20Graphics%20Software%20for%20Ubuntu6.0-EXE.zip

Connecting a second external monitor

In order to add a second external monitor you can add the following to your configuration:

services.xserver.displayManager.sessionCommands = ''
    ${lib.getBin pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 2 0
'';

Sway

Identify which card has the render device, evdi is the DisplayLink interface, so it's not card0, but card1.

$ ls -l /dev/dri/by-path
lrwxrwxrwx - root  2 Nov 13:38 pci-0000:00:02.0-card -> ../card1
lrwxrwxrwx - root  2 Nov 13:38 pci-0000:00:02.0-render -> ../renderD128
lrwxrwxrwx - root  2 Nov 13:38 platform-evdi.0-card -> ../card0
environment.variables = {    
  WLR_EVDI_RENDER_DEVICE = "/dev/dri/card1";                                                                                                   
};
nixpkgs.overlays = [
  (final: prev: {    
    wlroots_0_17 = prev.wlroots_0_17.overrideAttrs (old: { # you may need to use 0_18
      patches = (old.patches or [ ]) ++ [
        (prev.fetchpatch {
          url = "https://gitlab.freedesktop.org/wlroots/wlroots/uploads/bd115aa120d20f2c99084951589abf9c/DisplayLink_v2.patch";
              hash = "sha256-vWQc2e8a5/YZaaHe+BxfAR/Ni8HOs2sPJ8Nt9pfxqiE=";
            })       
          ];
        });
      })
];
services.xserver.videoDrivers = [ "displaylink" ];
systemd.services.dlm.wantedBy = [ "multi-user.target" ];

Note as of 2014-10-30 nixos-unstable sway uses wlroots_0_18. The patch above applies correctly but you will need to invoke sway with the --unsupported-gpu flag.

Source