/sys/class/drm/*/enabled reports "disabled" for enabled monitors

Dear support,

I am writing this from a laptop with a GTX1070 on driver 375.66. The internal panel is on eDP-1, while I have an external monitor connected on DP-1.

$ grep . /sys/class/drm/*/status
/sys/class/drm/card0-DP-1/status:connected
/sys/class/drm/card0-DP-2/status:disconnected
/sys/class/drm/card0-eDP-1/status:connected
/sys/class/drm/card0-HDMI-A-1/status:disconnected

Yet these connected monitors are reported as disabled by the nvidia driver:

$ grep . /sys/class/drm/*/enabled
/sys/class/drm/card0-DP-1/enabled:disabled
/sys/class/drm/card0-DP-2/enabled:disabled
/sys/class/drm/card0-eDP-1/enabled:disabled
/sys/class/drm/card0-HDMI-A-1/enabled:disabled

In fact these files always report “disabled”, no matter what monitors I connect/disconnect and what resolution I drive them at. This is not the case for nouveau (or intel on another laptop), where “enabled” or “disabled” are reported, reflecting the current monitor status.

The nasty consequence of this is that systemd suspends the laptop when I close the lid, because it concludes that no external monitors are connected.
nvidia-bug-report.log.gz (140 KB)

Does this also happen if you remove nvidia-drm.modeset=1 from kernel parameters?

Hi generix,

I wonder why you ask. Without that kernel parameter there are no connector nodes in /sys/class/drm at all:

$ ls -l /sys/class/drm/
total 0
lrwxrwxrwx 1 root root 0 Jun 29 11:06 card0 → …/…/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0
lrwxrwxrwx 1 root root 0 Jun 29 11:06 renderD128 → …/…/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/renderD128
-r–r–r-- 1 root root 4096 Jun 29 11:06 version

Cheers,

Wouter

PS: this does not solve my systemd problem. It still reports:

$ busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager Docked
b false

indicating that there are no external monitors connected.
nvidia-bug-report.log.gz (140 KB)

same here: gtx1080 HDMI output is connected to running TV:

/sys/class/drm # grep . */enabled
card0-DP-1/enabled:disabled
card0-DP-2/enabled:disabled
card0-DP-3/enabled:disabled
card0-HDMI-A-1/enabled:disabled

FWIW, one of the systemd authors believes this is a driver bug: Laptop suspends because external monitor reports "disabled" in /sys/class/drm/*/enabled · Issue #6148 · systemd/systemd · GitHub

Most definitely, it reports wrong information to userspace. I can’t test this on my laptop since nvidia_drm.modeset=1 hard hangs the machine without traces.

Looking at the code, this should likely be fixed in 381.22.

Dear generix,

At what code did you look?

You are mistaken.

Cheers,

Wouter
nvidia-bug-report.log.gz (135 KB)

Of course you will have to add nvidia-drm.modeset=1 back. I just wanted you to remove that to see which part of the nvidia-driver sets the connector state. So I looked at the glue code in nvidia-driver-381.22/kernel/nvidia-drm and it containes a helper function for setting the enabled state. I then looked at the 375.66 driver and it didn’t contain it.
Edit: that it’s there doesn’t mean that it’s flawlessly working. Disconnecting/connecting the display or changing modes should set it if there’s not another bug. Please try and report back.

Not sure what more you want me to try?

By “You are mistaken” I mean that I ran 381.22 with modeset=1 (through a modprobe.d conffile) and I still get

$ grep . /sys/class/drm/*/enabled
/sys/class/drm/card0-DP-1/enabled:disabled
/sys/class/drm/card0-DP-2/enabled:disabled
/sys/class/drm/card0-eDP-1/enabled:disabled
/sys/class/drm/card0-HDMI-A-1/enabled:disabled

as before.

Ok, sorry, missed that. To get a bit more information, you could add drm.debug=0x10 to kernel cmdline. This should turn on drm atomic modesetting debug messages. On changes (setting modes/connect/disconnect) a line “Set [MODE:] for CRTC state” should show up. Though by digging further into this, it seems like this function is only ever called on shutdown showing “Set [NOMODE] for CRTC state”. So not so very helpful helper function.

Okay, attached is what I get.

most prominent lines seem to be:

[ 5.265991] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] Updating routing for [CONNECTOR:40:HDMI-A-1]
[ 5.265993] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] Disabling [CONNECTOR:40:HDMI-A-1]
[ 5.265996] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] Updating routing for [CONNECTOR:42:eDP-1]
[ 5.265997] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] Disabling [CONNECTOR:42:eDP-1]
[ 5.265999] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] Updating routing for [CONNECTOR:44:DP-1]
[ 5.266001] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] Disabling [CONNECTOR:44:DP-1]
[ 5.266003] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] Updating routing for [CONNECTOR:47:DP-2]
[ 5.266004] [drm:drm_atomic_helper_check_modeset [drm_kms_helper]] Disabling [CONNECTOR:47:DP-2]

where all four inputs get disabled.

What next?

log.txt (14.8 KB)
nvidia-bug-report.log.gz (140 KB)

As I feared, the function to set the enabled state currently is only called on disable. So what next? Wait for a Nvidia dev to stroll by and wire up the rest. I think you have done enough for now. Just keep an eye on
[url]Current graphics driver releases - Linux - NVIDIA Developer Forums
for new drivers releases.

Dear support,

Just so this is not deemed solved, I tried 384.59 today and the issue persists.

Cheers,

Wouter

Just saw that and can confirm that this is still broken on 387.12

Still not fixed in 390.48.

This bug seriously impacts notebook users with external monitors on Linux distributions that use system logind (almost all of them nowadays…).

The problem is that systemd-logind decides if a notebook is docked (and will therefore not got to spleep when the lid is closed) by locking at the attached extenal monitors. It counts a monitor only as attached if /sys/class/drm//enabled reads “enabled” and /sys/class/drm//status is connected.

With 390.48 the status is reported correctly, but enabled is not.

Tested on Ubuntu 18.04 with 390.48-0ubuntu0~gpu18.04.1.

Regards
Andreas

Still broken with 396.18: the “enabled” property reads “disabled” on all connectors, even ones with a running screen attached.

I have the same problem on Ubuntu 18.04, Driver Version: 390.48.

Still present on 410.57.

There’s more: apparently kernel-drm-driver and X-driver have different ideas about connectors:

X says screen is connected to DP-4, while kernel-drm seems to think it’s hooked up to DP-3.
Also, kernel-drm doesn’t know about all the DP-x the X driver seems to know:

# xrandr -q
Screen 0: minimum 8 x 8, current 3440 x 1440, maximum 32767 x 32767
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 connected primary 3440x1440+0+0 (normal left inverted right x axis y axis) 800mm x 335mm
   3440x1440     59.97*+  49.99    29.99  
   2560x1080     60.00    59.94    50.00  
   1920x1080     60.00    59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1280x1024     60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      59.96  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       59.94    59.93  
DP-5 disconnected (normal left inverted right x axis y axis)
/sys/class/drm/card2 # grep . card2-*/{status,enabled,modes} | sort
card2-DP-1/enabled:disabled
card2-DP-1/status:disconnected
card2-DP-2/enabled:disabled
card2-DP-2/status:disconnected
card2-DP-3/enabled:disabled
card2-DP-3/modes:1024x768
card2-DP-3/modes:1152x864
card2-DP-3/modes:1280x1024
card2-DP-3/modes:1280x720
card2-DP-3/modes:1280x720
card2-DP-3/modes:1280x720
card2-DP-3/modes:1280x800
card2-DP-3/modes:1600x900
card2-DP-3/modes:1680x1050
card2-DP-3/modes:1920x1080
card2-DP-3/modes:1920x1080
card2-DP-3/modes:1920x1080
card2-DP-3/modes:2560x1080
card2-DP-3/modes:2560x1080
card2-DP-3/modes:2560x1080
card2-DP-3/modes:3440x1440
card2-DP-3/modes:3440x1440
card2-DP-3/modes:3440x1440
card2-DP-3/modes:640x480
card2-DP-3/modes:640x480
card2-DP-3/modes:720x480
card2-DP-3/modes:720x576
card2-DP-3/modes:800x600
card2-DP-3/status:connected
card2-HDMI-A-1/enabled:disabled
card2-HDMI-A-1/status:disconnected

EDIT: [url]https://devtalk.nvidia.com/default/topic/1042579/linux/warning-gpu-0-unable-to-read-edid-for-display-device-vga-0/[/url]