How can i eliminate tearing in X?

Asked by toga on 2007-12-23

I'm a newbie in Linux (UBUNTU 7.04), i like it very much, i love Compiz, but tearing makes the whole thing (with or without Compiz) unusable (not so much unusable like "freezing" of the screen after most attempt to maximize a window, which is my biggest problem with Compiz, but unusable enough).
Is there a way to eliminate tearing? My hardware (Nvidia Geforce 7600GS) supports flipping (like most video cards do), i've installed the nvidia driver (what boosted X to draw at a tolerable speed), but i can't set the X client to render with flipping, and it seems to me so, that my only hope is Compiz to make it possible. I know that GDI in Windows doesn't support flipping too, but there is no tearing noticeable (faster driver???).
The most frustrating thing for me is the tearing of TVtime (embarrassing only by flashing scenes) even in full screen mode. Although i have a cheap video card, my computer has a lot of power, and was expensive too. I can't believe that there is no way to watch TV on it at least at the quality of the cheapest TV set. I configured everything to be perfect for it: created and use 920x576@100Hz resolution (we have PAL in Hungary) for my secondary monitor (16:10 aspect CRT). Were all of my efforts for nothing?
Linux and especially Compiz seems to be so superb, i can't believe that this simple task is impossible for it.

PS: I've checked Video Texture Adaptor / Sync to VBlank and Video Blitter Adaptor Settings / Sync to VBlank on display device... in XVideo Settings and both Sync to VBlank and Allow Flipping in OpenGL Settings of the Nvidia Settings application, but tearing remained. I hoped that the OpenGL settings have effect on Compiz too, but it seems so that only on fullscreen OpenGL applications (i haven't tried such application yet, so have no experience with them, but i think at least they can flip).

Thanks for Your help in advance!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu compiz Edit question
Assignee:
No assignee Edit question
Solved by:
Luis Fernando Teixeira
Solved:
Last query:
Last reply:
Revision history for this message
Olivier (olivier-lacroix) said :
#1

Hi !

you may want to upgrade to Gutsy and see if performance increase. It certainly will as you will get newer NVIDIA drivers

Revision history for this message
toga (toga-inf) said :
#2

Thanks for the quick reply! I want to upgrade to Gusty. At the first time when automatic update offered this, i asked it to do it, but on the end of the upgrade process a message told me, that the upgrade was not successful. I don't know the reason, but i'm afraid that my nvidia driver (downloaded from nvidia.com) could be the problem. Can someone tell me if i'm right?
Some days ago i found Envy, a very cool driver installation tool, and installed a new nvidia driver with it (but tearing remained). I think it downloads the best driver, so i don't think that upgrading to Gusty will increase performance, but don't let me right.
My problem is by the way not the performace, it is tolerable. Only the tearing disturbs me, which can be eliminated only by flipping or a VERY fast full screen blit ON VBLANK. I hope that Compiz supports it (because as i see it uses OpenGL), but i don't know how to set it to work.
But know i have an other question too: how can i do a successful upgrade to Gusty without loosing my settings (bookmarks in Firefox, etc.)? (My home folder isn't on separate partition.) Have i to remove the nvidia driver before starting the upgrade?
I know that it isn't a Compiz question, but it is realted to Oliver's reply.
Thanks a lot!

Revision history for this message
toga (toga-inf) said :
#3

Sorry for constantly using "Gusty" instead of "Gutsy" in my previous post.

Revision history for this message
Olivier (olivier-lacroix) said :
#4

OK. To upgrade to gutsy, open a terminal and enterthe following commands

sudo apt-get update
sudo apt-get dist-upgrade

and yes, removing the NVIDIA driver would be a good thing if the upgrade fails. I believe envy can do it for you.

For preformance problem with compiz and NVIDIA, disbaling sync to vblank in the compiz settings seems to have helped many people. Indeed, the restricted drivers already do that by themselves, nad having both seems to mess things up.

Revision history for this message
toga (toga-inf) said :
#5

Thank You very much for the answer! It is so good to know that i can get help if i have a problem.
I think that i have to apologize, because i wasn't clear enough. Now i tested win2k more substantially, and can define my problem more exactly.
I don't have performance problem. I was wrong stating that GDI in windows has less tearing than X in Linux. The huge quality difference is in video display. The reason of the low quality under Linux is that it renders video directly to the screen (thus with tearing) while my windows applications use overlay. The trick is that overlay surfaces are flipped on VBlank, so the video display is free from tearing.
My problem is TEARING. Windows has it, X has it, but video under windows doesn't have it. My goal is to eliminate tearing from X (at least from fullscreen video applications like TVtime), and i hope that Compiz is the tool that can help me to do it, but i don't know how.
So i don't want to disable sync to vblank (i know it can increase performance), just the opposite: i have performance, now i want quality, so i wanna force Compiz to sync to vblank (with flipping if possible).
I have the feeling that Compiz has the ability to render everything (the whole screen with all the windows on it) to a backbuffer and than flip on vblank. If i could set it to this behavior, it would provide that quality that i can enjoy while watching video under windows and which quality is today's absolute minimum in my eyes. I don't think i'm perfectionist, because hardwares support it a long time ago, and i don't understand why isn't it the default rendering method of all graphical softwares.
So my question again: how can i eliminate tearing (with flipping on vblank) in X (in Compiz)?
Thanks in advance!

Revision history for this message
Olivier (olivier-lacroix) said :
#6

Compiz won't help for video performance. To get better performance, be sure to select Xv as your video output module in your video player : this way you will get overlay.

You should also disable compiz, since compiz has some problem with overlay.

And if you stick with compiz, disable sync to vblank in compiz : that will improve quality as well. But be sure to activate it in the nvidia panel. The trick is those two settings tend to "compete".

Revision history for this message
Best Luis Fernando Teixeira (lf-ubuntu) said :
#7

My solution to the problem:

1) install compizconfig-settings-manager (using apt, synaptic, anything you like...)

2) Run CompizConfig Settings Manager (it should be installed in the System > Preferences menu)

3) Select "General Options", then tab "Display Settings".

4) Make sure "Sync to VBlank" is checked.

5) If you have made any changes in "NVIDIA X Server Settings" regarding "Sync to VBlank", I think these can be undone.

I'm using ubuntu 8.04.

Hope it helps...

Revision history for this message
toga (toga-inf) said :
#8

Thank You very much for Your help! I tested both states of the "Sync to VBlank" checkbox in CompizConfig Settings Manager and found that it really works. It eliminates tearing, but i'm not 100% pleased with the result. I don't know exactly what it is, but something disturbs me. I'm not sure, but it seem like 30 fps or slower animation of my 60 fps screen (for example while i'm moving a window). It seems to be independent from my NVIDIA settings, so it may be caused by my slow videocard.
Thanks again!

Revision history for this message
Luis Fernando Teixeira (lf-ubuntu) said :
#9

In spite that I have found a solution for myself, I think that Mr. Olivier Lacroix answered that way before... Merit goes to him! I just think that I've given a "newbier" answer.

My card is also a 7600 GS, I don't find it very slow... I also use TV Time, and also something disturbs me on that - but much less with the Compiz "Sync to VBlank" option set. I think it must be something related to the TV capture board (mine is an ancient Pinnacle PC-TV), kernel module (bt878), or the TVTime itself.

At least for me, with Compiz active, SMPlayer has perfect image, using xv AND gl as output.

Have you tried watching TV on Windows? DId you get a better result?