Reply to topic

[SOLVED] Cannot prevent tearing when watching videos

User avatar sparhawk
Registered Member
Posts
267
Karma
0
OS
Hi, I've got a Dell XPS 17 L702X running Kubuntu 12.10, and I always get tearing when watching videos. I've spent hours troubleshooting this, to no avail. Here is my GPU information:
Code: Select all
$ lspci -v
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) (prog-if 00 [VGA controller])
        Subsystem: Dell Device 0571
        Flags: bus master, fast devsel, latency 0, IRQ 53
        Memory at f2400000 (64-bit, non-prefetchable) [size=4M]
        Memory at e0000000 (64-bit, prefetchable) [size=256M]
        I/O ports at 5000 [size=64]
        Expansion ROM at <unassigned> [disabled]
        Capabilities: <access denied>
        Kernel driver in use: i915
        Kernel modules: i915

My computer actually has an Optimus GPU (i.e. switchable Intel/Nvidia) and I'm running Bumblebee. I'd prefer to get video playback working on the Intel card, but FWIW I've tried
Code: Select all
$ optimus VLC
which didn't work.
What's odd is that vsync seems to be enabled:
Code: Select all
$ glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.

I've tried both VLC and SMplayer. System settings -> Desktop Effects -> Advanced -> Use VSync has always been on. I've tried turning off compositing (with Shift + Alt + F12), suspending desktop effects for fullscreen windows (desktop effects > advanced), disabling the OpenGL 2 shaders (desktop effects > advanced), and enabling SNA acceleration and tearfree by creating a file at /etc/X11/xorg.conf that contains:
Code: Select all
Section "Device"
        Identifier "intel"
        Driver "intel"
        Option "TearFree" "true"
        Option "AccelMethod" "sna"
EndSection

This resulted in me unable to change the brightness of the display, so I tried just TearFree without SNA. Brightness worked, but video still tore. I've also tried XRender compositing (desktop effects > advanced), installing i965-va-driver (I wasn't sure if I had to enable it), and changing the phonon backend to phonon-vlc.

None of this has worked. I've tried various combinations of these settings, but nothing exhaustive, since the list of candidates is getting quite massive. Could anyone please suggest a way to prevent video tearing, preferably through the Intel card, but Nvidia if necessary? I'm happy to try a specific combination of the above as well, if that might be useful. Thank you in advance.

Last edited by sparhawk on Fri Dec 07, 2012 10:37 am, edited 1 time in total.
User avatar Mamarok
Manager
Posts
2916
Karma
8
OS
Moving this to System configuration, as it depends on your hardware settings, not on individual applications.


Mamarok, hanging out in the Amarok forum since August, 2007
Currently running Kubuntu Trusty 14.04, KDE 4.12.95, Amarok 2.8-git of the day
User avatar sparhawk
Registered Member
Posts
267
Karma
0
OS
Thank you. Also, just for some additional information... I've just tried watching a movie in Unity (using smplayer), and it works fine with no tearing. It's just KDE where there's a problem.

EDIT: When I try watching the same movie in smplayer under Awesome, I do get tearing.
luebking
Registered Member
Posts
923
Karma
7
As of composited ("shadows enabled") playback:
- vertical synchronisation with XRender is *not* possible (at all)
- vertical synchronisation with indirect OpenGL compositing (should not be the case, bug check the output of "qdbus org.kde.kwin /KWin supportInformation") is *not* possible (at all)
- vertical synchronisation with direct opengl rendering on top of glXCopySubBuffer was broken in MESA 9.0, it's not clear whether it's entirely fixed or ever will.
-> there's an open bug and a pending patch to largely improve the situation by preferring the usage of glXSwapBuffer (what compiz can already do by a "always full repaint"" switch - unity is just a compiz plugin) - currently KWin by a bug actually only uses it during fullscreen effects (such as "present windows")

https://git.reviewboard.kde.org/r/107198/

As of uncomposited playback:
- vertical synchronisation is not possible with all video sinks, your best odds will be with the OpenGL outputs.
The nvidia blob can sync xv and usually also vdpau.

In general you will (if this is the case) usually not be able to sync to two screens but have to pick one (for a multiscreen setup) - i don't know how v'sync on optimus systems behave. If you can, please try the patch and report your findings.
User avatar sparhawk
Registered Member
Posts
267
Karma
0
OS
Thank you for the answer. To be honest, I'm very much confused by your suggestions. I have almost zero knowledge of the troubleshooting steps that I had already undertaken, I just followed several threads on Google. So do I understand correctly that composited Vsync is not possible as is, with the possible fix of the linked patch? I'm happy to use uncomposited Vsync, but I didn't really understand your answer to this part. Also, I'm happy to test the patch, but again I have no idea where to start with that.

Finally, I'm just using a single screen, if that is important.
luebking
Registered Member
Posts
923
Karma
7
Whether composited GL works w/o the patch depends on your GPU and Mesa version.

As for uncomposited playback, try
Code: Select all
mplayer -vo gl video.avi


To list all available video sinks:
Code: Select all
mplayer -vo help


xv and iirc xvmc are not syncable by default, the nvidia driver on the nvidia GPU has however a proprietary to do this.
User avatar sparhawk
Registered Member
Posts
267
Karma
0
OS
Fantastic! Your first suggestion works great!

I'm not sure why I would need to "list all available video sinks", in fact I'm not even sure what that means. In any case, it works fine now from my perspective. I'm happy to troubleshoot more to see if the patch works, or if I should file a bug, but I think that I'd need to be walked through very slowly to be able to complete any steps.

Thanks again.
luebking
Registered Member
Posts
923
Karma
7
I'm not sure why I would need to "list all available video sinks"


Curiosity ;-)

I'm happy to troubleshoot more to see if the patch works, or if I should file a bug, but I think that I'd need to be walked through very slowly to be able to complete any steps.

Have you compiled stuff before?
User avatar sparhawk
Registered Member
Posts
267
Karma
0
OS
Have you compiled stuff before?

Perhaps. (That's about the level I'm on.) Is that "make", etc.?
luebking
Registered Member
Posts
923
Karma
7
Yes. In this case first
- git clone git://anongit.kde.org/kde-workspace.git
- ensure you've all relevant development pacakges (depending on your distro)
- ccmake ("configure", there's none)
- make
- sudo make install

We'll have to figure this within the next week anyway, though. So if you're not sure what compile is, ... ;-)
Thanks for your offer an let's hope the best.
User avatar sparhawk
Registered Member
Posts
267
Karma
0
OS
Sorry, it's been ages since I replied. Life got a little busy... Anyway, as you probably guessed, I don't think I can be much help. I tried some of those steps, and got a bit messed up around the ccmake section. I'm happy to be led through it further, but I suspect that I'm just wasting everyone's time. Thanks again for your help.
User avatar sparhawk
Registered Member
Posts
267
Karma
0
OS
Hi luebking (and others),

Any update on preventing tearing in KDE generally? I've realised youtube videos also tear, so I guess a general KDE fix is the only solution to this.

If there is no general fix yet, can you suggest a workaround for VLC? I tried to turn on OpenGL via the preferences: Video output module > OpenGL GLX video output (XCB). When I disabled compositing, this didn't have the same effect as in mplayer (i.e. it still tore).

Thanks in advance.
luebking
Registered Member
Posts
923
Karma
7
http://fishsoup.net/misc/wm-spec-synchronization.html - and no: "general kde sync" cannot be a solution to that.
If the source we get from flash is a broken frame, kwin will just display that "broken" frame (so flash as well as kwin have to fully support those new mechanisms)

The patch to always perform a buffer swap is not in 4.10 and will need to be extended by that specification as well as the new buffer_age opengl extension for 4.11

Btw: use minitube - that should help you a lot reg. youtube video playback.
User avatar sparhawk
Registered Member
Posts
267
Karma
0
OS
Thanks for that. I'll give minitube a go. (FWIW I have youtube running with the html5 trial, not with flash, generally.)

Also, is the way that I attempted to fix VLC correct, or is there anything else that I can try?
sparhawk wrote:Video output module > OpenGL GLX video output (XCB).


--EDIT
Also, the reason why I was talking about a general fix was that I don't remember ever having problems with Gnome Shell or Unity, whether watching videos in smplayer, vlc or youtube (via Firefox). It has been a while though, so perhaps it's just my poor memory.

--EDIT2
I gave minitube a go, but it's fairly feature-poor compared to the youtube website. There's no ability to change resolution, to log in, to give videos thumbs up, to see statistics, to see comments (probably a good thing!). Anyway, assuming that I can prevent tearing in Firefox/html5/flash, then this would be the preferred route.
User avatar boast
Registered Member
Posts
86
Karma
0
OS
If I use kwin compositing with openGL and vsync enabled, I get no tearing in videos. Any other settings I do.

 
Reply to topic

Bookmarks



Who is online

Registered users: Alexa [Bot], asevens, Baidu [Spider], Bing [Bot], binro, brand, doublerainbow64, Exabot [Bot], Google [Bot], google01103, inksi, jgrulich, koriun, lazyit, Majestic-12 [Bot], metzman, Murz, random_fan, rfinley, Sentynel, toad, Vindex17, whatthefunk, Yahoo [Bot], yurchor, zhou13