Hi,

vblank synchronization should work with clutter 1.6.6 and if it used to
work for your driver but only the change to clutter has caused that to
break then you may be hitting a bug in clutter. The other possibility
(especially if you have also updated your driver) is that you are
hitting a driver bug since many GL drivers are often unreliable when it
comes to vblank synchronization.

If you look at glxinfo hopefully you find that your driver supports
GLX_SGI_swap_control or GLX_MESA_swap_control since these are what Clutter
looks for.

Another thing that affects synchronization is when clutter is doing
clipped redraws. In that case the above extensions aren't enough and we
instead depend on the GLX_SGI_video_sync extension so that we can
manually wait for the vblank period. (This wouldn't have affected
earlier versions of Clutter which didn't support clipped redraws)

It might be worth running with CLUTTER_PAINT=disable-clipped-redraws to
see if throttling works correctly for fullscreen redraws. If so that
would imply a driver bug in GLX_SGI_video_sync.

For more help it would be good to know GPU and driver you are using and
what driver version.

With regards to your modification to use a swap interval of 2 so you
have a stable 30fps framerate; this is something that has been discussed
a few times but but I don't think that this is the best approach if
you want smooth animations considering the way that Clutter animations
are driven by wall clock time.

I think in some game engines it is true that framerate variation can
have a severe impact on animations since some game engines actually
update animations in step with the framerate with a fixed progression of
game time. (E.g. you used to see this kind of thing with quake such that 
animations could complete faster with a higher framerate)

Clutter doesn't do this though. Our animations are progressed when we
prepare for a new frame by explicitly seeing how much time has elapsed
since the last frame was drawn. This means that animations should
reliably elapse according to the progress of real world wall-clock time.

To get smooth animations you ideally want your framerate to be 60fps.
It's not ideal that we aren't able to hit 60fps all the time for your
application but still we should be aiming to hit the highest framerate
we can all the time that we can't hit 60fps even though it is variable.

The choppiness of an animation is going to determined by the number of
frames used for the animation, especially at the tail of some easing
curves where the animations are more subtle. There should be a
noticeable difference in smoothness between an animation managing 45fps
vs 30fps. By setting a swap interval of 2, even though we aren't
managing to hit 60fps, you're sacrificing that 45fps just to get a stable
30fps.

I hope that helps,
kind regards,
- Robert

Excerpts from Erwin Rol's message of Fri Feb 25 12:16:18 +0000 2011:
> Hey all,
> 
> I have an application where there is a timeline that updates some 
> texture positions. In the new-frame callback I also calculate the FPS. 
> This showed a nice ~60FPS with occasional drops to 45FPS. These drops 
> where visible in the movement of the textures, you could notice it was 
> not smooth. So i hacked the glx backend to use a swap interval of 2 
> instead of one. This caused the FPS to drop to a stable 30 , as expected 
> and wanted.
> 
> Now I have moved to clutter 1.6.6, and it seems the new-frame is not in 
> sync with the VBLANK. I see FPS as high as 80 and it doesn't seem to 
> matter if i set CLUTTER_VBLANK to dri, glx or none.
> 
> Is new-frame supposed to by in sync with VBLANK or was I just lucky it 
> worked like that?
> 
> Any hints on how I can debug this in case it is a bug ?
> 
> TIA,
> 
> Erwin
-- 
Robert Bragg, Intel Open Source Technology Center
_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to