Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How I fixed video tearing on Sandy Bridge
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Tue Aug 14, 2012 1:17 pm    Post subject: How I fixed video tearing on Sandy Bridge Reply with quote

My Dell XPS 13 laptop (Sandy Bridge) was suffering from video tearing. I was able to fix it but it took many hours of research and trial and error so I thought I'd put everything into a post here. There seemed to be a lot of people frustrated with this issue.

I emerged xf86-video-intel-2.20.3, enabled the sna USE flag, and added the following options to xorg.conf:

Option "AccelMethod" "sna"
Option "TearFree" "true"

I also enabled the vaapi USE flag but I don't think that made a difference. Now there is no tearing even with the xfce4 compositor enabled.
Back to top
View user's profile Send private message
logical_guy
Apprentice
Apprentice


Joined: 18 Sep 2007
Posts: 268

PostPosted: Tue Aug 14, 2012 4:43 pm    Post subject: Reply with quote

wow... thanks!! I'm gonna try it now on my laptop - Lenovo ThinkPad E520. Hope it works...

EDIT: ---- yes I can confirm that it works. Well done, bro. Btw, I stuck with the amd64 stable version of xf86-video-intel-2.19.0 and can confirm it works.
Back to top
View user's profile Send private message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Tue Aug 14, 2012 5:57 pm    Post subject: Reply with quote

Yes! I'm pumped it works for you too but I just re-tested and I for sure get tearing on 2.19.0. I also get these messages in /var/log/Xorg.0.log:

(WW) intel(0): Option "AccelMethod" is not used
(WW) intel(0): Option "TearFree" is not used

Those messages disappear on 2.20.3 (and probably some versions before). Did you enable vaapi too?

BTW, I have some .ts videos at 1080p and 60fps from my Sony digital camera and I could never play them back smoothly or with A/V sync until now.

EDIT: I just played a 1080p youtube video and it was so very smooth. I remember those being jacked up before:

http://www.youtube.com/watch?v=yQ5U8suTUw0
Back to top
View user's profile Send private message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Tue Aug 14, 2012 6:43 pm    Post subject: Reply with quote

I did find one problem. If I close my laptop's lid for a few moments, it comes back up into the locked screen when I open it again. If I close it for a few minutes, it comes back up black and after 30-60 seconds it goes to the login manager. I can't find anything good in the logs but I recently switched to syslog-ng from metalog and I'm not familiar with it. Does anyone know where I should look for more info on this? I tested and this only happens if I have both AccelMethod and TearFree in xorg.conf.
Back to top
View user's profile Send private message
epsilon72
Guru
Guru


Joined: 20 Sep 2007
Posts: 568

PostPosted: Tue Aug 14, 2012 10:13 pm    Post subject: Reply with quote

Wow. No, no, no.

On my Lenovo x220 (i3, sandy bridge, with the 2.20.3 driver) the tearfree option destroys my ability to watch videos - tested with xbmc and vlc. They turn into a horrendous, laggy mess. There's no tearing, sure, but they are completely unwatchable. The desktop is less responsive too with tearfree enabled.

With sna enabled and tearfree off, vlc crashes my video output completely to the point where X has locked up hard and I need to hold down the power button to turn the laptop off.

I think I'll stick with 2.19 and -sna for now...besides, xbmc does a good job of playing tear-free video on its own. The other solution to getting tear free video without resorting to this new driver and its tearfree option is to use an opengl compositor: mutter (gnome 3), kwin (KDE4) or compiz, and enable vsync in the window manager's settings.

CORRECTION: Tearfree doesn't actually eliminate vsync issues when enabled. It adds lag and doesn't fix anything. I wonder what's going on? I was able to fix the X crashing issues by adding
Code:
i915.semaphores=1

to my boot parameters, however.
Back to top
View user's profile Send private message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Wed Aug 15, 2012 8:31 am    Post subject: Reply with quote

Yes, yes, yes, it works great here. Night and day at least.

I found that I can work around the lid problem if I switch VT's when it comes up black and then switch back to VT7. Then my session is there waiting for me. Any ideas?
Back to top
View user's profile Send private message
logical_guy
Apprentice
Apprentice


Joined: 18 Sep 2007
Posts: 268

PostPosted: Wed Aug 15, 2012 9:33 am    Post subject: Reply with quote

logical_guy wrote:
wow... thanks!! I'm gonna try it now on my laptop - Lenovo ThinkPad E520. Hope it works...

EDIT: ---- yes I can confirm that it works. Well done, bro. Btw, I stuck with the amd64 stable version of xf86-video-intel-2.19.0 and can confirm it works.


Yeah, ok, my bad. It was with the latest version 2.20.3. X could not recognize the AccelMethod and Tearfree options with the 2.19.0 version. So you're right there.

No, I have not enabled vaapi.

As regards to the wm slowing down, etc., none of those for me because I use awesome wm. I use startx, so I don't even have a graphical login screen. Keeps everything smooth and lean and fast.
Back to top
View user's profile Send private message
epsilon72
Guru
Guru


Joined: 20 Sep 2007
Posts: 568

PostPosted: Wed Aug 15, 2012 2:58 pm    Post subject: Reply with quote

I wonder if it has to do with my particular display? I don't have a TN screen in this laptop like most laptops have, and TN's are faster.
Do any of you have any special boot parameters for the video driver?
For the record, I'm using GNOME 2.32 with plain old metacity, so wm slowness shouldn't be that much of an issue...
Could any of you post the "device" section from your xorg config file(s)?

In the meantime, I'm going to try this with several different external monitors to see if it makes any difference.
Back to top
View user's profile Send private message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Wed Aug 15, 2012 5:00 pm    Post subject: Reply with quote

I use:

kernel /boot/kernel-3.6.0-rc1 root=/dev/sda2 raid=noautodetect i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1 i915.semaphores=1 drm.vblankoffdelay=1 pcie_aspm=force snd_usb_audio.nrpacks=1
Back to top
View user's profile Send private message
epsilon72
Guru
Guru


Joined: 20 Sep 2007
Posts: 568

PostPosted: Wed Aug 15, 2012 5:25 pm    Post subject: Reply with quote

Alright, well here are my findings for my hardware at least.

(Lenovo x220, i3-2350, IPS screen)

Enabling sna and tearfree does get me tear-free vaapi-accelerated video, but I MUST use some sort of compositor (xcompmgr, compton, compiz, kwin, etc) or I get horrible, horrible lag with the video. As long as the compositor is enabled, the desktop is fairly responsive as well. Both twm and compositor-less metacity performed horribly when it came to video playback.

Unfortunately, tearfree causes little hiccups in gaming applications. In openarena, there are frequent, very short pauses. In snes9x, these pauses are more severe and they cause the audio to pause as well.

so, in short, tearfree works well but it may seriously hinder games on your machine, AND it may be unusable without a compositor.
Back to top
View user's profile Send private message
Spidey
Apprentice
Apprentice


Joined: 07 Sep 2006
Posts: 269

PostPosted: Wed Aug 15, 2012 8:01 pm    Post subject: Reply with quote

I'll try this later. I'll also forward this topic to a colleague of mine who happens to work at Intel on the i915 video driver.
These are great findings.
Back to top
View user's profile Send private message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Thu Aug 16, 2012 4:33 am    Post subject: Reply with quote

Another note on my lid problem. It disappears if I issue 'xset -dpms'. This can be done in xorg.conf in the Device section:

Option "DPMS" "false"

If you run into this, watch out for xfce4-power-manager and xflock4. They both re-enable DPMS. To get around that, I switched from xfce4-power-manager to xfce4-battery-plugin and commented the following in /usr/bin/xflock4:

# xset dpms force off

Now all is well.
Back to top
View user's profile Send private message
grant123
Veteran
Veteran


Joined: 23 Mar 2005
Posts: 1080

PostPosted: Sun Sep 16, 2012 10:35 am    Post subject: Reply with quote

The instructions in my last post above don't seem to be necessary since at least xf86-video-intel-2.20.6.
Back to top
View user's profile Send private message
pigeon768
l33t
l33t


Joined: 02 Jan 2006
Posts: 683

PostPosted: Sat Sep 22, 2012 9:03 pm    Post subject: Reply with quote

There's more than one way to skin this cat. I was able to get rid of the tearing in mplayer with:
Code:
Section "Device"
        Identifier      "Intel Video"
        Driver          "intel"
        Option          "XvPreferOverlay"       "on"
EndSection
This will cause xv to default to the video sprite adapter instead of the textured video adapter, which does not suffer from tearing. There are some issues though, sometimes I'll get corrupted/no video and have to restart X. There may be issues with compositing as well, but I have that disabled.

I'll try the tear free option. Does anyone have any documentation on it? It's not mentioned in man intel.
Back to top
View user's profile Send private message
smuckle
n00b
n00b


Joined: 18 Jan 2013
Posts: 1

PostPosted: Fri Jan 18, 2013 4:30 am    Post subject: Reply with quote

Thanks for starting this thread and providing your solution. I spent a bunch of time trying different things including vaapi to fix the tearing on my sandy bridge system76 laptop. Setting AccelMethod=sna and TearFree finally fixed it.

Kernel 3.5.7, xf86-video-intel 2.20.13
Back to top
View user's profile Send private message
haschka
n00b
n00b


Joined: 31 Jul 2003
Posts: 10

PostPosted: Sat Mar 30, 2013 1:04 pm    Post subject: Fixed with compton... Reply with quote

I'm here on a i7 3770, and actually have a nvidia GTX 660 ti, but I'm using the integrated graphics in order that my display stays responsive in when running cuda or opencl calculations..

So I got confronted with tearing watching videos, and tried "TearFree" which occasonally freezed X and besides that added lag to video...

I tried several other things I don't remember and what I finally came up was to use compton.. adding:
Code:

compton --vsync opengl &

to my .xsession file... the display stays responsive and videos with mplayer work like a charm..
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum