How to Fix Screen Tearing in Xorg on Arch Linux

How to Fix Screen Tearing in Xorg on Arch Linux

Screen tearing is a common and frustrating issue for Linux users, especially those running Xorg (X11) on rolling-release distributions like Arch Linux. It typically manifests as horizontal lines or visual breaks in video playback, gaming, or even basic desktop animations. Fortunately, there are several proven solutions depending on your GPU and desktop environment.

In this guide, we’ll explore various techniques to eliminate screen tearing on Arch Linux with Xorg. Whether you’re using Intel, NVIDIA, or AMD graphics, we’ll cover methods specific to each setup.


What is Screen Tearing?

Screen tearing occurs when the GPU and monitor are out of sync during the rendering process. The result is that portions of multiple frames are displayed at once, usually in a horizontal split. On Xorg, screen tearing is more common because the X server does not synchronize frame delivery with the monitor’s refresh rate by default.


Preliminary Steps

Before diving into fixes, ensure you have the following:

  1. Updated System: Make sure your Arch Linux system is up to date:

    sudo pacman -Syu
    
  2. Xorg Installed: This guide assumes you’re using Xorg (not Wayland). To confirm:

    echo $XDG_SESSION_TYPE
    

    If it returns x11, you’re good to go.

  3. GPU Drivers Installed: Depending on your hardware, make sure you’ve installed the appropriate drivers:

    • Intel: xf86-video-intel (or fallback to modesetting)
    • NVIDIA: nvidia or nvidia-dkms
    • AMD: xf86-video-amdgpu or xf86-video-ati (for older cards)

Fixing Screen Tearing: GPU-Specific Solutions

1. Intel Graphics

Intel users are particularly prone to screen tearing due to the aging Xorg driver architecture. There are two ways to run Intel graphics in Xorg:

A. Using the Modesetting Driver (Preferred)

The modern approach uses the built-in modesetting driver provided by Xorg.

  1. Remove xf86-video-intel:

    sudo pacman -Rs xf86-video-intel
    
  2. Create a configuration file to enable TearFree:

    sudo mkdir -p /etc/X11/xorg.conf.d
    sudo nano /etc/X11/xorg.conf.d/20-intel.conf
    

    Add the following:

    Section "Device"
        Identifier  "Intel Graphics"
        Driver      "modesetting"
        Option      "TearFree"    "true"
    EndSection
    
  3. Reboot the system:

    reboot
    

B. Using the Intel DDX Driver (Legacy)

If you’re using xf86-video-intel (though not recommended), use the following config:

sudo nano /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
    Identifier  "Intel Graphics"
    Driver      "intel"
    Option      "TearFree"    "true"
EndSection

This enables the driver’s built-in frame synchronization feature.


2. NVIDIA Graphics

NVIDIA’s proprietary drivers are known for performance but also for some quirks with Xorg. Screen tearing is common if the driver is not configured properly.

A. Enable Full Composition Pipeline (FCP)

  1. Install NVIDIA drivers:

    sudo pacman -S nvidia nvidia-utils
    
  2. Generate or edit an X configuration file:

    sudo nvidia-xconfig
    
  3. Edit the configuration to enable FCP:

    sudo nano /etc/X11/xorg.conf
    

    Under the Screen section, modify or add the following line:

    Option         "metamodes" "nvidia-auto-select +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
    

    A sample section might look like:

    Section "Screen"
        Identifier     "Screen0"
        Device         "Device0"
        Monitor        "Monitor0"
        DefaultDepth    24
        SubSection     "Display"
            Depth       24
        EndSubSection
        Option         "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
    EndSection
    
  4. Reboot or restart the display manager:

    reboot
    

B. Use nvidia-settings (GUI Method)

Alternatively, use the GUI tool:

nvidia-settings
  • Go to “X Server Display Configuration”
  • Check “Force Full Composition Pipeline”
  • Click “Save to X Configuration File”

3. AMD Graphics

AMD’s open-source drivers generally handle screen tearing better than Intel or NVIDIA. Still, issues can occur.

A. Tear-Free with amdgpu Driver

Create or edit the following configuration:

sudo nano /etc/X11/xorg.conf.d/20-amdgpu.conf
Section "Device"
    Identifier "AMD Graphics"
    Driver "amdgpu"
    Option "TearFree" "on"
EndSection

B. For Older Cards (radeon Driver)

If using the older radeon driver, use:

sudo nano /etc/X11/xorg.conf.d/20-radeon.conf
Section "Device"
    Identifier "Radeon"
    Driver "radeon"
    Option "TearFree" "on"
EndSection

Additional Fixes

1. Use a Compositor

Compositors help synchronize drawing operations, minimizing tearing. Many desktop environments already include one:

  • KDE Plasma: Built-in KWin compositor
  • XFCE: Has optional compositor (Settings > Window Manager Tweaks)
  • LXQt/Openbox: Requires manual compositor like picom

Using Picom

  1. Install Picom:

    sudo pacman -S picom
    
  2. Create a config file:

    mkdir -p ~/.config/picom
    nano ~/.config/picom/picom.conf
    
  3. Add the following for optimal sync:

    vsync = true;
    backend = "glx";
    
  4. Start Picom:

    picom --config ~/.config/picom/picom.conf &
    
  5. Autostart Picom by adding it to .xinitrc or your DE’s autostart settings.


Verifying Tear-Free Setup

After applying changes and rebooting, test for tearing:

  1. Use Test Videos:

    • Search for “screen tearing test” videos on YouTube (e.g., moving lines or scrolling bars)
  2. Use glxgears:

    sudo pacman -S mesa-demos
    glxgears
    

    Move the window quickly to detect any tearing.

  3. Screen Recording Comparison: Record a short screencast before and after enabling tear-free settings to verify improvement.


Troubleshooting Tips

  • Black Screen or Failures: If X doesn’t start or goes black, try booting into a TTY (Ctrl+Alt+F3), then move or delete the config file from /etc/X11/xorg.conf.d.

  • Wrong Driver: Double-check your GPU vendor and driver. Mismatches (like using intel config for AMD) won’t work.

  • Use xrandr to Apply Compositing: For NVIDIA:

    xrandr --output HDMI-0 --set "PRIME Synchronization" 1
    
  • Fallback to Wayland: If tearing remains an issue, consider switching to a Wayland session if your DE supports it. KDE and GNOME both have Wayland options with excellent VSync support.


Conclusion

Screen tearing on Arch Linux using Xorg is a solvable problem with the right configuration for your graphics card. Intel, NVIDIA, and AMD users each have targeted approaches, whether through driver options, full composition pipelines, or enabling TearFree options. Additionally, compositors like Picom or built-in solutions in KDE/GNOME can help smooth the visual experience.

By combining these techniques, you should be able to enjoy a tear-free, smooth desktop on Arch Linux without sacrificing performance or stability.

If you’re still experiencing tearing, don’t hesitate to ask in the Arch forums or Reddit’s r/archlinux—sometimes, hardware-specific quirks need community-tested tweaks.