[vlc-devel] [PATCH] splitter: use a different thread for each display
Alexandre Janniaux
ajanni at videolabs.io
Wed Dec 11 16:02:05 CET 2019
Hi,
On Wed, Dec 11, 2019 at 02:54:09PM +0100, Steve Lhomme wrote:
> On 2019-12-10 20:56, Rémi Denis-Courmont wrote:
> > Le tiistaina 10. joulukuuta 2019, 20.37.44 EET Alexandre Janniaux a écrit :
> > > Display modules are currently expected to return from display callback
> >
> > No they are not. That would never work if the video frame rate is higher than
> > the monitor's. Display callback is intended to be called near the display
> > time. Nothing requires to wait in it.
>
> In fact it's the other way around. The Prepare should have finished
> preparing everything to display the given picture. The Display should just
> do a buffer swap and return (assuming this swap actually displayed the
> picture). The core watches the time to do a Prepare and wait to call Display
> at the time the picture should be displayed.
Actually I made a mistake when writing the commit message and
confusely wrote what the OpenGL vout was doing instead of
what was required from the core. This is fixed in the last
commit.
This commit (and thread) is obsolete now. :)
>
> For this reason and the fact that D3D11 is asynchronous I have to wait in
> the Prepare until the commands I issued are actually handled, so the core
> can get a real estimation of how much time it took. (and later estimate when
> a new picture will likely won't have time to be displayed or not)
Unfortunately, OpenGL swap mechanism and VSYNC are tied and
likely different from D3D11, which might even have a more
complete set of method to present the image to the user, like
direct mode or mailbox. (Not that I know a lot from d3d11
though).
The behaviour is actually not even really specified for
OpenGL but instead for each OpenGL provider (WGL, EGL, GLX,
EAGL, CGL...) and might not even be clearly defined. Usually,
settings from the application can even be bypassed by driver
options for example.
In EGL, configuration of this behaviour is done through
eglSwapInterval [1] which specify a number of frame before
each swap. The default is 1 and some platform might even have
EGL_MIN_SWAP_INTERVAL = 1, which means that you cannot
disable it.
[1]: https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglSwapInterval.xhtml
Because it also impacts eglSwapBuffer which is the
presentation method that you must call in display, you cannot
move the sleep in the prepare method.
In addition, like I mentioned in previous mails here and
mentioned by Haasn during the vout workshop, I'm not sure we
can get correct time estimation without either impacting the
performance (with synchronization between the GPU
commandqueue and CPU code) or using timer queries which might
not be supported on every opengl driver and display have no
way to report timing in the current code.
I hope my explanation are right and clear enough,
Regards,
--
Alexandre Janniaux
Videolabs
More information about the vlc-devel
mailing list