nV News Forums

 
 

nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   NVIDIA Linux (http://www.nvnews.net/vbulletin/forumdisplay.php?f=14)
-   -   XVideoTextureSyncToVBlank, xorg high cpu (http://www.nvnews.net/vbulletin/showthread.php?t=87367)

r.c. 03-01-07 10:11 PM

XVideoTextureSyncToVBlank, xorg high cpu
 
Hi, I've been trying to eliminate some tearing on rendered YUV frames. I'm using SDL to render them to a YUV overlay, and couldn't find a decent way to sync draws with the vertical retrace (vsync). I thought I'd finally found the answer when I came across XVideoTextureSyncToVBlank as a setting inside the nvidia-settings tool, and indeed it did fix the tearing (none of the other X sync oriented settings seemed to make any difference). Then the problem reared it's ugly head...

When running just one rendering task at a time, it worked ok, but it quickly killed performance when I started doing more than one. The symptom is that the X server would start climbing to higher and higher CPU usage, for example, with XVideoTextureSyncToVBlank=0, xorg cpu usage with one overlay going would be < 2%. With it =0 and 8 windows going, it would still be under 10% or so. But with XVideoTextureSyncToVBlank=1, it would be maybe 20% for one, but would climb over the course of a few seconds from 40 or to 95+ for 2 or more, and would be basically be unusable for any more than 1 or 2 windows. I've seen this happen across recent nvidia driver releases (87.56 and 97.46 at least) and across a wide range of distributions, X versions, and kernels, both 32 and 64 bit.

I'm wondering why, and whether there is another way to get vsync functionality via the X and XVideo type functions used by SDL, or if not, perhaps a suggestion for an alternate rendering approach (as two extremes, I've considered both GL and DirectFB - wasn't sure about hardware assisted YUV support for either though).

Also, as a heads up to anyone else that may be affected - perhaps MythTV users, mplayer folks, etc., it looks like the default of XVideoTextureSyncToVBlank has been changed from 0 to 1 in the latest drivers (97.46), so this might start hitting more people. You can change it back with nvidia-settings -a XVideoTextureSyncToVBlank=0 but then of course, you may get tearing again.

Thanks for any explanations, help, etc.

kokoko3k 03-02-07 05:58 AM

Re: XVideoTextureSyncToVBlank, xorg high cpu
 
Quote:

I'm using SDL to render them to a YUV overlay
XVideoTextureSyncToVBlank is not related to overlay video adaptor, but to video texture adaptor.
If you're lucky and you driver/gpu supports YUV overlays, try to use them!

with mplayer. you can speedup the rendering of opengl video (plus nicer scaling) using:
mplayer movie.xxx -vo gl:yuv=6:lscale=1:cscale=1
(it will still use some more cpu power compared to XV texture/blitter adaptor and, of course, YUV overlay).
You may also want to benchmark with different "yuv=[1..6]" to see what's better for your card.

phelin 03-02-07 10:28 AM

Re: XVideoTextureSyncToVBlank, xorg high cpu
 
Try setting this in the device section of xorg.conf:

Option "UseEvents" "True"

r.c. 03-02-07 04:11 PM

Re: XVideoTextureSyncToVBlank, xorg high cpu
 
kokoko3k, thanks. I'm not using mplayer, but rather our own code. I just mentioned mplayer as an example of a similar program that might be affected in the same ways (if multiple instances at once are run across multiple screens).

I am using YUV overlays, however we have multiple displays. My understanding is that in the second display driven off of the nvidia card, you fake YUV overlays with blits. The rendering is definitely sync'd when XVideoTextureSyncToVBlank is set to 1, and is not when it is set to 0, and the performance with multiple windows being rendered is most definitely as I described. I'm not positive that SDL is actually using hardware surfaces in all cases (I just need to add some code to check), and like I mentioned we are using multiple displays, so some of this could be related to the way display 2 is handled by the driver (not sure if it happens in 2 X screen configs, but it is definitely happening in twinview configs). However, performance is great with the XVideoTextureSyncToVBlank turned off, so thought I'd bring it up here.


Thanks for the tip Phalin, will look into it.

kokoko3k 03-02-07 04:54 PM

Re: XVideoTextureSyncToVBlank, xorg high cpu
 
@Phelin: i don't know how that will affect the smoothness of my videos, but interface redrawings seems A LOT better now, thanks!


All times are GMT -5. The time now is 05:35 PM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.