You are not logged in.

#1 2024-04-30 22:16:58

Sertiz
Member
Registered: 2023-03-10
Posts: 13

Issue with second monitor in Sway (xrandr)

After addin new monitor to my setup I had some issues with games, some of them used wrong resolution(resolution of second monitor). I solved this by adding this to my sway config:

exec_always xrandr --output HDMI-A-1 --primary

All was fine I haven't problems after that (half a year). But last three days I'm noticing that games and some multimedia software working wrong. Games again using resolution of my second monitor. I tried run xrandr command from config, and have interesting output

 
$ xrandr --output HDMI-A-1 --primary
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  21 (RRSetCrtcConfig)
  Value in failed request:  0x0
  Serial number of failed request:  28
  Current serial number in output stream:  28

I didn't update my packeges before that, so I have no idea why xrandr broke. After full update have the same output of xrandr. Tryed to play with enviorment variables, no changes. I know that in sway wm there is no meaning as "primary monitor", but maybe exists other way to tell programs and games to use my primary monitor as "primary".


My neofetch:

                   -`                    sertiz@Nyashka
                  .o+`                   --------------
                 `ooo/                   OS: Arch Linux x86_64
                `+oooo:                  Host: X570 Steel Legend
               `+oooooo:                 Kernel: 6.8.7-arch1-2
               -+oooooo+:                Uptime: 9 hours, 37 mins
             `/:-:++oooo+:               Packages: 1757 (pacman), 4 (flatpak)
            `/++++/+++++++:              Shell: fish 3.7.1
           `/++++++++++++++:             Resolution: 1920x1080
          `/+++ooooooooooooo/`           WM: sway
         ./ooosssso++osssssso+`          Theme: Breeze-Dark [GTK3]
        .oossssso-````/ossssss+`         Icons: breeze-dark [GTK3]
       -osssssso.      :ssssssso.        Terminal: alacritty
      :osssssss/        osssso+++.       CPU: AMD Ryzen 5 5600 (12) @ 3.500GHz
     /ossssssss/        +ssssooo/-       GPU: AMD ATI Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT
   `/ossssso+/:-        -:/+osssso+-     Memory: 11159MiB / 32017MiB
  `+sso+:-`                 `.-/+oso:
 `++:.                           `-/+/
 .`                                 `/

Section with output config in sway config:

output HDMI-A-1 {
#mode 2560x1440@60Hz 
    resolution 2560x1440@60.000000HZ
        position 1080,0
}



output DP-1 {
    mode 1920x1080@60Hz 
    position 0,-25 
    transform 90
}

Thanks in advance for yours advices! <3

Last edited by Sertiz (2024-04-30 22:18:14)

Offline

#2 2024-04-30 23:05:15

seth
Member
Registered: 2012-09-03
Posts: 57,455

Re: Issue with second monitor in Sway (xrandr)

What's the actual output of "xrandr -q"?
You're talking to xwayland at this point and the output names aren't necessarily set in stone.

Also see https://wiki.archlinux.org/title/Multih … _xorg.conf

Offline

#3 2024-04-30 23:34:27

Sertiz
Member
Registered: 2023-03-10
Posts: 13

Re: Issue with second monitor in Sway (xrandr)

seth wrote:

What's the actual output of "xrandr -q"?

$ xrandr -q
Screen 0: minimum 16 x 16, current 3640 x 1895, maximum 32767 x 32767
DP-1 connected 1080x1920+0+-25 right (normal left inverted right x axis y axis) 480mm x 270mm
   1920x1080     59.96*+
   1440x1080     59.99
   1400x1050     59.98
   1280x1024     59.89
   1280x960      59.94
   1152x864      59.96
   1024x768      59.92
   800x600       59.86
   640x480       59.38
   320x240       59.52
   1680x1050     59.95
   1440x900      59.89
   1280x800      59.81
   1152x720      59.97
   960x600       59.63
   928x580       59.88
   800x500       59.50
   768x480       59.90
   720x480       59.71
   640x400       59.95
   320x200       58.96
   1600x900      59.95
   1368x768      59.88
   1280x720      59.86
   1024x576      59.90
   864x486       59.92
   720x400       59.55
   640x350       59.77
HDMI-A-1 connected 2560x1440+1080+0 (normal left inverted right x axis y axis) 600mm x 330mm
   2560x1440     59.96*+
   1920x1440     59.97
   1600x1200     59.87
   1440x1080     59.99
   1400x1050     59.98
   1280x1024     59.89
   1280x960      59.94
   1152x864      59.96
   1024x768      59.92
   800x600       59.86
   640x480       59.38
   320x240       59.52
   1920x1200     59.88
   1680x1050     59.95
   1440x900      59.89
   1280x800      59.81
   1152x720      59.97
   960x600       59.63
   928x580       59.88
   800x500       59.50
   768x480       59.90
   720x480       59.71
   640x400       59.95
   320x200       58.96
   2048x1152     59.90
   1920x1080     59.96
   1600x900      59.95
   1368x768      59.88
   1280x720      59.86
   1024x576      59.90
   864x486       59.92
   720x400       59.55
   640x350       59.77
seth wrote:

Also I don't have /etc/X11 directory and any xorg config files there.

Offline

#4 2024-05-01 06:34:30

seth
Member
Registered: 2012-09-03
Posts: 57,455

Re: Issue with second monitor in Sway (xrandr)

The ploan would be to add such file /etc/X11/xorg.conf.d/10-monitor.conf

Section "Monitor"
    Identifier  "HDMI-A-1"
    Option      "Primary" "true"
EndSection

to not having to use xrandr.

You're only configuring xwayland this way, every interaction w/ xrandr is synthetic and the idea is that xwayland might autpmatically pick up the proper value when it gets invoked and you don't have to deal w/ randr instructions to it might get filtered.

Offline

#5 2024-05-01 17:49:46

Sertiz
Member
Registered: 2023-03-10
Posts: 13

Re: Issue with second monitor in Sway (xrandr)

seth wrote:

The ploan would be to add such file /etc/X11/xorg.conf.d/10-monitor.conf

Section "Monitor"
    Identifier  "HDMI-A-1"
    Option      "Primary" "true"
EndSection

to not having to use xrandr.

You're only configuring xwayland this way, every interaction w/ xrandr is synthetic and the idea is that xwayland might autpmatically pick up the proper value when it gets invoked and you don't have to deal w/ randr instructions to it might get filtered.

I added in /etc/X11/xorg.conf.d/10-monitor.conf this:

Section "Monitor"
    Identifier  "HDMI-A-1"
    Option      "Primary" "true"
EndSection

Section "Monitor"
    Identifier  "DP-1"
    Option "Enable" "false"
    Option "Ignore" "true"
    Option      "Primary" "false"
EndSection

And nothing changed.

Offline

#6 2024-05-01 20:19:59

seth
Member
Registered: 2012-09-03
Posts: 57,455

Re: Issue with second monitor in Sway (xrandr)

Option "Enable" "false"
    Option "Ignore" "true"

would probably not work (you'll have to control the outputs w/ sway-output or the sway settings)

As you probably figured, wayland doesn't have that concept at all so it cannot be controlled from there, https://github.com/swaywm/sway/issues/5758

But last three days I'm noticing that games and some multimedia software working wrong.  … I didn't update my packeges before that, so I have no idea why xrandr broke

Something will have changed - possibly an older update and you just didn't reboot so it didn't immediately apply?
Did you change the output layout (ie. their positions)?

Offline

#7 2024-05-01 21:47:59

Sertiz
Member
Registered: 2023-03-10
Posts: 13

Re: Issue with second monitor in Sway (xrandr)

seth wrote:

Did you change the output layout (ie. their positions)?

Yes, I forgot! I changed orienthetion of my second monitor. I added transform segment to sway output config:


output DP-1 {
    mode 1920x1080@60Hz 
    position 0,-25 
    transform 90      <--- this
}

More likely xrandr broke becose of this. But why this broke that? And second question is how fix this?

Offline

#8 2024-05-01 22:51:43

seth
Member
Registered: 2012-09-03
Posts: 57,455

Re: Issue with second monitor in Sway (xrandr)

If you can confirm that to be the cause, likely file a bug against sway (might be wlroots scope but that's an upstream take)

You're not somehow talking to a regular X11 server here, but an emulation layer and I guess that just completely (can you issue any other xrandr commands? Rotate the output?) fails because the output transformation isn't a covered scenario.

Offline

Board footer

Powered by FluxBB