NVIDIA GeForce GTX 970 does not show picture if monitor has been turned off for a longer period of time

I have a NVIDIA GeForce GTX 970 graphics card which was used in MSI H81M-P33 motherboard with Ubuntu 16.04 installation without issues. Now I switched to Supermicro X9DR3-F motherboard. Again, I’m running Ubuntu 16.04 as I need it for virtualizing one specific application. Now, when I turn off the monitor at night and back on in the morning, then the monitor detects that the DP is connected and the monitor turns on, but it simply shows the black screen until the monitor goes back to sleep after 10 - 15 seconds. Reinserting the DP cable does not help. Moving the mouse or using the keyboard does not help either. When I SSH to that machine and check the output of dmesg or log files in /var/log directory, then nothing is logged. Xorg(started with “-logverbose 6” option) server log file at $HOME/.local/share/xorg/Xorg.0.log sometimes contains the “(EE) NVIDIA(0): No enabled display devices found” error message:

$ grep -B 5 -A 5 -w EE $HOME/.local/share/xorg/Xorg.0.log
[   108.437] Current version of pixman: 0.33.6
[   108.439] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[   108.439] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[   108.444] (==) Log file: "/home/martin/.local/share/xorg/Xorg.0.log", Time: Thu Jan  2 15:15:57 2020
[   108.446] (==) Using config file: "/etc/X11/xorg.conf"
[   108.447] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[   108.448] (==) ServerLayout "Layout0"
[   108.448] (**) |-->Screen "Screen0" (0)
--
[ 18141.603] (WW) NVIDIA(0):     configuration; removing.
[ 18141.603] (WW) NVIDIA(0): MetaMode
[ 18141.603] (WW) NVIDIA(0):     "DP-0:nvidia-auto-select{ViewPortIn=1366x768,ViewPortOut=3840x2158+0+1}"
[ 18141.603] (WW) NVIDIA(0):     could not be re-validated against the current hardware
[ 18141.603] (WW) NVIDIA(0):     configuration; removing.
[ 18141.603] (EE) NVIDIA(0): No enabled display devices found
[ 18141.603] (WW) NVIDIA(0): No valid modes for "nvidia-auto-select"; removing.
[ 18141.603] (II) NVIDIA(0): NoScanout X screen configured with resolution 640x480
[ 18141.603] (II) NVIDIA(0):     (default)
[ 18146.998] (II) NVIDIA(0): Using HorizSync/VertRefresh ranges from the EDID for display
[ 18146.998] (II) NVIDIA(0):     device Samsung U28D590 (DFP-2).

…but not always, i.e I’m not sure that this is the root cause.

My first thought was that maybe it has to do something with the power management settings in UEFI as there was no such issue with the previous motherboard. However, the CPU Power Management Configuration and ACPI Settings were the only two power related settings I was able to find in UEFI.

The driver I’m using is the latest NVIDIA proprietary one:

$ modinfo nvidia
filename:       /lib/modules/4.4.0-170-generic/kernel/drivers/video/nvidia.ko
alias:          char-major-195-*
version:        440.44
supported:      external
license:        NVIDIA
srcversion:     76C1A18886D409B7BFE6518
alias:          pci:v000010DEd*sv*sd*bc03sc02i00*
alias:          pci:v000010DEd*sv*sd*bc03sc00i00*
depends:        ipmi_msghandler
retpoline:      Y
vermagic:       4.4.0-170-generic SMP mod_unload modversions 
parm:           NvSwitchRegDwords:NvSwitch regkey (charp)
parm:           NVreg_Mobile:int
parm:           NVreg_ResmanDebugLevel:int
parm:           NVreg_RmLogonRC:int
parm:           NVreg_ModifyDeviceFiles:int
parm:           NVreg_DeviceFileUID:int
parm:           NVreg_DeviceFileGID:int
parm:           NVreg_DeviceFileMode:int
parm:           NVreg_InitializeSystemMemoryAllocations:int
parm:           NVreg_UsePageAttributeTable:int
parm:           NVreg_MapRegistersEarly:int
parm:           NVreg_RegisterForACPIEvents:int
parm:           NVreg_EnablePCIeGen3:int
parm:           NVreg_EnableMSI:int
parm:           NVreg_TCEBypassMode:int
parm:           NVreg_EnableStreamMemOPs:int
parm:           NVreg_EnableBacklightHandler:int
parm:           NVreg_RestrictProfilingToAdminUsers:int
parm:           NVreg_PreserveVideoMemoryAllocations:int
parm:           NVreg_DynamicPowerManagement:int
parm:           NVreg_EnableUserNUMAManagement:int
parm:           NVreg_MemoryPoolSize:int
parm:           NVreg_KMallocHeapMaxSize:int
parm:           NVreg_VMallocHeapMaxSize:int
parm:           NVreg_IgnoreMMIOCheck:int
parm:           NVreg_NvLinkDisable:int
parm:           NVreg_RegisterPCIDriver:int
parm:           NVreg_RegistryDwords:charp
parm:           NVreg_RegistryDwordsPerDevice:charp
parm:           NVreg_RmMsg:charp
parm:           NVreg_GpuBlacklist:charp
parm:           NVreg_TemporaryFilePath:charp
parm:           NVreg_AssignGpus:charp
$ lsmod | grep nvidia
nvidia_drm             49152  3
nvidia_modeset       1110016  6 nvidia_drm
nvidia              20361216  278 nvidia_modeset
drm_kms_helper        155648  1 nvidia_drm
drm                   364544  6 drm_kms_helper,nvidia_drm
ipmi_msghandler        49152  4 ipmi_ssif,ipmi_devintf,nvidia,ipmi_si
$

Sometimes restarting the X server helps. However, sometimes it doesn’t and I’m forced to reboot the machine.

What might cause such behavior? How to troubleshoot this further?
nvidia-bug-report.log.gz (1.12 MB)