No announcement yet.

Freesync with dual monitors settings in X

  • Filter
  • Time
  • Show
Clear All
new posts

  • Freesync with dual monitors settings in X

    I'm not pro with linux, just share settings that makes freesync work with dual monitors, if something i wrote is wrong please correct me.
    It's not a perfect solution, there is some limits:
    1. window can't move between monitors.
    2. some applications may need to run 2 instances if you want to show window in both monitors, for example firefox.
    3. the desktop environment you are using may stay in a monitor.
    4. may need to run 2 window managers.
    5. screensaver may only lock one monitor.

    Debian bullseye
    Mate desktop environment

    ryzen 5800x, X570, rx6900xt
    monitors, left [email protected], right [email protected](primary)

    first step is create/edit file /etc/X11/xorg.conf.d/xorg.conf, file name can be different but ended with ".conf".
    in default there no files in /etc/X11/xorg.conf.d directory, you may want to backup and delete other files if it exists.
    it is close to xinerama settings but xinerama is disabled.
    in the config file it defined 2 monitors, 2 devices, 2 x-screen, and a layout at bottom.
    I use 2 video ports for each monitor, "DisplayPort-1" for primary monitor, other one is "HDMI-A-0", you can get the name of video port from command "xrandr".
    check "man xorg.conf" "man amdgpu" for more options and descriptions.
    Section "Monitor"  #right side monitor.
    Identifier "dp1"
    Section "Monitor"  #left  monitor.
    Identifier "hdmi0"
    Section "Device"  #for  right monitor.
    Identifier "AMD0"
    Driver "amdgpu"
    Screen 0
    option "Monitor-DisplayPort-1" "dp1"
    option "ZaphodHeads" "DisplayPort-1"
    option "VariableRefresh" "true"  #I only have one monitor supported freesync, so dont have this option in other device section.
    Section "Device"  #for left monitor.
    Identifier "AMD1"
    Driver "amdgpu"
    Screen 1
    option "Monitor-HDMI-A-0" "hdmi0"
    option "ZaphodHeads" "HDMI-A-0"
    Section "Screen"  #right monitor.
    Identifier "xscreen0"
    Device "AMD0"
    Monitor "dp1"
    Section "Screen"  #left monitor.
    Identifier "xscreen1"
    Device "AMD1"
    Monitor "hdmi0"
    SubSection "Display"  #I want mouse smoothly moving between monitors so set a virtual resolution and I will scale 1080p to 1440p later.
      Depth 24
      Virtual 2560 1440
    Section "ServerLayout"
    Identifier "xlayout"
    screen 0 "xscreen0" 0 0
    screen 1 "xscreen1" LeftOf "xscreen0" 
    after edited xorg.conf file do logout and login should applys the config.
    now freesync should works but some window manager doesn't like this and casuses problem like lost control to window focus, window bar.
    in my case I'm using Mate desktop environment, the default window manager is "marco" and it is not supported multiple x-screens.
    you can use "wmctrl" with environment var "DISPLAY" to obtain what window manager is running at "DISPLAY" x-screen, for exmaple "DISPLAY=:0.1 wmctrl -m".
    "openbox" is a window manager and can choose which x-screen it gonna run.
    marco is running at all x-screen at start, what i gonna do is replace marco with openbox at left monitor and keep running marco at right monitor.
    you can try other window manager like icewm, metacity.
    here is my script, I maully run it after login.
    xrandr --screen 1 --output HDMI-A-0 --scale 1.3333x1.3333    #scale my left screen size from 1920x1080 to 2560x1440.
    DISPLAY=:0.1 openbox --replace &    #replace left monitor window manager with openbox.
    DISPLAY=:0.0 openbox --replace &    #marco still running at right monitor and I guess it thinks it still manage left monitor so I replace it with openbox .
    sleep 1    #wait openbox at right monitor complete replace marco.
    DISPLAY=:0.0 openbox --exit    #close opnebox at right monitor.
    DISPLAY=:0.0 marco --no-composite &    #start marco at right monitor, marco will complains left monitor already has window manager running but marco will keep running.
    DISPLAY=:0.1 tint2 &    #give openbox a taskbar at left monitor.
    disown -h
    above is my settings for dual monitors with freesync, now I can run application at left monitor with openbox right click menu or use terminal emulator with env var "DISPLAY".
    I'm still not comfortable with openbox, I tried run mate panel on left monitor but it complains it already running, i tried xfce panel at left monitor and it works but I don't know how to change its theme, still trying to find a window manager close to mate.