[vlc-devel] [PATCH 0/3] Maintain vsync phase sync in mmal vout

Julian Scheel julian at jusst.de
Thu Sep 4 18:51:30 CEST 2014

Am 04/09/14 um 18:36 schrieb Rémi Denis-Courmont:
> Le vendredi 29 août 2014, 09:25:18 Julian Scheel a écrit :
>> For this to work I propose a vout core extension which allows vouts to
>> request a phase offset at the core, which will be applied to the picture
>> timestamps by the core.
> I don't really understand why you need to involve the core.
> If you want to submit a frame earlier than display time, you can use the
> prepare() callback, which the core calls as early as it can, but no earlier
> than the previous frame's display().
> At least VDPAU already submits the frame in prepare(). The X11 Present
> extension and the Wayland Presentation Queue, if we ever implement them, will
> do likewise.

This requires a renderer to which a frame can be handed over along with 
a desired rendering time.
While this would generally be possible with mmal using an additional 
vc.scheduler element it would complicate the vout a lot. Especially as 
that scheduler (at least if it behaves the same as it's omx companion on 
the pi does) requires something like 50 ms time between submission and 
actual rendering of a frame to work reliable. This will not work out 
when submitting in prepare() as well as the frame duration usually is 
shorter. Actually the vc.scheduler is designed to schedule multiple 
frames ahead, not single ones.

Running without a video_scheduler we have to call display() exactly at 
the time we want it to be rendered, which generally is the pts. But to 
avoid being too close to vsync we compute an offset for this.
Now applying this offset seems not possible in a sane way without 
involving the core, as we would have to block in prepare() or display() 
until the desired time has been reached, which is basically the job of 
the cores scaling code.

So basically it's a feedback loop to allow the vout to change phase 
offset between core scheduled rendering and vsync.

Any proposals for better solutions are welcome.

More information about the vlc-devel mailing list