# Intel modesetting driver screen tearing

## UX.MAN

Hello everyone,

I am having an awful time with the Intel modesetting driver on an Intel HD 620 as there is a lot of screen tearing. I did try to use the Intel DDX driver, but the results were even worse.

Is there a way of tuning the drivers to have VSYNC or something similar on?

----------

## tholin

The modesetting driver will tear. https://bugs.freedesktop.org/show_bug.cgi?id=98876

You could try working around the problem by using a compositor with vsync but in my experience they are all garbage.

The x11-drivers/xf86-video-intel driver support tear free operation if you enable it. Put something like this in your xorg.conf

```
Section "Device"

        Driver     "intel"

        Option     "TearFree" "true"

EndSection
```

Even with that option enabled you'll still get some tearing. I suspect it's because the intel driver defaults to "adaptive vsync" meaning you'll still get tearing if the next frame isn't displayed in time. That can be a problem when emerging. Avoid watching movies while emerging is the only solution I got for that.

The intel driver also got a bug that disables the synchronization is you take a screenshot with kde-apps/spectacle. Strangely this only seem to happen with spectacle and no other screenshot utility. If you start getting tearing after screenshot you can force it on again by turning the output off and on.

```
xrandr --output HDMI1 --off && xrandr --output HDMI1 --auto
```

"Hello, IT. Have you tried turning it off and on again?"

If you are going to test the intel driver I suggest you start with commit 8f2d08016a12211205bb227296923cdebfcd3c38. The driver is really broken and finding any commit that works fine is difficult. That commit is the golden commit. I have the least amount of problems with it. You can install it by doing:

```
EGIT_COMMIT=8f2d08016a12211205bb227296923cdebfcd3c38 emerge =x11-drivers/xf86-video-intel-9999
```

The next commit after that one introduce massive amounts of frame drops so try not to use any version more recent than that. Overall the intel graphics support is kind of terrible so don't expect too much.

----------

## NeddySeagoon

UX.MAN,

Please put your /var/log/Xorg.0.log onto a pastebin site.

----------

## mike155

https://wiki.archlinux.org/index.php/intel_graphics#Tearing

----------

## Leio

Maybe try wayland. The slogan of it is "every frame is perfect", meaning also that tearing is basically very hard to achieve by programs and they need to go out of their way to achieve that or some unfortunate Xwayland situation (not native wayland)

----------

## UX.MAN

 *Leio wrote:*   

> Maybe try wayland. The slogan of it is "every frame is perfect", meaning also that tearing is basically very hard to achieve by programs and they need to go out of their way to achieve that or some unfortunate Xwayland situation (not native wayland)

 

I've tested Wayland, and to its credit it is a little better now. However, I feel I can get better performance on a Windows 10 environment while browsing on Firefox than on X.org/Wayland.

 *NeddySeagoon wrote:*   

> Please put your /var/log/Xorg.0.log onto a pastebin site.

 

I have accidentally deleted the log file an now no log is being saved nor displayed in systemd's journal. Is there a way of fixing it?

----------

## NeddySeagoon

UX.MAN,

I don't use systemd, so I can't help.

I'm fairly sure its written to /var/log/Xorg.0.log every time Xorg is started even under systemd.

The capital X and digit zero in the file name are important.

----------

## Leio

My /var/log/Xorg.0.log is from 2014, as with systemd it doesn't log twice, at least with my settings. I suspect that log before deletion may have been an ancient non-relevant one then too..

journalctl should have the log, for me under gdm-x-session (so I can filter to it with e.g. journalctl _COMM=gdm-x-session). You can get the current boots logs with journalctl -b0, previous boot with journalctl -b-1, etc. That way it might be small enough even if not filtering to the relevant components.

----------

## UX.MAN

 *Leio wrote:*   

> I suspect that log before deletion may have been an ancient non-relevant one then too..

 

You were right, that log seemed to be old and all the output was at the journald records.

Here is the output:

https://pastebin.com/KtPYtbQm

----------

## Leio

That log only tells me what you seem to use gnome-shell, so it's kind of surprising to hear that you have tearing with modesetting. I'd expect that maybe from videos only.

Do you rotate the display or some such? Basic situations gnome-shell compositor should be able to take care of, as long as dri3 is enabled (with modesetting it should be by default, and your log is of intel SNA instead anyways)

----------

## NeddySeagoon

UX.MAN

The log says 

```
Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (**) intel(0): TearFree enabled
```

that tells two things.

First, that you are using the Intel driver, not the mode switching driver and that the driver thinks that tear free is already enabled.

The log says 

```
Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (==) Using config directory: "/etc/X11/xorg.conf.d"

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (==) Using system config directory "/usr/share/X11/xorg.conf.d"

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (==) No Layout section.  Using the first Screen section.

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (==) No screen section available. Using defaults.

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (**) |-->Screen "Default Screen Section" (0)

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (**) |   |-->Monitor "<default monitor>"

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (==) No device specified for screen "Default Screen Section".

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]:         Using the first device section listed.

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (**) |   |-->Device "Intel Graphics"

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (==) No monitor specified for screen "Default Screen Section".

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]:         Using a default monitor configuration.

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (==) Automatically adding devices

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (==) Automatically enabling devices

Mar 05 11:04:11 baldor /usr/libexec/gdm-x-session[4997]: (==) Automatically adding GPU devices
```

which tells that Xorg is doing its own thing. Thats all the automatic setup.

There are a few things to try, make a file /etc/X11/xorg.conf.d/video_dev.conf with the following content.

```
Section "Device"

   Identifier "Manual Graphics Device Conf"

   Driver "intel"

   Option "SwapbuffersWait" "true"

EndSection
```

The intel man page says that's the default but is it really?

Other options that may bu useful with the Intel driver are 

```
   Option "NoAccel" "true"

   Option "AccelMethod"  "uxa"
```

Feel free to mix and match. Unused options will be ignored with a warning in the log.

"NoAccel" "true" is a massive performance hit.

Lastly, you can try the modesettnig driver. Change 

```
   Driver "intel"
```

to 

```
   Driver "modesetting"
```

The other options will cause warnings in the log but will otherwise be ignored.

----------

## UX.MAN

@Leio and @NeddySeagoon,

I forgot to mention that I'm currently testing the DDX driver. I will try the settings NeddySeagoon has suggested and will get back to you.

----------

## UX.MAN

I made some final testing and was able to get better performance. I don't know what was causing the issues, but I can tell you what I did. I was using a genkernel, so I built a new one from scratch, removed the DDX driver and tested with Wayland and modesetting. Everything looks good now. Thanks for helping me out!

----------

