Xrandr doesnt detect nvidia generated xorg screens

Hi everyone,

I need to use a shared facility computer under Ubuntu 18.04. It has 3 screens connected and is configured with Nvidia xerver (drivers 460.80) as one screen as desktop and the other 2 as a single metascreen.
My problem is that xrandr -q (xrandr version 1.5) reports only the desktop screen. Would you have any idea why?

Thank you in advance for your help, and below the xorg.conf file if that’s any help!

nvidia-settings: X configuration file generated by nvidia-settings

nvidia-settings: version 460.39

Section “ServerLayout”
Identifier “Layout0”
Screen 0 “Screen0” 0 0
Screen 1 “Screen1” 1920 0
InputDevice “Keyboard0” “CoreKeyboard”
InputDevice “Mouse0” “CorePointer”
Option “Xinerama” “0”
EndSection

Section “Files”
EndSection

Section “Module”
Load “dbe”
Load “extmod”
Load “type1”
Load “freetype”
Load “glx”
EndSection

Section “InputDevice”
# generated from default
Identifier “Mouse0”
Driver “mouse”
Option “Protocol” “auto”
Option “Device” “/dev/psaux”
Option “Emulate3Buttons” “no”
Option “ZAxisMapping” “4 5”
EndSection

Section “InputDevice”
# generated from default
Identifier “Keyboard0”
Driver “kbd”
EndSection

Section “Monitor”
# HorizSync source: edid, VertRefresh source: edid
Identifier “Monitor0”
VendorName “Unknown”
ModelName “Targa”
HorizSync 14.0 - 68.0
VertRefresh 48.0 - 62.0
Option “DPMS”
EndSection

Section “Monitor”
# HorizSync source: edid, VertRefresh source: edid
Identifier “Monitor1”
VendorName “Unknown”
ModelName “VPX PROPixx”
HorizSync 30.0 - 255.0
VertRefresh 55.0 - 255.0
Option “DPMS”
EndSection

Section “Device”
Identifier “Device0”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce GTX 1080 Ti”
BusID “PCI:1:0:0”
Screen 0
EndSection

Section “Device”
Identifier “Device1”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce GTX 1080 Ti”
BusID “PCI:1:0:0”
Screen 1
EndSection

Section “Screen”
Identifier “Screen0”
Device “Device0”
Monitor “Monitor0”
DefaultDepth 24
Option “Stereo” “0”
Option “metamodes” “HDMI-0: nvidia-auto-select +0+0”
Option “SLI” “Off”
Option “MultiGPU” “Off”
Option “BaseMosaic” “off”
SubSection “Display”
Depth 24
EndSubSection
EndSection

Section “Screen”
Identifier “Screen1”
Device “Device1”
Monitor “Monitor1”
DefaultDepth 24
Option “Stereo” “0”
Option “metamodes” “DVI-D-0: nvidia-auto-select +1920+0, DP-4: nvidia-auto-select +0+0”
Option “SLI” “Off”
Option “MultiGPU” “Off”
Option “BaseMosaic” “off”
SubSection “Display”
Depth 24
EndSubSection
EndSection

xrandr -q only queries one screen at a time (the default screen specified in $DISPLAY). You can make it query the other screen using xrandr -q --screen 1.

When I remove the xorg.conf and use xrandr -q I have all displays listed though.
My true problem I’m trying to find a solution for - is that some modules I am using in my code rely on the glfwGetMonitors function, and it returns only the one screen (it should return 2 according to the nvidia generated xconf: the main display and the metascreen). And that function of GLFW relies on xrandr.

So it definitely seems that xrandr doesn’t see all monitors with that configuration. Any other idea why would be welcome!! (I am very far from my knowledge zone here).

The driver will assign display devices to X screens based on how many there are when the server starts. So it’s expected for all display devices to appear on screen 0 when there is only one X screen, and for one or more of them to be assigned to screen 1 when there is a second screen present.

From a quick skim of the glfw source code, it looks like the list of monitors returned by glfwGetMonitors is populated by the function _glfwPollMonitorsX11. This function appears to only look at the monitors associated with the default X screen. So I would expect this function to return the same monitors as xrandr -q --screen 0 with DISPLAY=:0.0 and xrandr -q --screen 1 with DISPLAY=:0.1.

If you need to access display devices on two X screens at once, I don’t think glfw will work.

1 Like

Thank you very much! Not sure how I’ll make it work, but at least I understand what is going on.