View Full Version : Vsync locks hd files at 20fps?
OK, so I spent the better part of this weekend building a box for xbmc and after an unbelievable amount of aggravation (getting linux to play nice with my hardware, not xbmc-related), I've managed to get most everything working. My problem is that if I enable VSync, HD movie files cap at exactly 20fps. SD files play fine, and if I disable VSync, HD files are fine too, but I get really irritating tearing.
It's definitely not a lack of CPU power (Core 2 Duo overclocked to 3.33) but I do worry it may be related to the video card (or lack thereof). Hardware acceleration is working in Ubuntu and I can use all the fancy compiz effects (they're disabled for running xbmc). Obviously it's not as powerful as anything nVidia or ATI makes, but it should be enough.
As a side note I'm happy to help others with some of the stuff I HAVE gotten to work properly, notably lirc working with a Harmony 880 and the built in IR receiver on my Fusion 430. I can even boot and shutdown the computer with the remote. That whole process sucked, but after a lot of trial and error and editing config files it works like a dream. I'm also pretty pleased at how easy digital out was to get working.
For reference I'm using
Ubuntu 8.10 Alpha6 (need it for hardware support)
Core 2 Duo E7200 overclocked from 2.53 to 3.33 (plenty of headroom left too)
Asus P5Q EM HDMI motheboard (Intel G45 based)
Pioneer PDP 5070 (fed by VGA running at 1360x760) because HDMI hates me)
2GB DDR2 800
Antec Fusion 430
Harmony 880
Just noticed something strange - I have a couple divx 720p files, and they play at their normal framerate (25fps). The rest of my hd files are h264, and lock at exactly 20.0 fps. If this were a performance thing, I'd imagine that number would vary at least a little. h264 sd content plays fine.
Got it (maybe I posted too quickly). Disabling high quality upscaling (Lanzcos) for HD content (left it on for SD) seems to have solved my problem. Not sure if this is a bug in xbmc or not...
Try something else than Lanzcos method
Vsync tries to lock at source fps, if that fails (due to hardware not keeping up --not necessarily CPU!) it clocks down.
It's generally an issue with 1080p output and Intel IGP gfx (due to poor drivers)
I am a bit surprised to learn G45 is having issues, but try something easier than Lanzcos
freddyflinty
2008-09-22, 15:45
I'm having the same problem. 20 fps when using upscaling. Not a CPU problem. Didn't have the problem until I just upgraded to the latest PPA. Doesn't seem to matter which scaling method I use.
tails_naf@yahoo
2008-10-02, 01:45
I see the same problem too.
has anyone found a fix for this (other than disabling the upscaling)?
I have vsync on in the ATI catalyst control center (this is to prevent general video tearing) - but when upscaling for SD content is on, framerate is locked at 20fps. I've loads of cpu to spare...
triple buffering may help, it's worth a shot anyways.
tails_naf@yahoo
2008-10-02, 12:07
I see there is a bug filed for this item (or something similar)
http://xbmc.org/trac/ticket/4459
It looks like it was dismissed out of hand as not being an issue.
Well it certiainly is - I think this bug should be re-opened.
The issue is simple, in a system with plenty of horsepower, with upscaling for SD content (what defines the 'SD' threshold) - some movies are locked to 20fps - and the cpu is not even taxed - maybe 30% usage..
My setup is outputting 1080p, ATI 4850 HD card, Q6600 @ 2.6G, but as I say, there is loads of cpu power left.
An interesting thing to note - even with upscaling for SD content on, and I play a medium resolution clip, I do not see this 20fps limitation - it only seems to be with certain clips.
Does anyone else see this - or are we a small minority here? Any developers or gurus out there that have low quality content that is affected by this?
Is there any switch or way to tell if upscaling is on or off for a particular clip?
I'm willing to try any and all exeriments. I would try tripple buffering, if only I knew how to turn it on!
Cheers
why don't you do yourself a favor and examine the SOURCE FPS of said clips.
be they 23.97, 25 or 30fps ? make a list of this (it's VERY important) including CODEC and source resolution, and then we can continue the discussion
tails_naf@yahoo
2008-10-02, 14:07
Good Idea, I'll do a comprehensive check for you and report back asap (hopefully after work tonight!)
tails_naf@yahoo
2008-10-03, 00:45
I did a little digging on this -
Is there a way to upload screenshots here? I took screen dumps showing the frame-rate.
Anyway -
clip1- the office - xvid 624x352 - 24fps clip
clip2- iron man - xvid 640x252 - 24fps
Play both clips with upscaling for SD content-
clip 1: fps 19.5 - cpu % was fluctuating but max seen was 80%
clip 2: fps 23.95 - cpu 45%
turn off upscaling
clip1: fps 23.95 - cpu 9%
clip2: fps 23.95 - cpu 10%
system -ubuntu 8.04 32-bit - compiled from svn (updated yesterday), intel Q6600 (core2 quad, 2.6Ghz), ATI 4850 HD, 4 Gb ram (1gb sticks).
codes were installed from apt-get install (w32codecs).
Are there any special compile options I could try out to make this perform a bit better? Any other suggestions?
we don't use any external codecs, we only use ffmpeg.
which upscale option are you using ?
what brand & model of GFX card ?
tails_naf@yahoo
2008-10-03, 01:16
I used the bicubic upscaling.
sinc - 5fps!
lanzcos - 15fps
Is this exepected?
maybe the cpu is a factor..REALLY surprising. I would have thought a core2 quad could do it. The code may not be multi-threaded, and I definitely did not compile with any mult-core options (if there are any).
I have an ATI 4850 HD card with 256Megs. Using catalyst 8.8 binary drivers.
I am seeing similar issues with my videos now that I didn't used to see before - I'm not sure what's going on. Video that used to be perfectly smooth not judders during fast movements - but I never drop a frame. I have also suddenly lost stereo audio - surround works. Not sure what happened with this. Last but not least errors about inefficient VFW B frames have shown up in my logs and XBMC will crash to the desktop on some vids. This is all pretty weird afterhaving a system that worked great for so long :(
Edit: Made some changes... Fixed audio by following the sticky (http://xbmc.org/forum/showthread.php?t=35901). Not ever had it screw up that way before. Now the music works again and doesn't crash - weird. I turned off V-sync in XBMC and that SEEMS to have helped the juddering. I will have to screw with it more though to be sure, my eyes are buggy from looking at this!
In my experience, issues with HQ SW upscale is either
*Slow Shared (unified, shared cpu and gpu) Ram Memory
&/
*Slow Bus to said Ram
&/
*Crap Drivers
tails_naf@yahoo
2008-10-03, 04:03
I don't think I qualify for the first two. Sure a 2.6GHz processor is not blinding, but it should be decent. No shared memory. Dedicated high-end GPU (not sure if it is utilized for upscaling function though), memory bus should be dual channel, and runs at high fsb freq.
as for crap drivers - anyone else having trouble with the ATI catalyst drivers? should I leave the render mode to 'autodetect' - or force one of the other modes?
In my experience, issues with HQ SW upscale is either
*Slow Shared (unified, shared cpu and gpu) Ram Memory
&/
*Slow Bus to said Ram
&/
*Crap Drivers
Pike, it's neither of those .... I don't know exactly when, but upscaling is completely broken for me since a few weeks. That's a fact. I can use either my onboard ATI3200 or a Nvidia 8500GT. Both on latest drivers, as soon as I enable upscaling, I get no more than 16FPS, preiod.
Before I didn't have ANY issues with upscaling enabled. Everything I threw at XBMC played perfectly fine with upscaling enabled.
Something must have changed in the code that causes this.
Right now I am running today's SVN, and the issue is still very present.
boba
Maybe you can go back and build older builds to see which revision caused the regression. And then somebody can possibly look into it if you identify after which change the issue started to occur.
Thanks.
Hey tslayer, if I find the time ... sure. But one more thing, is this behavior limited to a few people or do you and others see those problems with upscaling as well?
boba
Another thing I can tell ya, which also tells me, that something must be wrong with upscaling .... I built from svn for windows today, too. Testing that build on my notebook right now. Enabling upscaling there results in another weird behavior. Movie runs at normal speed, 24fps, but the picture is like zoomed in 200% :-) Disabling upscaling brings things back to normal ... very weird.
boba
Alright, I am testing older builds right now, I chose 4 day steps going back, using svn --revision {date}.
I have narrowed down the change to between 2008-09-11 and the Beta 1 Build.
With 2008-09-11 (Revision 15508) upscaling works perfectly fine. I got it set to "Always enabled, Bicubic". With Beta 1 Upscaling plays movies at 12-16 FPS max.
I am compiling rev. 15530 right now, will increase by day steps till I find the revision that stops working ...
boba
Ok, sw upscaling stopped working after a change between 2008-09-11 and 2008-09-12.
SVN rev. 15508 still works fine with SW upscaling on, rev. 15530 shows the above described poor video playback at max. 12 FPS.
Could you guys take a look at the changes on that day?
boba
Great work! That should help a lot.
Thanks!
Hmm.. Odd. The only thing that looks like it could have made a difference (and that is a stretch) is change 15517.
Can you sync up to the latest revision and then just revert the change # 15517 ?
See if that makes any difference?
Hmm.. Odd. The only thing that looks like it could have made a difference (and that is a stretch) is change 15517.
Can you sync up to the latest revision and then just revert the change # 15517 ?
See if that makes any difference?
I also took a quick look at the files involved, only thing I saw was some swscale ... .macosx thingy. But that one shouldn't influence Linux behavior, right? Will try later to svn up to 15517.
boba
tslayer, 15517 still works fine with sw upscaling on ...
want me to got further back again rev by rev?
boba
Yes please. Hard to believe any of the other changes between 15517 and 15530 would cause it. But please try to pinpoint.
Thanks!
You have been right tslayer.
15516 still works, 15517 does NOT. Only change in svn I see is "configure" and "configure.in"
here's the diff for "configure" if that helps you in any way:
boba@alderan:~/temp$ diff -upN configure-15516 configure-15517
--- configure-15516 2008-10-04 16:42:24.000000000 +0200
+++ configure-15517 2008-10-04 16:43:42.000000000 +0200
@@ -14882,7 +14882,7 @@ fi;
if [ -d xbmc/cores/dvdplayer/Codecs/ffmpeg ]; then
pushd xbmc/cores/dvdplayer/Codecs/ffmpeg
- ./configure \
+ ./configure \
--extra-cflags="-D_XBOX" \
--disable-static \
--disable-altivec \
@@ -14901,6 +14901,7 @@ if [ -d xbmc/cores/dvdplayer/Codecs/ffmp
--enable-swscale \
--enable-protocol=http \
--enable-pthreads \
+ --extra-cflags="-DRUNTIME_CPUDETECT -O3"
if [ $? -ne 0 ]; then
popd
@@ -14994,7 +14995,8 @@ if [ -d xbmc/cores/dvdplayer/Codecs/libf
./configure \
--with-pic \
- --with-mp4v2
+ --with-mp4v2 \
+ CFLAGS="-O3"
if [ $? -ne 0 ]; then
popd
@@ -15049,7 +15051,6 @@ if [ -d xbmc/cores/dvdplayer/Codecs/libm
--disable-directx \
--disable-sdl \
--without-x \
- CFLAGS=-fPIC
if [ $? -ne 0 ]; then
popd
boba
Okay.. So it was that change.. Which means the "optimizations" did not optimize for upscaling :)
That's what I thought ;-) I just wonder why almost no one else notices, or doesn't have anybody upscaling enabled?
boba
tslayer, could this be due to this GCC bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36235
It is possible :)
Maybe if you upgrade gcc and test we will know for sure right? :)
Actually, not sure it is that because the real only change here was the RUNTIME_CPUDETECT.
The -O3 happened anyways.
Well sorry tslayer, but I am not gonna compile and install a newer gcc version manually. I am afraid that might have more implications on my ubuntu install than I like :-)
Anyway ... I guess we can tell pretty exactly where the change occured. 15516 works, 15517 does not. Sounds pretty clear to me. Whatever the exact reason now is, it is between those 2 revisions.
boba
Yep... Agreed.
Guessing it must be the RUNTIME_CPUDETECT.
What I am trying right now is to compile with O2 instead of O3 opt level. See if that makes any difference.
boba
Try instead without the RUNTIME_CPUDETECT. Keep everything else.
ok, next build will be that way, my O2 build is almost done ....
That's it tslayer. RUNTIME_CPUDETECT. Took it out of configure and voila, 15517 works like a charm with sw upscale enabled :-)
Will now do a clean svn from today with RUNTIME_CPUDETECT taken out.
Thanks for your help ... will that option be taken out of svn then?
boba
Not sure.. it will need a discussion with the team :)
tails_naf@yahoo
2008-10-05, 20:58
Guys, this was excellent detective work. I am impressed by the dedication involved in narrowing it down.
I will give the gcc flag a try too (hopefully soon), and report back.
Just so I'm clear - what change must be made to what file, for this to work?
Are there other ways to optimize the build with gcc flags? I'm no 32 bit ubuntu, with an intel core 2 quad ..(Q6600)
Cheers,
John
After SVN checkout modify the files
configure and configure.in
in your XBMC root directory.
Look for the line containing
--extra-cflags="-DRUNTIME_CPUDETECT -O3"
and remove -DRUNTIME_CPUDETECT so that there's just -O3 left between the quotes.
boba
It's in SVN already. Just svn up.
tails_naf@yahoo
2008-10-06, 00:23
It seem the svn version has dropped the -O3 part also - is that supposed to be the case, it seems at odds with what bobba was saying...
tails_naf@yahoo
2008-10-06, 00:36
On the topic of optimizations....
I was recompiling and I saw that different -Ox options are used for different modules, for example, ffmpeg seems to be using -o0 ... Surely O3 would be better?
Before recompiling I did:
make clean
edit configure/configure.in as above (left -O3 in there)
./configure
make
So would you expect ffmpeg to have used o0 ?
Cheers
John
It seem the svn version has dropped the -O3 part also - is that supposed to be the case, it seems at odds with what bobba was saying...
http://xbmc.svn.sourceforge.net/viewvc/xbmc/branches/linuxport/XBMC/configure?view=log
"reverted: FFMpeg "optimizations" from r15517 under linux. -DRUNTIME_CPUDETECT causes high CPU usages and stuttering with upscaling enabled. -O3 is enabled by FFMpeg by default."
Seems -O3 isn't needed in configure for that.
boba
althekiller
2008-10-06, 01:08
I just checked and ffmpeg is built entirely with -O3 as per default ffmpeg configure (it is disabled with the --disable-optimizations configure flag).
tails_naf@yahoo
2008-10-06, 12:33
I'll re-compile and dump a logfile.
While it was compiling last night, I was sure I saw some
ff<blah>.c ....... -O0 ........
in the output, which caused me to post the message.
If I get proof from my compile I'll post the log.
Configure definitely was not run with --disable anything, I run it completely without options.