You are not logged in.

#1 2022-01-18 16:51:32

jrgiacone
Member
Registered: 2021-04-24
Posts: 19

Xrandr (Dual Monitor Nvidia) Not Outputting Correctly when toggling

I've been having an issue with xrandr and nvidia since I started using linux almost a year ago. I have a dual monitor set up and from time to time I like to turn off my second monitor when not in use or to game for gsync for the variable refresh rate.I have two keybindings bound to my keyboard to automatically disable one display or to restart it. The issue typically occurs after being on a single screen for a while. I launch in dual screen.

I disable the single screen by running:

 xrandr --output DP-2 --mode 2560x1440 --rate 144 --primary --output DP-4 --off 

Then to get back into the dual screen:

 xrandr --output DP-2 --mode 2560x1440 --rate 144 --primary --output DP-4 --mode 1920x1080 --rate 144 --left-of DP-2 

However, I would say at least 3-4x a week I will run into an issue where the dual-screen will mirror my displays and upon switching back to the single screen I am left with a very extended display that does not fit on my 1440 screen.

Please see this link on imgr for the nvidia-settings screenshots: https://imgur.com/a/AOprPzI

Here is my xorg.conf

 # nvidia-xconfig: X configuration file generated by nvidia-xconfig
  1 # nvidia-xconfig:  version 495.46
  2
  3 # nvidia-settings: X configuration file generated by nvidia-settings
  4 # nvidia-settings:  version 465.24.02
  5
  6 Section "ServerLayout"
  7     Identifier     "Layout0"
  8     Screen      0  "Screen0" 0 0
  9     InputDevice    "Keyboard0" "CoreKeyboard"
 10     InputDevice    "Mouse0" "CorePointer"
 11     Option         "Xinerama" "0"
 12 EndSection
 13
 14 Section "Files"
 15 EndSection
 16
 17 Section "InputDevice"
 18
 19     # generated from default
 20     Identifier     "Mouse0"
 21     Driver         "mouse"
 22     Option         "Protocol" "auto"
 23     Option         "Device" "/dev/psaux"
 24     Option         "Emulate3Buttons" "no"
 25     Option         "ZAxisMapping" "4 5"
 26 EndSection
 27
 28 Section "InputDevice"
 29
 30     # generated from default
 31     Identifier     "Keyboard0"
 32     Driver         "kbd"
 33 EndSection
 34
 35 Section "Monitor"
 36
 37     # HorizSync source: edid, VertRefresh source: edid
 38     Identifier     "Monitor0"
 39     VendorName     "Unknown"
 40     ModelName      "Ancor Communications Inc VG248"
 41     HorizSync       30.0 - 160.0
 42     VertRefresh     50.0 - 150.0
 43     Option         "DPMS"
 44 EndSection
 45
 46 Section "Device"
 47     Identifier     "Device0"
 48     Driver         "nvidia"
 49     VendorName     "NVIDIA Corporation"
 50     BoardName      "NVIDIA GeForce RTX 3080"
 51 EndSection
 52
 53 Section "Screen"
 54     Identifier     "Screen0"
 55     Device         "Device0"
 56     Monitor        "Monitor0"
 57     DefaultDepth    24
 58     Option         "Stereo" "0"
 59     Option         "nvidiaXineramaInfoOrder" "DFP-3"
 60     Option         "metamodes" "DP-4: 1920x1080_144 +0+0, DP-2: 2560x1440_144 +1920+0"
 61     Option         "SLI" "Off"
 62     Option         "MultiGPU" "Off"
 63     Option         "BaseMosaic" "off"
 64     Option         "Coolbits" "28"
 65     SubSection     "Display"
 66         Depth       24
 67     EndSubSection
 68 EndSection 

I would really appreciate any help this drives me mad and I have to restart Xorg in order to get things working again, which ends up closing all my applications.

I have tried the Lts kernel and the standard kernel, rocking a 5800x and a 3080. The problem has been persistent on every driver since I started back in April 2021

Offline

#2 2022-01-18 21:58:47

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: Xrandr (Dual Monitor Nvidia) Not Outputting Correctly when toggling

xrandr is known to have issues w/ output sequences.
Try to split and order them

#!/bin/sh
 xrandr --output DP-2 --mode 2560x1440 --rate 144 --primary
 xrandr --output DP-4 --off 
#!/bin/sh
 xrandr --output DP-4 --mode 1920x1080 --rate 144
 xrandr --output DP-2 --mode 2560x1440 --rate 144 --primary --right-of DP-4 

----

The static server layout isn't advisable (and full of cruft)

Section "Monitor"
    Identifier     "DP-2"
    Option         "RightOf" "DP4"
    Option         "Primary" "True"
EndSection
Section "Device"
    Identifier    "NVIDIA GeForce RTX 3080"
    Driver           "nvidia"
    Option         "Coolbits" "28"
EndSection

Offline

#3 2022-01-18 22:18:13

jrgiacone
Member
Registered: 2021-04-24
Posts: 19

Re: Xrandr (Dual Monitor Nvidia) Not Outputting Correctly when toggling

seth wrote:

The static server layout isn't advisable (and full of cruft)

Section "Monitor"
    Identifier     "DP-2"
    Option         "RightOf" "DP4"
    Option         "Primary" "True"
EndSection
Section "Device"
    Identifier    "NVIDIA GeForce RTX 3080"
    Driver           "nvidia"
    Option         "Coolbits" "28"
EndSection

I will try that thank you! Regarding the static server layout, are you suggesting in the xorg.conf. Deleting everything except what you had suggested?

Offline

#4 2022-01-18 22:19:45

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: Xrandr (Dual Monitor Nvidia) Not Outputting Correctly when toggling

Delete the xorg.conf and use configlets for output and driver configuration to augment the autodetection system.
https://wiki.archlinux.org/title/Xorg#Using_.conf_files

Offline

#5 2022-01-19 02:04:39

jrgiacone
Member
Registered: 2021-04-24
Posts: 19

Re: Xrandr (Dual Monitor Nvidia) Not Outputting Correctly when toggling

seth wrote:

Delete the xorg.conf and use configlets for output and driver configuration to augment the autodetection system.
https://wiki.archlinux.org/title/Xorg#Using_.conf_files

I tried doing the following based on what you sent. I'm not sure I understand the configlets.

 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"
    Identifier     "DP-4"
    Option         "LeftOf" "DP-2"
    Option         "Primary" "True"
EndSection

Section "Device"
    Identifier     "NVIDIA GeForce RTX 3080"
    Driver         "nvidia"
    Option         "Coolbits" "28"
EndSection

However it is still issue if I spam my scripts with the separated commands.

Offline

#6 2022-01-19 03:54:41

jrgiacone
Member
Registered: 2021-04-24
Posts: 19

Re: Xrandr (Dual Monitor Nvidia) Not Outputting Correctly when toggling

Someone on reddit recommended a work around that seems to work so far, so I wanted to post it here. I'm not sure how to mark a forum as solved, but once I know it for sure works and how to I can do that.

The solution that seems to be working from my initial testing is to add an

 xrandr --output DP-2 --off 

followed by your command, thus turning off your display completely before running the command. So far this seems to be working well, it takes a little longer but it does not appear to be glitching out!

An example would be:

 xrandr --output DP-2 --off --output DP-2 --mode 2560x1440 --rate 144 --primary --right-of DP-4 

etc... you can also split these up such as:

 xrandr --output DP-2 --off 
xrandr --output DP-2 --mode 2560x1440 --rate 144 --primary --right-of DP-4 

Offline

#7 2022-01-19 07:07:25

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: Xrandr (Dual Monitor Nvidia) Not Outputting Correctly when toggling

Remove the InputDevice sections, they're cruft - the referenced drivers don't exist anymore since at least a decade.

Why do you configure DP-2 at all? It seems to be a static presence?
Switching it off will (temporarily) leave you w/ no output at all what might lead several clients to crash for the 0x0 root window - I'd rather not do that and just configure DP-4

xrandr --output DP-4 --off
and
xrandr --output DP-4 --mode 1920x1080 --rate 144 --left-of DP-2

Offline

#8 2022-01-20 16:17:41

jrgiacone
Member
Registered: 2021-04-24
Posts: 19

Re: Xrandr (Dual Monitor Nvidia) Not Outputting Correctly when toggling

seth wrote:

Remove the InputDevice sections, they're cruft - the referenced drivers don't exist anymore since at least a decade.

Why do you configure DP-2 at all? It seems to be a static presence?
Switching it off will (temporarily) leave you w/ no output at all what might lead several clients to crash for the 0x0 root window - I'd rather not do that and just configure DP-4

xrandr --output DP-4 --off
and
xrandr --output DP-4 --mode 1920x1080 --rate 144 --left-of DP-2

I'll try that tonight thank you! I ended up having the main monitor for DP-2 in there because when the screen shuts off due to inactivity (I think that is the DPMS) and wakes up from a mouse movement, for whatever reason, fullscreen videos or games with gysnc will cause a ton of flickering (display on and off) until I reset the DP-2 parameters. Would you potentially have a fix for that? I can test it out and see if it was my miss setting beforehand from the Xorg.conf

Offline

Board footer

Powered by FluxBB