Screen tearing and lagging using Intel open source drive i915

Hi, my laptop has a built-in Intel graphic chip:

Device-1: Intel Core Processor Integrated Graphics vendor: Samsung Co R730 Laptop driver: i915 v: kernel 
           bus ID: 00:02.0 
           Display: x11 server: X.Org 1.20.5 driver: intel tty: N/A 
           OpenGL: renderer: Mesa DRI Intel Ironlake Mobile v: 2.1 Mesa 19.1.2 direct render: Yes

with which I had a lot of screen tearing and lagging for a long time. So long, that I almost got used to it. The tearing mostly happened when watching videos in a browser, but also using a video-player the picture was not completely tear-free.
What was also annoying was the lagging. One frame was as long as 2-3 frames which made the video terrible to watch. Audio and video were never in sync and it felt as if I was watching a slide show instead of a smooth moving picture.

You noticed of course I am speaking in the paste tense, meaning it is resolved with the help of a Archwiki page.
Last night I started searching and found this Arch wiki page: Intel graphics - Archwiki
What was interesting for me was the chapter: ** Troubleshooting**

I deleted my /etc/X11/xorg.conf.d/20-intel.conf file and made a new one with these lines:

Section "Device"
    Identifier  "Intel Graphics"
    Driver      "intel"
    Option      "TearFree" "true"

Plus, I did something else, something I never heard of. Also in the Archwiki page, chapter Disable Vertical Synchronization (VSYNC), it says to create a hidden file in your home directory called .drirc. In this file I copied the text:

<device screen="0" driver="dri2">
	<application name="Default">
		<option name="vblank_mode" value="0"/>

which took care of the lagging. Now the pictures are smooth again, great to watch, plus the CPU is no longer stressed out at 95-100% (which sometimes stopped the video) but it's used at around 50%.

Maybe others can benefit from this as well. Just try it. To make sure you can return to your original setup, copy your files before changing them.


interesting that the .drirc file is using dri2 ... dri3 is the default :thinking:

I had 3 but after changing it to two, the lagging was gone.

Hm. Well, thats kinda funny because I dont see that line in your config file

Option "DRI" "2"

( maybe check whats actually running with cat /var/log/Xorg.0.log | grep DRI )

But anyways ... that intel is almost a decade old, so its entirely possible that dri2 works better ...
[people were still having to switch to the new dri3 manually just a few years ago]

..Out of curiosity have you tried using modesetting instead of intel for the driver ?

Correct, it is in the .drirc file as:
device screen="0" driver="dri

A decade old, you say. Well that could be right, the laptop was bought in 2011.

I have to look into modesetting first cause I have no idea what it is.

modesetting is sort of the new open default that covers intel ... if you remove intel it will use modesetting. (theres some posts outlining it in the forums from a year or 2 ago)

As to the dri thing - oh, I hadnt realized the drirc file could override, I thought it still needed to be stated in the intel conf or maybe by a kernel param. But I suppose it is the dri file, so that makes sense.

my i3-3110m with HD 4000 GPU seems to be configured to use DRI2 before applying the modifications above:

cat /var/log/Xorg.0.log | grep DRI 
[     4.958] (II) intel(0): [DRI2] Setup complete
[     4.958] (II) intel(0): [DRI2]   DRI driver: i965
[     4.958] (II) intel(0): [DRI2]   VDPAU driver: va_gl
[     4.958] (II) intel(0): direct rendering: DRI2 DRI3 enabled
[     4.962] (II) Initializing extension DRI3
[     4.996] (II) GLX: Initialized DRI2 GL provider for screen 0
[     4.996] (II) Initializing extension XFree86-DRI
[     4.996] (II) Initializing extension DRI2

Well - you have both, just like I do. But that means you are using DRI3 unless I have woefully missed something.
[Oh I see, you mean you applied the reverse, putting dri3 instead to achieve that?]

i dunno, the last message is about DRI2 and the display 0 is my laptop's internal screen. So I figured it was using DRI2. It will definitely be using DRI2 now as I applied the tweaks above to get rid of the tearing and lag as suggested to see if it is any better.

I rather think that confirms that settings dri2 in that file does not disable dri3 - which after looking again, yeah - the arch wiki only states it turns off VSYNC... :thinking:
[changing to dri2 fully would be done in that intel conf file or an environment variable :]

1 Like

Okay thanks for that info, I'll see what happens with media and if there's any difference with CPU usage. If not, I may remove the mods.

If where you are now fits well then its probably the sweet spot.
If some oddities of tearing or consumption are fixed, while you still get all the DRI3 improvements/compatibility [we are talking acceleration, mesa, 3d, etc] then its nice the 'middle-ground' of this sort of nonsensical tweak works.

But - if you are banished to DRI2 because it actually works better (again - specific and/or older hardwares) - then its also nice to able to downgrade all the way if you like. By all means check.

The CPU is hovering between 20-30% during fullscreen playback, there's no noticeable lag or tearing so I'll definitely leave it as it is. I'm learning about this stuff too still as I have dealt predominantly with configuring, modifying and re-writing where necessary Windows drivers over the years so appreciated your input.

I've had to remove the .drirc file tonight after the latest xorg-server update from testing. There was bad tearing again effectively diving the screen into 3 sections. xorg-server updates seem to have fixed the lag and tearing but you need to undo the .drirc tweak.

I've got rid of 20-intel.conf too and still no tearing. It seems the tweaks are no longer needed but thanks @DeMus for the period of time they filled the void :slight_smile:

1 Like

Forum kindly sponsored by