Eliminate screen tearing with AMD GPU on Ubuntu

While I normally post about Arch Linux, as that’s what I currently use, a friend recently asked how to get rid of his screen tearing issues. He’s using an AMD graphics card, and is running Ubuntu Gnome with open source AMD drivers. Currently for Ubuntu 16.04, no proprietary drivers are being offered for AMD cards (note this method is only intended for open source drivers anyhow). Basing myself off my previous post, I had him setup a configuration file to correct the tearing.

Update: Seems this configuration is effective for many different systems, according to feedback, including Mint, OpenSUSE and Gentoo. I expect it will work with most systems, with the exception of those with hybrid graphics. It’s most likely using Xorg-server 1.19 or Wayland may correct such issues.

In /usr/share/X11/xorg.conf.d/ directory, edit (or create) a file called 20-radeon.conf with the following contents:

Section "Device"
    Identifier "Radeon"
    Driver "radeon"
    Option "TearFree" "on"
EndSection

The key here is the TearFree option. After saving this, restart the X server (running restart gdm can suffice). Be sure to save any work and close applications first, as this will log out any users utilizing the graphical front-end. A modified version of this configuration may also improve performance, by utilizing DRI (direct rendering infrastructure)  3, which has certain improvements for the way the X server handles rendering. Also enabling Glamor (if not enabled already by default) can  improve 2D rendering tasks, performing them through Mesa’s OpenGL libraries. Note older AMD cards will not support Glamor. The enhanced configuration is as follows:

Section "Device"
    Identifier "Radeon"
    Driver "radeon"
    Option "TearFree" "on"
    Option "DRI" "3"
    Option "AccelMethod" "glamor"
EndSection
Advertisements

38 thoughts on “Eliminate screen tearing with AMD GPU on Ubuntu

  1. I have Linux Mint 18 KDE with Plasma 5.6 running on a Radeon R9 290. By adding this configuration instead of adjusting the compositor settings, I get better benchmark results with glmark2. All desktop effects are maxed out and it works flawless.

    Like

  2. Ok,let me explain my problem.I have 17inch HP laptop with hybrid(dual amd)grapics.I have AMD Radeon HD 8610G (APU graphics)and AMD Radeon R7 M260 dedicated GPU.Now opensource/libre drivers work without any problem regarding 2D gaming but some of the OpenGL shader options are disabled,so 3D gaming work partially and with downgraded performance(may vary from game to game).Now when i install fglrx or fglrx-updates proprietary drivers,i get faster runtime on some of the games,but there are certain effects that cause screen tearing on 2D games and some effects can cause lags on 3D games(much more lower on number).For example Heroes of Newerth runs better on opensource/libre graphics drivers while with it i can not play DOTA2,and when i install closed source drivers DOTA2 works but HON have some lags on specific graphics effects.The same goes for Frogatto,2D game which works perfect with opensource drivers while closed source ones cause screen tearing on certain places.Now i am using Ubuntu based distros 14.04.x(tested on multiple versions,trying to see which one works better,and x number does matter because later ones(14.04.5)can not accept proprietary drivers for some reason at the moment.Moving away from unity does help,but not that much,and yes,there were in both cases screen tearing on videos that you can find on youtube regarding tests for tearing,and also tearing with windows(but there were on tearing if window would overlap another window application),weird right.Any solution would be helpful.Regards and reply if you need more info!!!

    Like

    • The fglrx drivers are considered broken/deprecated by most modern and up-to-date Linux distributions, which is why you cannot install them. Unfortunately for your setup it’s likely the info I have here will not work, as you have hybrid graphics. Such setups are known to be prone to screen tearing while using Xorg (at least with current release versions). The next update to it is expected to provide better PRIME (i.e. hybrid graphics) support, though the extent of this is beyond my knowledge. Even so, I doubt this version will be available with Ubuntu until 17.04. The only recommendation I can make for you is to check options listed on the Arch Wiki page for ATI/AMD drivers: https://wiki.archlinux.org/index.php/ATI. Alternatively, you could try using a Desktop Environment that uses Wayland, which has been designed to avoid screen tearing entirely. Considering you’re on 14.04 though, I don’t know that you’d be able to install one.
      Best of luck~

      Like

  3. When it comes to Ubuntu 16.04 LTS driver support is horrible .Some distros may not boot at all,some would hang on specific function when installed while some of those may do the same live while doing specific task.Now when it comes to Ubuntu 14.04 distros only problem that i run on is that some of the distros may cause freeze at some point which i still do test on when and why it does happen.All those above(in arch wiki link) stand for opensource drivers while with closed source i seem to be left behind.I may switch back to opensource drivers if freeze problem persist.I did done edit in grub menu https://help.ubuntu.com/community/HybridGraphics and added radeon in tag(GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash XXX.modeset=1″ ) because it seems that freeze error happens when system switch from discrete to integrated card or when battery is low on power.Its still something that needs to be tested further since freeze can happen totally random,even after few hours of work.Now i could be much more detailed regarding these problems but my job is not to troubleshoot the systems so i can not do this whole day,i just get machine to run properly more or less so it could run with tasks needed to be done.I learned my lesson and i will pay more attention on which systems are supported in the future.There is also sound lag but that is whole another story.Regards

    Like

  4. I already had all of that in my config file except for the tear free part… added that and am now watching The Grand Tour in 1080p without tearing nice!

    Like

  5. Awesome easy trick! I had a little tearing on my older laptop with ATI mobility hd 4670. running OpenSuse leap 42.2. This completely eliminated the tearing and now i love my suse system even more. Thanks buddy 🙂

    Like

    • While I can’t say for certain, as I do not have a GPU which can use it, I suspect some of the users who have left comments may be using it. If you try for yourself and it does work, feel free to leave a note here so that I may update the post accordingly.

      Like

      • When I repĺace “Radeon” / “radeon” with “AMDgpu” / “amdgpu” it somewhat seems to work with my HD 7850. There’s still some light tearing, at least with the Flash Player.

        Like

  6. On ubuntu Gnome 16.10 I was stuck in a login loop because of this. Any ideas? The tearing is unbearable since i updated from 16.04(.01). I’m typing this on a laptop with the following (lspci):

    00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09)
    00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09)
    00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 09)
    00:14.0 USB controller: Intel Corporation 8 Series USB xHCI HC (rev 04)
    00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04)
    00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)
    00:1c.0 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 3 (rev e4)
    00:1c.3 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 4 (rev e4)
    00:1c.4 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 5 (rev e4)
    00:1d.0 USB controller: Intel Corporation 8 Series USB EHCI #1 (rev 04)
    00:1f.0 ISA bridge: Intel Corporation 8 Series LPC Controller (rev 04)
    00:1f.2 SATA controller: Intel Corporation 8 Series SATA Controller 1 [AHCI mode] (rev 04)
    00:1f.3 SMBus: Intel Corporation 8 Series SMBus Controller (rev 04)
    01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller (rev 07)
    02:00.0 Network controller: Broadcom Limited BCM43142 802.11b/g/n (rev 01)
    03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Venus PRO [Radeon HD 8850M / R9 M265X] (rev ff)

    TBH. I don’t even know which GPU is actually doing rendering for Gnome, but I suspect it’s the Radeon one, since it’s mostly visible on secondary display (like, an actual diagonal tear line through most of it when scrolling – drives me nuts).

    Like

    • Considering you have hybrid graphics, it’s very likely you’re only using your integrated Intel graphics card. If however your external display is connected via HDMI, then it’s possible you’re only using AMD graphics. As you’re using an Ubuntu derivative, I doubt you have the latest versions of Gnome or xorg server, so I don’t see how it would be possible for you to be using integrated graphics for your main display and discrete for external. The X11 standard doesn’t support this, and (last I checked) xorg server nor Gnome on Wayland do either. You can run this command to find out for sure: glxinfo | grep “OpenGL renderer”
      If it’s running AMD drivers, are you unable to boot simply with the TearFree option added? Or, if it’s intel, you can try adding that to a similar file, except with 20-intel.conf as the name, and contents as follows:

      Section “Device”
      Identifier “Intel Graphics”
      Driver “intel”
      Option “TearFree” “on”
      EndSection

      Like

  7. I tried this before on Ubuntu and it worked perfectly, but now I am on Manjaro Linux KDE with Kernel 4.4 LTS and a Radeon R9 290 using the “video-radeon+” driver. Do I have to change Driver “radeon” to Driver “video-radeon+” to make this take effect on my system? Thanks!

    Like

    • I haven’t used Manjaro before, so I may not be correct with my response. As far as I understand, using the radeon+ driver still falls into the “radeon” category, and that might only change if you’d use the amdgpu driver instead. That being said, Manjaro seems to use configuration files in “/etc/X11/xorg.conf.d/90-mhwd.conf” instead of the one I have listed in this guide. See if changing that works.

      Like

      • Thank you for your reply.

        “/etc/X11/xorg.conf.d/90-mhwd.conf” is a shortcut to “/etc/X11/mhwd.d/radeon.conf”. This file is automatically generated by mhwd with the following content:

        Section “Device”
        Identifier “Device0”
        Driver “radeon”
        Option “AccelMethod” “glamor”
        BusID “PCI:1:0:0”
        EndSection

        Adding <> and <> or changing Identifier from “Device0” to “Radeon” doesn’t seem to change anything.

        On Ubuntu, your “20-radeon.conf”-modification caused a “glmark2” benchmark improvement from 10,000 points to 17,000 points. Now on Manjaro, the benchmark doesn’t exceed 10,000 points with or without the modification.

        I came across your article since I had tearing issues on Ubuntu (I think it was Mint 17.3 Cinnamon) and the benchmark improvement was rather an acceptable side-effect. On Manjaro, tearing never was an issue, but I was hoping to get that performance improvement 🙂

        Like

      • The only options that should affect performance are the usage of glamor, and DRI3. With the xf86-video-ati package (might be named differently for you) on newer versions, this is enabled by default. Considering you’re using Manjaro I’d expect you to be using a newer version. The only reason I would see it not being used is if it wasn’t supported by the hardware, which is unlikely.

        Like

  8. Thanks again. I found this article in the Arch Wiki (https://wiki.archlinux.org/index.php/ATI). So I played around again and I found out that even deleting /etc/X11/xorg.conf.d/90-mhwd.conf and /etc/X11/mhwd.d/radeon.conf had no effect whatsoever, the system started normally without these files. Nevertheless, creating 20-radeon.conf had the expected effects, so it seems that your advice here is also applicable to Arch / Manjaro and my performance problem must be related to something else.

    Like

  9. Adding the parameter:

    “`
    Option “TearFree” “on”
    “`

    Crashed Xorg and prevented it from booting back

    More Info on my machine:
    Linux Kernel 4.9.0
    Debian Stretch OS
    Driver: Xorg AMDGPU (Open source)
    GPU: AMD RX 460

    Like

    • Can you try, instead of using “on” using “true”? I’m seeing some places listing this option with the newer AMDGPU drivers, and I’m curious if that will make a difference. If that is the case, I will update my post accordingly. If not, would you be able to send a link to error logs?

      Like

      • Hello 🙂 Thanks for getting back to me! yes I tried the “true” value and the same exact thing happened,
        Here’s a link to my logs: https://pastebin.com/Kgxz3L0W

        The freezing happened at 23:12:~ at the boot up screen: no new characters appear after this secrtion:

        23:12:08 systemd: Started Update UTMP about System Runlevel Changes.
        23:12:08 systemd: Starting Update UTMP about System Runlevel Changes…
        23:12:08 systemd: Reached target Graphical Interface.
        23:12:08 systemd: Reached target Multi-User System.
        23:12:08 systemd: Started LSB: minidlna server.
        23:12:08 systemd: Started TeamViewer remote control daemon.

        I hope that’s helpful! XD

        Like

      • (This is going to be frustrating because I can’t reply to re-replies). Your log ends at 23:11:45. Is the part you put directly in the comment all you get after that point?

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s