Multi-screen configuration puts second monitor on first screen if not initially connected

On the Jetson Nano Dev Kit I am using an xorg.conf that puts the HDMI output on screen 0 and the DP output on screen 1:

# cat /etc/X11/xorg.conf
# Copyright (c) 2011-2015 NVIDIA CORPORATION.  All Rights Reserved.

#
# This is the minimal configuration necessary to use the Tegra driver.
# Please refer to the xorg.conf man page for more configuration
# options provided by the X server, including display-related options
# provided by RandR 1.2 and higher.

# Disable extensions not useful on Tegra.
Section "Module"
    Disable     "dri"
    SubSection  "extmod"
        Option  "omit xfree86-dga"
    EndSubSection
EndSection

Section "Device"
    Identifier  "Device0"
    Driver      "nvidia"
    Screen      0
    Option      "UseDisplayDevice" "HDMI-0"
    Option      "AllowEmptyInitialConfiguration" "true"
    Option      "AddARGBGLXVisuals" "true"
    Option      "ConnectToAcpid" "false"
    Option      "TegraReserveDisplayBandwidth" "false"
EndSection

Section "Device"
    Identifier  "Device1"
    Driver      "nvidia"
    Screen      1
    Option      "UseDisplayDevice" "DP-0"
    Option      "AllowEmptyInitialConfiguration" "true"
    Option      "AddARGBGLXVisuals" "true"
    Option      "ConnectToAcpid" "false"
    Option      "TegraReserveDisplayBandwidth" "false"
EndSection

Section "Monitor"
    Identifier   "Monitor0"
    HorizSync    18.0 - 99.0
    VertRefresh  23.0 - 62.0
EndSection

Section "Screen"
    Identifier   "Screen0"
    Device       "Device0"
    Monitor      "Monitor0"
EndSection

Section "Monitor"
    Identifier   "Monitor1"
    HorizSync    18.0 - 99.0
    VertRefresh  23.0 - 62.0
EndSection

Section "Screen"
    Identifier   "Screen1"
    Device       "Device1"
    Monitor      "Monitor1"
EndSection

Section "ServerLayout"
    Identifier   "ServerLayout0"
    Screen       0 "Screen0" 0 0
    Screen       1 "Screen1" 0 0
    Option       "Xinerama" "0"
EndSection

This works fine if both monitors are connected when booted.

# DISPLAY=:0.0 xrandr
Screen 0: minimum 8 x 8, current 4096 x 2160, maximum 16384 x 16384
HDMI-0 connected primary 4096x2160+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1920x1080     60.00 +  59.95    50.00    30.00    29.97    25.00    24.00    23.98  
   4096x2160     60.02    59.98    50.01    30.00*   29.97    25.00    24.00    23.98  
   3840x2160     60.02    59.98    50.01    30.00    29.97    25.00    24.00    23.98  
   1680x1050     59.96  
   1600x1200     60.01  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     60.00  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1024x768      60.01  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       59.94    59.94
# DISPLAY=:0.1 xrandr
Screen 1: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
DP-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 480mm x 270mm
   1920x1080     60.00*+
   1600x900      60.00  
   1280x1024     75.03    60.00  
   1152x864      75.00  
   1024x768      75.03    60.01  
   800x600       75.00    60.32  
   720x400       70.04  
   640x480       75.00    59.94  

Disconnecting either monitor at this point works as expected.
Disconnecting just the DP monitor gives:

# DISPLAY=:0.0 xrandr
Screen 0: minimum 8 x 8, current 4096 x 2160, maximum 16384 x 16384
HDMI-0 connected primary 4096x2160+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1920x1080     60.00 +  59.95    50.00    30.00    29.97    25.00    24.00    23.98  
   4096x2160     60.02    59.98    50.01    30.00*   29.97    25.00    24.00    23.98  
   3840x2160     60.02    59.98    50.01    30.00    29.97    25.00    24.00    23.98  
   1680x1050     59.96  
   1600x1200     60.01  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     60.00  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1024x768      60.01  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       59.94    59.94  
# DISPLAY=:0.1 xrandr
Screen 1: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
DP-0 disconnected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
  1920x1080 (0x18c) 148.500MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz

Disconnecting just the HDMI monitor gives:

# DISPLAY=:0.0 xrandr
Screen 0: minimum 8 x 8, current 4096 x 2160, maximum 16384 x 16384
HDMI-0 disconnected primary 4096x2160+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
  4096x2160 (0x190) 297.000MHz +HSync +VSync
        h: width  4096 start 4184 end 4272 total 4400 skew    0 clock  67.50KHz
        v: height 2160 start 2168 end 2178 total 2250           clock  30.00Hz
# DISPLAY=:0.1 xrandr
Screen 1: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
DP-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 480mm x 270mm
   1920x1080     60.00*+
   1600x900      60.00  
   1280x1024     75.03    60.00  
   1152x864      75.00  
   1024x768      75.03    60.01  
   800x600       75.00    60.32  
   720x400       70.04  
   640x480       75.00    59.94  

If the HDMI monitor is connected at boot but the DP is not I get both the HDMI and the DP monitor on screen 0 which is not correct:

# DISPLAY=:0.0 xrandr
Screen 0: minimum 8 x 8, current 4096 x 2160, maximum 16384 x 16384
HDMI-0 connected primary 4096x2160+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1920x1080     60.00 +  59.95    50.00    30.00    29.97    25.00    24.00    23.98  
   4096x2160     60.02    59.98    50.01    30.00*   29.97    25.00    24.00    23.98  
   3840x2160     60.02    59.98    50.01    30.00    29.97    25.00    24.00    23.98  
   1680x1050     59.96  
   1600x1200     60.01  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     60.00  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1024x768      60.01  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       59.94    59.94  
DP-0 disconnected (normal left inverted right x axis y axis)
# DISPLAY=:0.1 xrandr
Can't open display :0.1

The /var/log/Xorg.0.log contains:

# cat /var/log/Xorg.0.log
[2103467.122] 
X.Org X Server 1.18.4
Release Date: 2016-07-19
[2103467.122] X Protocol Version 11, Revision 0
[2103467.122] Build Operating System: Linux 4.15.0-109-generic x86_64 
[2103467.123] Current Operating System: Linux ShareLink-Pro-Jetson-Nano-DK-E6-CC-A7 4.9.140 #1.05.0000-b013-dev SMP PREEMPT Wed Jul 22 09:14:14 EDT 2020 aarch64
[2103467.123] Kernel command line: tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,2 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1075 core_edp_ma=4000 tegra_fbmem=0x800000@0x92cb4000 is_hdmi_initialised=1 ip=192.168.0.226:192.168.0.220:192.168.0.1:255.255.0.0::eth0:off nfsroot=192.168.0.220:/tftpboot/nano_rootfs,nfsvers=3 root=/dev/nfs rw netdevwait net.ifnames=0
[2103467.123] Build Date: 22 July 2020  08:17:56AM
[2103467.123]  
[2103467.123] Current version of pixman: 0.38.4
[2103467.123]   Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
[2103467.123] Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[2103467.124] (==) Log file: "/var/log/Xorg.0.log", Time: Thu Jul 23 20:32:13 2020
[2103467.127] (==) Using config file: "/etc/X11/xorg.conf"
[2103467.127] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[2103467.127] (==) ServerLayout "ServerLayout0"
[2103467.127] (**) |-->Screen "Screen0" (0)
[2103467.127] (**) |   |-->Monitor "Monitor0"
[2103467.127] (**) |   |-->Device "Device0"
[2103467.127] (**) |-->Screen "Screen1" (1)
[2103467.127] (**) |   |-->Monitor "Monitor1"
[2103467.127] (**) |   |-->Device "Device1"
[2103467.128] (**) Option "Xinerama" "0"
[2103467.128] (==) Automatically adding devices
[2103467.128] (==) Automatically enabling devices
[2103467.128] (==) Automatically adding GPU devices
[2103467.128] (==) Max clients allowed: 256, resource mask: 0x1fffff
[2103467.128] (WW) The directory "/usr/share/fonts/X11//TTF/" does not exist.
[2103467.128]   Entry deleted from font path.
[2103467.128] (WW) The directory "/usr/share/fonts/X11//OTF/" does not exist.
[2103467.128]   Entry deleted from font path.
[2103467.129] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/X11//100dpi/".
[2103467.129]   Entry deleted from font path.
[2103467.129]   (Run 'mkfontdir' on "/usr/share/fonts/X11//100dpi/").
[2103467.130] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/X11//75dpi/".
[2103467.130]   Entry deleted from font path.
[2103467.130]   (Run 'mkfontdir' on "/usr/share/fonts/X11//75dpi/").
[2103467.130] (==) FontPath set to:
        /usr/share/fonts/X11//misc/,
        /usr/share/fonts/X11//Type1/
[2103467.130] (==) ModulePath set to "/usr/lib/xorg/modules"
[2103467.130] (II) The server relies on udev to provide the list of input devices.
        If no devices become available, reconfigure udev or disable AutoAddDevices.
[2103467.130] (II) Loader magic: 0x5ceab8
[2103467.130] (II) Module ABI versions:
[2103467.130]   X.Org ANSI C Emulation: 0.4
[2103467.130]   X.Org Video Driver: 20.0
[2103467.130]   X.Org XInput driver : 22.1
[2103467.130]   X.Org Server Extension : 9.0
[2103467.131] (II) no primary bus or device found
[2103467.131] (WW) "dri" will not be loaded unless you've specified it to be loaded elsewhere.
[2103467.131] (II) LoadModule: "extmod"
[2103467.131] (II) Module "extmod" already built-in
[2103467.131] (II) LoadModule: "nvidia"
[2103467.134] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[2103467.137] (II) Module nvidia: vendor="NVIDIA Corporation"
[2103467.137]   compiled for 4.0.2, module version = 1.0.0
[2103467.137]   Module class: X.Org Video Driver
[2103467.137] (II) NVIDIA dlloader X Driver  32.4.2  Release Build  (integ_stage_rel)  (buildbrain@mobile-u64-4164)  Wed Apr  8 18:12:28 PDT 2020
[2103467.137] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[2103467.139] (--) using VT number 2

[2103467.149] (WW) Falling back to old probe method for NVIDIA
[2103467.149] (II) Loading sub module "fb"
[2103467.149] (II) LoadModule: "fb"
[2103467.150] (II) Loading /usr/lib/xorg/modules/libfb.so
[2103467.152] (II) Module fb: vendor="X.Org Foundation"
[2103467.152]   compiled for 1.18.4, module version = 1.0.0
[2103467.152]   ABI class: X.Org ANSI C Emulation, version 0.4
[2103467.152] (II) Loading sub module "wfb"
[2103467.152] (II) LoadModule: "wfb"
[2103467.153] (II) Loading /usr/lib/xorg/modules/libwfb.so
[2103467.154] (II) Module wfb: vendor="X.Org Foundation"
[2103467.154]   compiled for 1.18.4, module version = 1.0.0
[2103467.154]   ABI class: X.Org ANSI C Emulation, version 0.4
[2103467.155] (II) Loading sub module "ramdac"
[2103467.155] (II) LoadModule: "ramdac"
[2103467.155] (II) Module "ramdac" already built-in
[2103467.156] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[2103467.156] (II) NVIDIA(0): Creating default Display subsection in Screen section
        "Screen0" for depth/fbbpp 24/32
[2103467.156] (==) NVIDIA(0): Depth 24, (==) framebuffer bpp 32
[2103467.156] (==) NVIDIA(0): RGB weight 888
[2103467.156] (==) NVIDIA(0): Default visual is TrueColor
[2103467.156] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
[2103467.156] (**) NVIDIA(0): Option "AddARGBGLXVisuals" "true"
[2103467.156] (**) NVIDIA(0): Option "ConnectToAcpid" "false"
[2103467.156] (**) NVIDIA(0): Option "AllowEmptyInitialConfiguration" "true"
[2103467.156] (**) NVIDIA(0): Option "UseDisplayDevice" "HDMI-0"
[2103467.156] (**) NVIDIA(0): Option "TegraReserveDisplayBandwidth" "false"
[2103467.156] (II) NVIDIA(1): Creating default Display subsection in Screen section
        "Screen1" for depth/fbbpp 24/32
[2103467.156] (**) NVIDIA(1): Option "UseDisplayDevice" "DP-0"
[2103467.156] (**) NVIDIA(1): Option "TegraReserveDisplayBandwidth" "false"
[2103467.156] (**) NVIDIA(0): Enabling 2D acceleration
[2103467.156] (II) Loading sub module "glxserver_nvidia"
[2103467.156] (II) LoadModule: "glxserver_nvidia"
[2103467.159] (II) Loading /usr/lib/xorg/modules/extensions/libglxserver_nvidia.so
[2103467.167] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[2103467.167]   compiled for 4.0.2, module version = 1.0.0
[2103467.167]   Module class: X.Org Server Extension
[2103467.167] (II) NVIDIA GLX Module  32.4.2  Release Build  (integ_stage_rel)  (buildbrain@mobile-u64-4164)  Wed Apr  8 18:10:45 PDT 2020
[2103467.169] (--) NVIDIA(0): Valid display device(s) on GPU-0 at SoC
[2103467.169] (--) NVIDIA(0):     DFP-0
[2103467.169] (--) NVIDIA(0):     DFP-1
[2103467.169] (II) NVIDIA(0): NVIDIA GPU NVIDIA Tegra X1 (nvgpu) (GM20B) at SoC (GPU-0)
[2103467.169] (--) NVIDIA(0): Memory: 4051152 kBytes
[2103467.169] (--) NVIDIA(0): VideoBIOS: 
[2103467.169] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): connected
[2103467.169] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): External TMDS
[2103467.170] (==) NVIDIA(0): 
[2103467.170] (==) NVIDIA(0): No modes were requested; the default mode "nvidia-auto-select"
[2103467.170] (==) NVIDIA(0):     will be used as the requested mode.
[2103467.170] (==) NVIDIA(0): 
[2103467.170] (II) NVIDIA(0): Validated MetaModes:
[2103467.170] (II) NVIDIA(0):     "DFP-0:nvidia-auto-select"
[2103467.170] (II) NVIDIA(0): Virtual screen size determined to be 1920 x 1080
[2103467.173] (WW) NVIDIA(0): EXN ExtronScalerD (DFP-0) does not have an EDID, or its EDID
[2103467.173] (WW) NVIDIA(0):     does not contain a maximum image size; cannot compute DPI
[2103467.173] (WW) NVIDIA(0):     from EXN ExtronScalerD (DFP-0)'s EDID.
[2103467.173] (==) NVIDIA(0): DPI set to (75, 75); computed from built-in default
[2103467.173] (**) NVIDIA(0): Enabling 32-bit ARGB GLX visuals.
[2103467.173] (==) NVIDIA(1): Depth 24, (==) framebuffer bpp 32
[2103467.173] (==) NVIDIA(1): RGB weight 888
[2103467.173] (==) NVIDIA(1): Default visual is TrueColor
[2103467.173] (==) NVIDIA(1): Using gamma correction (1.0, 1.0, 1.0)
[2103467.173] (**) NVIDIA(1): Option "AddARGBGLXVisuals" "true"
[2103467.173] (**) NVIDIA(1): Option "ConnectToAcpid" "false"
[2103467.173] (**) NVIDIA(1): Option "AllowEmptyInitialConfiguration" "true"
[2103467.173] (II) NVIDIA(1): NVIDIA GPU NVIDIA Tegra X1 (nvgpu) (GM20B) at SoC (GPU-0)
[2103467.173] (--) NVIDIA(1): Memory: 4051152 kBytes
[2103467.173] (--) NVIDIA(1): VideoBIOS: 
[2103467.173] (EE) NVIDIA(1): Failed to assign any heads to X screen 1
[2103467.173] (EE) NVIDIA(1): Failing initialization of X screen 1
[2103467.173] (II) UnloadModule: "nvidia"
[2103467.173] (II) UnloadSubModule: "wfb"
[2103467.173] (II) UnloadSubModule: "fb"
[2103467.173] (--) Depth 24 pixmap format is 32 bpp
[2103467.174] (II) NVIDIA: Reserving 6144.00 MB of virtual memory for indirect memory
[2103467.174] (II) NVIDIA:     access.
[2103467.175] (EE) NVIDIA(0): Failed to allocate NVIDIA Error Handler
[2103467.229] (II) NVIDIA(0): Setting mode "DFP-0:nvidia-auto-select"
[2103467.343] (==) NVIDIA(0): Disabling shared memory pixmaps
[2103467.343] (==) NVIDIA(0): Backing store enabled
[2103467.343] (==) NVIDIA(0): Silken mouse enabled
[2103467.345] (==) NVIDIA(0): DPMS enabled
[2103467.346] (II) Loading sub module "dri2"
[2103467.346] (II) LoadModule: "dri2"
[2103467.346] (II) Module "dri2" already built-in
[2103467.346] (II) NVIDIA(0): [DRI2] Setup complete
[2103467.346] (II) NVIDIA(0): [DRI2]   VDPAU driver: nvidia
[2103467.363] (--) RandR disabled
[2103467.363] (II) Initializing extension GLX
[2103467.364] (II) Indirect GLX disabled.
[2103467.472] (II) config/udev: Adding input device tegra-hda HDMI/DP,pcm=3 (/dev/input/event0)
[2103467.472] (II) No input driver specified, ignoring this device.
[2103467.472] (II) This device may have been added with another device file.
[2103467.473] (II) config/udev: Adding input device DELL DELL USB Keyboard (/dev/input/event2)
[2103467.473] (**) DELL DELL USB Keyboard: Applying InputClass "evdev keyboard catchall"
[2103467.473] (II) LoadModule: "evdev"
[2103467.475] (II) Loading /usr/lib/xorg/modules/input/evdev_drv.so
[2103467.478] (II) Module evdev: vendor="X.Org Foundation"
[2103467.478]   compiled for 1.18.4, module version = 2.10.6
[2103467.478]   Module class: X.Org XInput Driver
[2103467.478]   ABI class: X.Org XInput driver, version 22.1
[2103467.478] (II) Using input driver 'evdev' for 'DELL DELL USB Keyboard'
[2103467.479] (**) DELL DELL USB Keyboard: always reports core events
[2103467.479] (**) evdev: DELL DELL USB Keyboard: Device: "/dev/input/event2"
[2103467.479] (--) evdev: DELL DELL USB Keyboard: Vendor 0x413c Product 0x2005
[2103467.479] (--) evdev: DELL DELL USB Keyboard: Found keys
[2103467.479] (II) evdev: DELL DELL USB Keyboard: Configuring as keyboard
[2103467.479] (**) Option "config_info" "udev:/sys/devices/70090000.xusb/usb1/1-2/1-2.1/1-2.1:1.0/0003:413C:2005.0001/input/input2/event2"
[2103467.479] (II) XINPUT: Adding extended input device "DELL DELL USB Keyboard" (type: KEYBOARD, id 6)
[2103467.479] (**) Option "xkb_rules" "evdev"
[2103467.481] (II) config/udev: Adding input device HID 413c:3010 (/dev/input/event3)
[2103467.481] (**) HID 413c:3010: Applying InputClass "evdev pointer catchall"
[2103467.481] (II) Using input driver 'evdev' for 'HID 413c:3010'
[2103467.481] (**) HID 413c:3010: always reports core events
[2103467.481] (**) evdev: HID 413c:3010: Device: "/dev/input/event3"
[2103467.539] (--) evdev: HID 413c:3010: Vendor 0x413c Product 0x3010
[2103467.539] (--) evdev: HID 413c:3010: Found 3 mouse buttons
[2103467.539] (--) evdev: HID 413c:3010: Found scroll wheel(s)
[2103467.539] (--) evdev: HID 413c:3010: Found relative axes
[2103467.539] (--) evdev: HID 413c:3010: Found x and y relative axes
[2103467.539] (II) evdev: HID 413c:3010: Configuring as mouse
[2103467.539] (II) evdev: HID 413c:3010: Adding scrollwheel support
[2103467.539] (**) evdev: HID 413c:3010: YAxisMapping: buttons 4 and 5
[2103467.539] (**) evdev: HID 413c:3010: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[2103467.539] (**) Option "config_info" "udev:/sys/devices/70090000.xusb/usb1/1-2/1-2.3/1-2.3:1.0/0003:413C:3010.0002/input/input3/event3"
[2103467.539] (II) XINPUT: Adding extended input device "HID 413c:3010" (type: MOUSE, id 7)
[2103467.539] (II) evdev: HID 413c:3010: initialized for relative axes.
[2103467.540] (**) HID 413c:3010: (accel) keeping acceleration scheme 1
[2103467.540] (**) HID 413c:3010: (accel) acceleration profile 0
[2103467.540] (**) HID 413c:3010: (accel) acceleration factor: 2.000
[2103467.540] (**) HID 413c:3010: (accel) acceleration threshold: 4
[2103467.541] (II) config/udev: Adding input device HID 413c:3010 (/dev/input/mouse0)
[2103467.541] (II) No input driver specified, ignoring this device.
[2103467.541] (II) This device may have been added with another device file.
[2103467.542] (II) config/udev: Adding input device gpio-keys (/dev/input/event1)
[2103467.542] (**) gpio-keys: Applying InputClass "evdev keyboard catchall"
[2103467.542] (II) Using input driver 'evdev' for 'gpio-keys'
[2103467.542] (**) gpio-keys: always reports core events
[2103467.542] (**) evdev: gpio-keys: Device: "/dev/input/event1"
[2103467.542] (--) evdev: gpio-keys: Vendor 0x1 Product 0x1
[2103467.542] (--) evdev: gpio-keys: Found keys
[2103467.542] (II) evdev: gpio-keys: Configuring as keyboard
[2103467.542] (**) Option "config_info" "udev:/sys/devices/gpio-keys/input/input1/event1"
[2103467.542] (II) XINPUT: Adding extended input device "gpio-keys" (type: KEYBOARD, id 8)
[2103467.542] (**) Option "xkb_rules" "evdev"
[2103467.978] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): connected
[2103467.978] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): External TMDS
[2103467.999] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): connected
[2103467.999] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): External TMDS
[2103469.098] (II) NVIDIA(0): Setting mode "HDMI-0: 4096x2160_30 @4096x2160 +0+0 {ViewPortIn=4096x2160, ViewPortOut=4096x2160+0+0}"
[2103469.359] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): connected
[2103469.359] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): External TMDS
[2103470.404] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): connected
[2103470.404] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): External TMDS
[2103470.487] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): connected
[2103470.487] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): External TMDS
[2103470.612] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): connected
[2103470.612] (--) NVIDIA(GPU-0): EXN ExtronScalerD (DFP-0): External TMDS

The key lines being:

[2103467.173] (EE) NVIDIA(1): Failed to assign any heads to X screen 1
[2103467.173] (EE) NVIDIA(1): Failing initialization of X screen 1

Hi,

I don’t think this will be supported. The case you are trying to do is different.

When nothing is plugged, the kernel does not know it will be a DP monitor and it will not trigger anything in Xorg driver either.

I thought that was what the AllowEmptyInitialConfiguration option was for. It seems to work ok for the HDMI output but not the DP.

Hi,

What if you connect nothing and run the xrandr?

I also get the DP on screen 0 instead of screen 1 with the same 'Failed to assign any heads to X screen 1" in the log.

# DISPLAY=:0.0 xrandr
Screen 0: minimum 8 x 8, current 640 x 480, maximum 16384 x 16384
HDMI-0 disconnected primary (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
# DISPLAY=:0.1 xrandr
Can't open display :0.1

Has any progress been made on this issue? I’ve been waiting almost a month.

Hi,

Sorry that we don’t have any progress here.

May I know why do you want to set up this through Xorg?

Honestly speaking, we don’t see users configure the DISPLAY env variable into two before.
I am also wondering how this can do. When you run some X-based application, will this make this app able to run on separate display?

Also, in your test, I don’t see obvious test result to say this issue only happens to DP. Your HDMI is always connected or ever connected there.

The DISPLAY env variable can be set to :0.0 or :0.1 to select the screen to display on before running the app. This was how X originally dealt with multiple monitors and makes it easier to keep the windows separated since each screen has its own root window.

In my test, the HDMI-0 output is always on screen 0 but the DP-0 output is sometimes on screen 0 when it should always be on screen 1. The driver is not assigning the DP head to screen 1 unless it is connected when X starts.

The DISPLAY env variable can be set to :0.0 or :0.1 to select the screen to display on before running the app. This was how X originally dealt with multiple monitors and makes it easier to keep the windows separated since each screen has its own root window

Have you verified this to work on tegra?

I understand the original purpose of X, but we don’t know whether this could work on tegra or not.

In my test, the HDMI-0 output is always on screen 0 but the DP-0 output is sometimes on screen 0 when it should always be on screen 1. The driver is not assigning the DP head to screen 1 unless it is connected when X starts.

My suggestion is to use Weston instead of X for your case. If you insist using X for this issue, I can help push a request to internal team. But I cannot guarantee this would be resolved or not and cannot guarantee the time.

This multi-screen configuration works on tegra as long as the monitors are both plugged in when booted.

Hi,

I meant have you ever run any application that can run on separate displays through display 0.0 and 0.1?

Yes, I have.

1 Like

Are you simply trying to make the desktop layout with one monitor consistently to the left or right of the other when both are connected (and left or right picked as primary monitor), but you might have a case where a single monitor is connected and you need that monitor to be the primary desktop?

No, linuxdev. I want an app running on one monitor to not know about the other monitor. Our project does not use a conventional Linux desktop.

Thus you need two separate X servers running. One could be “:0”, the other could be “:1”. One could be automatically started in the usual way, while the other could be run using “startx”. Trying to use a different screen via “:0.0” and “:0.1” will fail because these are just extensions of a single desktop with complete knowledge of each other.

The “startx” script will be quite useful to you. This is a human readable script and has a man page with options, e.g., for specifying the DISPLAY it will use (you could for example force this to work as “:9”).

When X starts the server itself does not actually have any desktop features or knowledge. What X does is run one and only one program, and it is up to that program to start a desktop manager or do something custom. The first automatic program X runs in a standard boot is to run the login manager. The login manager runs as root, and when a login is authenticated, then the login manager kills itself by restarting X with the credentials of the other user…but the program X runs is now the desktop manager instead of a login manager.

startx skips the login manager. You could open and create five completely independent sessions by going to the five desktop consoles, F1 through F5 (if already in a GUI, then it would be “CTRL F1” through “CTRL F5”). At each terminal you would run startx with the proper options.

I have not looked at which options determine which monitor is used, but very likely someone from NVIDIA could tell you how to pass HDMI-1 or some other port (DisplayPort) as the monitor of interest. These would be two truly separate and independent servers with no copy and paste between them.

EDIT: Conveniently, you could edit a copy of startx and have it run your program instead of a desktop manager.

I already have the multi-screen configuration working, but only if both monitors are attached at boot. The problem is that the DP monitor does not get its own screen if it is attached after boot.

I have not tried (I don’t have dual monitors for the Jetsons), but you might want to disable the default method of starting X through the system, and then strictly use manual startx. Of all of the configuration you posted, I’m thinking this excerpt (basically Section "Device") is key to what you are attempting:

Screen      0
    Option      "UseDisplayDevice" "HDMI-0"
    Option      "AllowEmptyInitialConfiguration" "true"
EndSection

Section "Device"
    Identifier  "Device1"
    Screen      1
    Option      "UseDisplayDevice" "DP-0"

I’m not good enough with NVIDIA’s specific parameters, but I believe the approach is only partially correct. A single X instance should have the possibility of multiple Screen, but since you are intending two independent monitors, this implies both would be Screen 0…but would apply to separate DISPLAY=:0 and DISPLAY=:1.

Think of the DISPLAY as a namespace, and Screen as a subset of geometry in that namespace. You could actually have a single X instance and dedicate a certain app to one subset of the geometry. This would require a window manager (or its equivalent), and the two could interact, e.g., via copy and paste.

If you have one separate X display, and exactly one application will always run and display on this, then the startx for that X instance would not run a window manager…you would instead name the application (with options for picking geometry) in place of the window manager.

Then again, I’m not sure what limitations the embedded GPU might have. I’m not even certain that a desktop PC’s GPU could support running two monitors simultaneously with two independent X servers. If it can, and if the Jetson’s GPU can, then you are probably in luck. If you cannot, then you are probably stuck doing it the way you’ve already begun…with separate screens of a single X instance, and using the window manager to place applications on one monitor versus the other.

If you were to do remote operation you would be interested in a virtual desktop. An X server which is virtual is not seen any differently to X than is one which is directly attached to the Jetson. They both render to a framebuffer, but one has a monitor attached, and another has a network protocol to describe the framebuffer. The reason this matters to you is because a virtual desktop is always present, regardless of whether a monitor is attached to it or not.

Most people working with a virtual server would be doing remote work. For example, a drone rendering to a virtual desktop could be viewed by someone on the ground (there would be increased latency, but it would essentially be like working directly on the Jetson).

There is nothing wrong with running a virtual server with a two screen layout, and using the remote display software on the same computer…you don’t have to use virtual desktop software remotely. That virtual server would always have the same layout regardless of how many monitors are viewing it.

Note that AllowEmptyConfiguration is part of being able to have a server ready for a monitor plugin, but it isn’t sufficient to causing the desktop layout to not change when there is a monitor plug/unplug event.

Could you describe in detail what your use case is? For example, is one going to be a kiosk or perhaps a camera feed, while the other is connected only during maintenance? What is it you want to actually see happen with this layout?