You are not logged in.

#1 2022-09-15 10:49:04

Crystal4276
Member
Registered: 2022-09-12
Posts: 17

Setting independently the monitor order and primary monitor with X11

Hello,

I have reached the end of what i could do alone by reading the Arch Wiki and reddit.
Here's my issue.

❯ xrandr --listactivemonitors 
Monitors: 3
 0: +*DP-2 3440/798x1440/335+1920+0  DP-2
 1: +HDMI-0 1920/510x1080/287+0+180  HDMI-0
 2: +DP-5 1920/531x1080/299+5360+180  DP-5

I need to swap DP-2 and HDMI-0 in this list while keeping DP-2 as the primary monitor.
What i want to get is :

❯ xrandr --listactivemonitors 
Monitors: 3
 0: +HDMI-0 1920/510x1080/287+0+180  HDMI-0
 1: +*DP-2 3440/798x1440/335+1920+0  DP-2
 2: +DP-5 1920/531x1080/299+5360+180  DP-5

I used nvidia-settings to generate the xorg.conf.
I tried to swap monitor position in this part of the code without success :

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-3"
    Option         "metamodes" "HDMI-0: nvidia-auto-select +0+180 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, DP-2: 3440x1440_100 +1920+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, DP-5: nvidia-auto-select +5360+180 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Why i want to do that ?
I need to satisfy two requirements:
- The way Qtile works to position its screens. No flexibility there.
- The fact that my main monitor (DP-2) should remain as primary monitor to work at its native 100 Hz refresh rate. Otherwise it drops down to 60 Hz (cf this link: https://www.reddit.com/r/linuxhardware/ … ifferent/)

Any suggestions ?
Thanks in advance

Last edited by Crystal4276 (2022-09-15 11:04:18)

Offline

#2 2022-09-15 13:59:04

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,483

Re: Setting independently the monitor order and primary monitor with X11

I used nvidia-settings to generate the xorg.conf.

And this is pretty much where your problems start.
Don't use that, it creates a valid xorg config, but is full of cruft and won't allow you to control more details.


Put this into eg /etc/X11/xorg.conf.d/11-outputcontrol.conf ad get rid of the nvidia-settings generated xorg.conf

Section "Screen"
    Identifier     "Screen0"
#    Option         "nvidiaXineramaInfoOrder" "DFP-3" # entirely unsure about this one
    Option         "metamodes" "DP-2: 3440x1440_100 +1920+0, HDMI-0: nvidia-auto-select +0+180, DP-5: nvidia-auto-select +5360+180" # I'm fairly sure the order matters wrt the priamry device
EndSection

Section "Device"
    Identifier "NVIDIA GeForce GPU"
    Driver	"nvidia"
    Option	"TripleBuffer"  "True" # maybe useful, too
    Option	"ForceFullCompositionPipeline" "True" # use this to control that, though iirc you'll get it on a multiscreen setup anyway
EndSection

# if the metamode order doesn't suffice
Section "Monitor"
	Identifier "DP-2"
	Option	"Primary"	"True"
EndSection

Section "Monitor"
	Identifier "DP-5"
	Option	"Primary"	"False"
EndSection

Section "Monitor"
	Identifier "HDMI-0"
	Option	"Primary"	"False"
EndSection

Offline

#3 2022-09-15 17:28:02

Crystal4276
Member
Registered: 2022-09-12
Posts: 17

Re: Setting independently the monitor order and primary monitor with X11

Thanks seth for taking the time.

I religiously followed your post, but it didn't work at the end.
Here's the details of what i have done.

-Removed the nvidia gibberish
- created /etc/X11/xorg.conf.d/11-outputcontrol.conf
- copy pasted the proposed configuration.
I get 100Hz and the wrong monitor order:

Monitors: 3
 0: +*DP-2 3440/798x1440/335+1920+0  DP-2
 1: +HDMI-0 1920/510x1080/287+0+180  HDMI-0
 2: +DP-5 1920/531x1080/299+5360+180  DP-5

I swapped DP-2 with HDMI-0 in metamode line because i need DP-2 as primary monitor and in second position.

"metamodes" "HDMI-0: nvidia-auto-select +0+180, DP-2: 3440x1440_100 +1920+0, DP-5: nvidia-auto-select +5360+180"

I get the same results: 100Hz + wrong monitor order:

Monitors: 3
 0: +*DP-2 3440/798x1440/335+1920+0  DP-2
 1: +HDMI-0 1920/510x1080/287+0+180  HDMI-0
 2: +DP-5 1920/531x1080/299+5360+180  DP-5

If I comment this section:

# if the metamode order doesn't suffice
Section "Monitor"
	Identifier "DP-2"
	Option	"Primary"	"True"
EndSection

Section "Monitor"
	Identifier "DP-5"
	Option	"Primary"	"False"
EndSection

Section "Monitor"
	Identifier "HDMI-0"
	Option	"Primary"	"False"
EndSection

Then i get 60Hz and correct monitor order.

Monitors: 3
 0: +HDMI-0 1920/510x1080/287+0+180  HDMI-0
 1: +DP-2 3440/798x1440/335+1920+0  DP-2
 2: +DP-5 1920/531x1080/299+5360+180  DP-5

Notice that the * has disappeared and therefore means that defining DP-2 as primary is indeed required to get 100Hz.
Adding back "primary True" for DP-2 provide 100Hz and again revert the monitor order

Last edited by Crystal4276 (2022-09-15 18:47:49)

Offline

#4 2022-09-15 18:16:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,263

Re: Setting independently the monitor order and primary monitor with X11

I'm fairly certain that the primary monitor will always be 0 and you can't arbitrarily change that.

Offline

#5 2022-09-15 18:47:02

Crystal4276
Member
Registered: 2022-09-12
Posts: 17

Re: Setting independently the monitor order and primary monitor with X11

Do you think switching to Wayland may solve the problem ?
Any recommended equivalent to xrandr ?

Offline

#6 2022-09-15 19:37:16

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,483

Re: Setting independently the monitor order and primary monitor with X11

I kinda missed that this was your goal…

I need to swap DP-2 and HDMI-0 in this list while keeping DP-2 as the primary monitor.

The way Qtile works to position its screens. No flexibility there.

There seem quite a few related bugs itr, eg. https://github.com/qtile/qtile/issues/3708 and https://github.com/qtile/qtile/issues/3186
https://github.com/qtile/qtile/issues/3 … 1013903596 seems to indicate that the primary flag itself has (direct?) impact on qtiles behavior while https://github.com/qtile/qtile/issues/3 … 1202670434 indicates that the order behind that is random.
Depending on which issue w/ qtile you're having you might be chasing a goose here.
=> I'd rather seek to fix qtiles behavior than to work around it.

On the other side, why would the primary flag impact the used frequency?
Is this reflected in "xrandr -q"? Can you alter the rate w/ xrandr?
Is this maybe caused by "ForceFullCompositionPipeline"?

Offline

#7 2022-09-15 20:18:24

Crystal4276
Member
Registered: 2022-09-12
Posts: 17

Re: Setting independently the monitor order and primary monitor with X11

=> I'd rather seek to fix qtiles behavior than to work around it.

Which imply modifying their source code, i guess.
I will try raising an issue on their github then

As for the refresh rate thinghy. That's a bug.
I could fix it only by setting DP-2 as primary + following this "hack" :
https://www.reddit.com/r/linuxhardware/ … ifferent/)

xrandr -q clearly show 100 Hz for all primary flag configurations as long as DP-2 is set to 100 Hz.
But i could clearly see, that the real applied refresh rate was 60Hz.
So i used this https://www.displayhz.com/ or that https://www.testufo.com/refreshrate to confirm and even pinpoint how the "real" refresh rate changes depending on the parameters in xorg.conf

Last edited by Crystal4276 (2022-09-15 20:22:45)

Offline

#8 2022-09-15 20:31:03

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,483

Re: Setting independently the monitor order and primary monitor with X11

But i could clearly see, that the real applied refresh rate was 60Hz.

What does the outputs OSD say about the frequency? (This might very well be down to some client/compositor syncing to the primary output)

Offline

#9 2022-09-15 20:45:56

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,263

Re: Setting independently the monitor order and primary monitor with X11

Regarding switching to "Wayland", that's a maybe and depends on what your compositor actually is doing and aligning, there is no Wayland like there is a Xorg, every compositor might interpret/do things differently here so try it out.

Regarding the frequency stuff, isn't that the "old" Xorg issue of only being able to properly refresh/sync on one display and most tools (and likely the driver) will select the primary for that?

Last edited by V1del (2022-09-15 20:46:23)

Offline

#10 2022-09-15 20:49:49

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,483

Re: Setting independently the monitor order and primary monitor with X11

This is most likely not even an xorg specific issue, but nvidia lets you control the sync device ("grep __GL_SYNC_DISPLAY_DEVICE /usr/share/doc/nvidia/README")

Offline

#11 2022-09-15 21:05:40

Crystal4276
Member
Registered: 2022-09-12
Posts: 17

Re: Setting independently the monitor order and primary monitor with X11

seth wrote:

But i could clearly see, that the real applied refresh rate was 60Hz.

What does the outputs OSD say about the frequency? (This might very well be down to some client/compositor syncing to the primary output)

I didn't know what OSD mean.
Found out it's "on screen display".
So it's showing 100 Hz with or without being primary monitor (while online tools show 60 or 100Hz).

Regarding the frequency stuff, isn't that the "old" Xorg issue of only being able to properly refresh/sync on one display and most tools (and likely the driver) will select the primary for that?

I don't know. I'm probably too "young" as i switched from W10 early 2022.
Because of a kernel panic updating Mint 20.3 to 21, i almost went back to W10, but decided to give a rolling release a shot.
So Arch about 2 months ago. Tough to be honest... but the wiki helps a lot.

Last edited by Crystal4276 (2022-09-15 21:11:11)

Offline

#12 2022-09-15 21:23:59

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,483

Re: Setting independently the monitor order and primary monitor with X11

The output is running at the proper frequency, all you see is the client syncing to the primary output as myself and V1del suspected in #8 and #9
Check the grep in #10, you can control which output is used for the sync.

Offline

#13 2022-09-16 06:37:17

Crystal4276
Member
Registered: 2022-09-12
Posts: 17

Re: Setting independently the monitor order and primary monitor with X11

Since the beginning i have those environment variables set in this file /etc/environment:

CLUTTER_DEFAULT_FPS=100
__GL_SYNC_DISPLAY_DEVICE=DP-2
__GL_SYNC_TO_VBLANK=0

I can see them with printenv:

❯ printenv | grep CLUTTER
CLUTTER_DEFAULT_FPS=100
❯ printenv | grep GL
__GL_SYNC_DISPLAY_DEVICE=DP-2
__GL_SYNC_TO_VBLANK=0

This is the link i followed for that: https://www.reddit.com/r/linuxhardware/ … different/

If I do not declare those variables, i will always get 60Hz even if DP-2 is set as primary
(That was my last battle one month ago)

Last edited by Crystal4276 (2022-09-16 06:38:21)

Offline

#14 2022-09-16 06:56:15

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,483

Re: Setting independently the monitor order and primary monitor with X11

__GL_SYNC_TO_VBLANK=0

you're not syncing *at all* - at least not GL clients.
No idea about clutter, notably wrt qtile…

Offline

#15 2022-09-16 07:27:40

Crystal4276
Member
Registered: 2022-09-12
Posts: 17

Re: Setting independently the monitor order and primary monitor with X11

I removed CLUTTER_DEFAULT_FPS=100
I don't need it for qtile : https://wiki.gnome.org/Projects/Clutter

and I set __GL_SYNC_TO_VBLANK=1

Ok thanks a lot for the help, i'll see if anything can be done on qtile side.

Edit:
For those passing by and interested i opened a feature request on qtile github here:
https://github.com/qtile/qtile/discussions/3839

Last edited by Crystal4276 (2022-09-16 08:14:55)

Offline

Board footer

Powered by FluxBB