120Hz for Linux?

Discussion in 'Parallels Desktop on a Mac with Apple silicon' started by Zshrc, Nov 16, 2021.

  1. Zshrc

    Zshrc Member

    Messages:
    21
    The new M1 Pro/Max devices include a 120Hz screen. It seems to be working well with Windows VMs, but has anyone gotten it working with Linux VMs?
     
  2. Zshrc

    Zshrc Member

    Messages:
    21
    Best Answer
    Managed to figure it out in case anyone else was trying to...
    This is a fullscreen VM on a 16 inch M1 Pro running Ubuntu 20.04 in Xorg. Also works in CentOS 9 Stream.
    $ cvt 4112 2572 120
    $ xrandr --newmode (everything after "Modeline" from above command)
    $ xrandr --addmode Virtual-1 4112x2572_120.00
    $ xrandr --output Virtual-1 --mode 4112x2572_120.00
     
  3. YousufS

    YousufS Bit poster

    Messages:
    2
    The 1st command worked for me but not the 2nd one. This was the output:

    parallels@ubuntu-linux-20-04-desktop:~$ cvt 4112 2572 120
    # 4112x2572 119.99 Hz (CVT) hsync: 330.80 kHz; pclk: 1916.00 MHz
    Modeline "4112x2572_120.00" 1916.00 4112 4496 4952 5792 2572 2575 2585 2757 -hsync +vsync
    parallels@ubuntu-linux-20-04-desktop:~$ xrandr --newmode
    xrandr: failed to parse '(null)' as a mode specification
    Try 'xrandr --help' for more information.
    parallels@ubuntu-linux-20-04-desktop:~$
     
  4. JulianD5

    JulianD5 Bit poster

    Messages:
    2
    Here's a bash script to do it automatically

    ```
    #!/bin/bash
    # Usage: ./change_resolution.sh <width> <height> <refresh_rate>
    # Example: ./change_resolution.sh 1800 1169 120

    # Check if three arguments are provided
    if [ "$#" -ne 3 ]; then
    echo "Usage: $0 <width> <height> <refresh_rate>"
    exit 1
    fi

    # Assign input parameters
    width="$1"
    height="$2"
    refresh="$3"

    # Run cvt to generate modeline information
    cvt_output=$(cvt "$width" "$height" "$refresh")

    # Extract the line containing "Modeline"
    modeline_full=$(echo "$cvt_output" | grep "Modeline")

    # Remove the word "Modeline" to get only the parameters
    modeline=$(echo "$modeline_full" | sed 's/Modeline //')

    # Extract the mode name (first token, removing quotes)
    mode_name=$(echo "$modeline" | awk '{print $1}' | sed 's/"//g')

    # Get the remaining parameters (everything after the mode name)
    mode_params=$(echo "$modeline" | cut -d' ' -f2-)

    # Create the new mode with xrandr using the mode name and parameters
    xrandr --newmode "$mode_name" $mode_params

    # Add the new mode to the output "Virtual-1"
    xrandr --addmode Virtual-1 "$mode_name"

    # Set the new mode on "Virtual-1"
    xrandr --output Virtual-1 --mode "$mode_name"
    ```
     

Share This Page