Even if that's an old post I would like to add how I solved a very similar problem, because this post shows up in google search.
I had also run nvidia-xconfig
but it didn't solved the problem. The problem was, that metamodes where used and this didn't worked properly in a dual monitor setup.
By reviewing /var/log/Xorg.0.log
I noticed that the displays where reconnecting all the time and an EDID error was also in place.
These steps fixed my problem:
cd /etc/X11
sudo cp xorg.conf xorg.conf.bak
sudo rm xorg.conf
sudo nvidia-xconfig
Something like this was produced (notice that only one screen and monitor is used):
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DFP-3"
Option "metamodes" "HDMI-0: 1920x1080 +1920+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, DP-1: 1920x1080 +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
Now I "merged" the produced xorg.conf to use multiple Screen and Monitor sections, where I used the Options from the nvidia produced xorg.conf file.
This was my resulting xorg.conf file:
Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "Monitor"
Identifier "Monitor0"
ModelName "Samsung C27F390"
Option "UseEdidDpi" "FALSE"
HorizSync 30.0 - 81.0
VertRefresh 50.0 - 72.0
EndSection
Section "Monitor"
Identifier "Monitor1"
ModelName "Unknown"
Option "UseEdidDpi" "FALSE"
HorizSync 30.0 - 81.0
VertRefresh 50.0 - 72.0
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
VendorName "NVIDIA Corporation"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Device0"
Monitor "Monitor1"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
EndSection
I also disabled edid (even if a custom edid may also work, see: how to set custom edid on nvidia gpu
And set the second monitor to unknown.
Please adjust model name and any other parameters based on your auto generated xorg.conf.
I hope this will help if someone faces a similar problem, since I searched quite long to find a solution.