Second screen not working with amd gpu

Hello everyone,

in first i want to apologize for my english, it isn’t my natural language.

I’m in nixOs since 2 month yet, swaping from arch linux. I have learn a lot, but i still can’t make my second computer work.

I have follow this guide without any success.

At 2 moment without changing anything, the second screen just start to work then stop.

Here is the relevant part of my config :

service.xserver.videoDrivers = ["amdgpu"]
boot = {
    kernelPackages = pkgs.linuxPackages_latest;

    initrd.kernelModules = ["amdgpu"];

    kernelParams = with host; [

   hardware = {
    pulseaudio.enable = true;
    opengl = {
      enable = true;
      extraPackages = with pkgs; [
      driSupport = true;
      #package = unstable.mesa.drivers;
      driSupport32Bit = true;
      #package32 = unstable.pkgsi686Linux.mesa.drivers;

The output of the command head /sys/class/drm/*/status :

==> /sys/class/drm/card0-DP-1/status <==

==> /sys/class/drm/card0-HDMI-A-1/status <==

The output of lscpi :

07:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Picasso/Raven 2 [Radeon Vega Series / Radeon Vega Mobile Series] (rev cc) (prog-if 00 [VGA controller])
        Subsystem: ASUSTeK Computer Inc. Device 876b
        Flags: bus master, fast devsel, latency 0, IRQ 37, IOMMU group 8
        Memory at e0000000 (64-bit, prefetchable) [size=256M]
        Memory at f0000000 (64-bit, prefetchable) [size=2M]
        I/O ports at f000 [size=256]
        Memory at fcb00000 (32-bit, non-prefetchable) [size=512K]
        Expansion ROM at 000c0000 [virtual] [disabled] [size=128K]
        Capabilities: <access denied>
        Kernel driver in use: amdgpu
        Kernel modules: amdgpu

I also have try wayland without success. Help would be welcome i don’t know what to try next.

I am on Wayland and had a similar issue, my 2nd monitor was not working at all.

I opened up a terminal and simply issued the following:

xrandr \
--output DP-1 --auto --crtc 0 \
--output HDMI-1 --auto --crtc 1 --right-of DP-1

And since that time it works all the time. Doesn’t mean it will work for you, but it’s super easy to try.
In your situation, you have to adapt DP and HDMI and make sure of the crtc numbers. Unfortunately, I forgot how I got that info. :frowning:

Unfortunatly xrandr dont found hdmi-1 at all :

xrandr -q                      
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
DP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 600mm x 340mm
   1920x1080     59.96*+
   1440x1080     59.99  
   1400x1050     59.98  
   1280x1024     59.89  
   1280x960      59.94  
   1152x864      59.96  
   1024x768      59.92  
   800x600       59.86  
   640x480       59.38  
   320x240       59.52  
   1680x1050     59.95  
   1440x900      59.89  
   1280x800      59.81  
   1152x720      59.97  
   960x600       59.63  
   928x580       59.88  
   800x500       59.50  
   768x480       59.90  
   720x480       59.71  
   640x400       59.95  
   320x200       58.96  
   1600x900      59.95  
   1368x768      59.88  
   1280x720      59.86  
   1024x576      59.90  
   864x486       59.92  
   720x400       59.55  
   640x350       59.77