This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] Cannot prevent tearing when watching videos

Tags: None
(comma "," separated)
User avatar
sparhawk
Registered Member
Posts
433
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
6071
Karma
16
OS
Moving this to System configuration, as it depends on your hardware settings, not on individual applications.


Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ...
User avatar
sparhawk
Registered Member
Posts
433
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
Karma
0
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
433
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
Karma
0
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
433
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
Karma
0
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
433
Karma
0
OS
Have you compiled stuff before?

Perhaps. (That's about the level I'm on.) Is that "make", etc.?
luebking
Karma
0
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
433
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
433
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
Karma
0
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
433
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.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar