1 # Customizing display configuration {#module-hardware-display}
3 This section describes how to customize display configuration using:
7 Example situations it can help you with:
8 - display controllers (external hardware) not advertising EDID at all,
9 - misbehaving graphics drivers,
10 - loading custom display configuration before the Display Manager is running,
12 ## Forcing display modes {#module-hardware-display-modes}
14 In case of very wrong monitor controller and/or video driver combination you can
15 [force the display to be enabled](https://mjmwired.net/kernel/Documentation/fb/modedb.txt#41)
16 and skip some driver-side checks by adding `video=<OUTPUT>:e` to `boot.kernelParams`.
17 This is exactly the case with [`amdgpu` drivers](https://gitlab.freedesktop.org/drm/amd/-/issues/615#note_1987392)
21 # force enabled output to skip `amdgpu` checks
22 hardware.display.outputs."DP-1".mode = "e";
23 # completely disable output no matter what is connected to it
24 hardware.display.outputs."VGA-2".mode = "d";
27 boot.kernelParams = [ "video=DP-1:e" "video=VGA-2:d" ];
32 ## Crafting custom EDID files {#module-hardware-display-edid-custom}
34 To make custom EDID binaries discoverable you should first create a derivation storing them at
35 `$out/lib/firmware/edid/` and secondly add that derivation to `hardware.display.edid.packages` NixOS option:
39 hardware.display.edid.packages = [
40 (pkgs.runCommand "edid-custom" {} ''
41 mkdir -p $out/lib/firmware/edid
42 base64 -d > "$out/lib/firmware/edid/custom1.bin" <<'EOF'
43 <insert your base64 encoded EDID file here `base64 < /sys/class/drm/card0-.../edid`>
45 base64 -d > "$out/lib/firmware/edid/custom2.bin" <<'EOF'
46 <insert your base64 encoded EDID file here `base64 < /sys/class/drm/card1-.../edid`>
53 There are 2 options significantly easing preparation of EDID files:
54 - `hardware.display.edid.linuxhw`
55 - `hardware.display.edid.modelines`
57 ## Assigning EDID files to displays {#module-hardware-display-edid-assign}
59 To assign available custom EDID binaries to your monitor (video output) use `hardware.display.outputs."<NAME>".edid` option.
60 Under the hood it adds `drm.edid_firmware` entry to `boot.kernelParams` NixOS option for each configured output:
64 hardware.display.outputs."VGA-1".edid = "custom1.bin";
65 hardware.display.outputs."VGA-2".edid = "custom2.bin";
67 boot.kernelParams = [ "drm.edid_firmware=VGA-1:edid/custom1.bin,VGA-2:edid/custom2.bin" ];
72 ## Pulling files from linuxhw/EDID database {#module-hardware-display-edid-linuxhw}
74 `hardware.display.edid.linuxhw` utilizes `pkgs.linuxhw-edid-fetcher` to extract EDID files
75 from https://github.com/linuxhw/EDID based on simple string/regexp search identifying exact entries:
79 hardware.display.edid.linuxhw."PG278Q_2014" = [ "PG278Q" "2014" ];
82 hardware.display.edid.packages = [
83 (pkgs.linuxhw-edid-fetcher.override {
85 "PG278Q_2014" = [ "PG278Q" "2014" ];
94 ## Using XFree86 Modeline definitions {#module-hardware-display-edid-modelines}
96 `hardware.display.edid.modelines` utilizes `pkgs.edid-generator` package allowing you to
97 conveniently use [`XFree86 Modeline`](https://en.wikipedia.org/wiki/XFree86_Modeline) entries as EDID binaries:
101 hardware.display.edid.modelines."PG278Q_60" = " 241.50 2560 2608 2640 2720 1440 1443 1448 1481 -hsync +vsync";
102 hardware.display.edid.modelines."PG278Q_120" = " 497.75 2560 2608 2640 2720 1440 1443 1448 1525 +hsync -vsync";
105 hardware.display.edid.packages = [
106 (pkgs.edid-generator.overrideAttrs {
109 Modeline "PG278Q_60" 241.50 2560 2608 2640 2720 1440 1443 1448 1481 -hsync +vsync
110 Modeline "PG278Q_120" 497.75 2560 2608 2640 2720 1440 1443 1448 1525 +hsync -vsync
118 ## Complete example for Asus PG278Q {#module-hardware-display-pg278q}
120 And finally this is a complete working example for a 2014 (first) batch of [Asus PG278Q monitor with `amdgpu` drivers](https://gitlab.freedesktop.org/drm/amd/-/issues/615#note_1987392):
124 hardware.display.edid.modelines."PG278Q_60" = " 241.50 2560 2608 2640 2720 1440 1443 1448 1481 -hsync +vsync";
125 hardware.display.edid.modelines."PG278Q_120" = " 497.75 2560 2608 2640 2720 1440 1443 1448 1525 +hsync -vsync";
127 hardware.display.outputs."DP-1".edid = "PG278Q_60.bin";
128 hardware.display.outputs."DP-1".mode = "e";