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)
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.
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.
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.
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.
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.
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)