[gst-devel] Video Hackfest conclusions
Julien Isorce
julien.isorce at gmail.com
Thu Nov 26 11:16:56 CET 2009
Hi,
I have a comment about this:
(From http://gstreamer.freedesktop.org/wiki/VideoHackfest/Conclusions:)
"The GLX specification does not allow binding the same GLX context in
multiple threads at the same time. This is a requirement for both Cairo's
and GStreamer's threading model. An extension was proposed and initial code
developed to support this requirement in the same way as Apple's GL does by
default. Windows does not support this and would require potentially
expensive fallback code."
-->The other solution would be to use OpenGL context sharing. But it
requires to have this:
(from http://gstreamer.freedesktop.org/wiki/VideoHackfest/Notes)
"Eric: One thing I'd like is if two neighboring elements could determine
whether they are running in the same thread"
I already asked gstreamer developers in the past to add support for this but
this is not an easy task and only useful for opengl right now.
The result would be to remove this :
(from http://gstreamer.freedesktop.org/wiki/VideoHackfest/Notes)
"So what gst-plugins-gl does is to proxy all OpenGL communication
through a single
thread associated with the context"
For example in the pipeline:
videotestsrc ! glupload ! glfilterA ! queue ! glfilterB ! glimagesink
It would have one opengl context for glupload ! glfilterA since their chain
func is running in the same thread (if the user does not manually push
buffer itself form an other thread, I do not know all the possible case but
we could ensure that they are running in the same thread).
This opengl context would be shared with the opengl context used by
glfilterB ! glimagesink
Moreover, thoses 2 opengl contexst (shared together) could work at the same
time (they would work on different textures at the same time)
And so no need the overhead due to the gl thread is avoid, (and the property
"each opengl context is made current only one time" is kept. Note that this
property is already true in the current gst-plugins-gl implementation)
I have already demonstrated the validity of using OpenGL context sharing in
the implementation of the glmixer base class.
The glmosaic element (which will be renamed to glmixercube) is a glmixer.
(availaible in gst-plugins-gl/git)
For example in the following pipeline:
videotestsrc ! glupload ! glfilterA ! queue ! glmixer name=m ! glfilterC !
glimagesink
glupload ! glfilterB ! queue ! .m
There are 3 opengl contexts shared together. (there is a glthread per opengl
context)
One used by glupload ! glfilterA, one other for glupload ! glfilterB, and a
last one used by glmixer ! glfilterC ! glimagesink
Finally, if we would have the following support:
"Eric: One thing I'd like is if two neighboring elements could determine
whether they are running in the same thread"
We could avoid the use of the a thread per opengl context.
Moreover it would not need what you suggested:
"The GLX specification does not allow binding the same GLX context in
multiple threads at the same time"
Well, internally, maybe the mecanism/result is exactly the same:
I mean, maybe binding the same GLX context in multiple threads at the same
time is equivalent to have several opengl contexts shared together and each
one used in only one thread (a gstreamer streaming thread).
If this is really equivalent (at least for our use) maybe it would be more
portable to use the context sharing solution, because the feature is already
there.
Actually I think using opengl context sharing is more efficient because
several context can be used at the same time. (not possible with the same
context in multiple-thread. Well it depends on the implementation that you
are going to do)
I could help in the future about that:
(from http://gstreamer.freedesktop.org/wiki/VideoHackfest/Conclusions)
"Actions:
- Get review of cairo-gl/gst-plugins-cairo code from gst-plugins-gl
developers
- Port gst-plugins-gl elements to use Cairo early to ensure required
features are available"
Sincerely
Julien Isorce
2009/11/24 Benjamin Otte <otte at gnome.org>
Hi,
>
> As you may be aware, we held a video hackfest last week in Barcelona.
> Developers met to discuss how best to improve GPU support for video
> applications. See http://gstreamer.freedesktop.org/wiki/VideoHackfest
> for more details. In particular, you might be interested in the notes
> some people took while the hackfest was going on. These can be found
> at http://gstreamer.freedesktop.org/wiki/VideoHackfest/Notes
>
> What follows is the results we arrived at after the hackfest. They are
> taken from http://gstreamer.freedesktop.org/wiki/VideoHackfest/Conclusions
> but certainly deserve wide circulation. We're interested in any
> comments (or questions) you might have about them, so please don't
> heistate to reply.
>
> If you do reply, please make sure to reduce the recipient list
> appropriately.
>
> Cheers,
> Benjamin,
>
> on behalf of all hackfest paticipants.
>
>
> == YUV in pixman ==
> It has been a goal for a while to make video a first-class citizen in
> the image stack. A concrete API proposal on how to integrate video
> into pixman was reached and reviewed.
> Links:
> * http://gstreamer.freedesktop.org/wiki/VideoHackfest/YCbCr_Formats
> * http://gstreamer.freedesktop.org/wiki/VideoHackfest/pixman
> Actions:
> * GStreamer developers to provide a specification of important YUV formats
> * Write implementation
>
> == YUV in Cairo ==
> To make it easy for applications to use these different formats, the
> Cairo API needs to be extended to allow them. A proposal does exist
> and has been reviewed, details need to be finalized.
> Links:
> * http://gstreamer.freedesktop.org/wiki/VideoHackfest/Cairo
> Actions:
> * Finalize proposal
> * Write implementation
>
> == locking in Cairo ==
> GStreamer takes a lot of freedom in deciding which threads to schedule
> elements in. Most hardware backends however require proper
> serialization of commands. The current gst-plugins-cairo and
> gst-plugins-gl code provide different, but ugly ways to achieve this.
> Cairo's internal thread safety guarantees match these requirements
> very well. But the different Cairo backends don't always keep these
> guarantees. Interaction with these locking mechanisms from outside
> applications is not possible yet either.
> Links:
> * http://gstreamer.freedesktop.org/wiki/VideoHackfest/Cairo
> Actions:
> * Improve Cairo backend implementations, in particular X11 and GL
> * Expose Cairo's locking API to allow interaction with it
> * Write testcases to squash bugs
>
> == locking in Mesa ==
> The GLX specification does not allow binding the same GLX context in
> multiple threads at the same time. This is a requirement for both
> Cairo's and GStreamer's threading model. An extension was proposed and
> initial code developed to support this requirement in the same way as
> Apple's GL does by default. Windows does not support this and would
> require potentially expensive fallback code.
> Links:
> * http://people.freedesktop.org/~anholt/MESA_multithread_makecurrent.spec<http://people.freedesktop.org/%7Eanholt/MESA_multithread_makecurrent.spec>
> Actions:
> * Get review for suggested extension and include it in future Mesa
> releases
> * Make Windows developers investigate the situation
>
> == switch GStreamer to Cairo as default video transport model ==
> The current approach to handling video in GStreamer is very outdated.
> It does not allow hw-accelerated buffers nor does it provide a unified
> API to modify video buffers, which leads to fragmentation and
> duplication. It was agreed that using Cairo to provide an abstraction
> as a drawing API and abstraction over different backends was a good
> idea.
> Links:
> * http://gstreamer.freedesktop.org/wiki/VideoHackfest/Notes
> * http://cgit.freedesktop.org/~company/gst-plugins-cairo<http://cgit.freedesktop.org/%7Ecompany/gst-plugins-cairo>
> Actions:
> * Rework gst-plugins-cairo to match improvements listed in previous points
> * Get more review on API and to avoid regressions
> * Merge into gst-plugins-base
> * Switch plugins gradually to use new Cairo code
>
> == gst-plugins-gl ==
> The general consensus was that gst-plugins-gl is a hack. It was
> necessary in the past to get things to work, but is not a good way
> forward. However, the functionality or performance provided by the
> current elements needs to continue working. Developers shared the
> opinion that gst-plugins-cairo with cairo-gl surfaces is the best way
> to achieve this.
> Links:
> * http://gstreamer.freedesktop.org/wiki/VideoHackfest/Notes
> Actions:
> * Get review of cairo-gl/gst-plugins-cairo code from gst-plugins-gl
> developers
> * Port gst-plugins-gl elements to use Cairo early to ensure required
> features are available
>
> == XRenderPutImage ==
> Currently there is no way to upload video data to the X server for
> later use. The XV extension is not sufficient for anything more
> complicated than a simple video player.
> Links:
> * http://gstreamer.freedesktop.org/wiki/VideoHackfest/Cairo
> Actions:
> * Figure out the best way to move YUV data into hw-accelerated Cairo
> surfaces (GL vs X)
> * Possibly draft an extension to XRender to handle this in the no-GL case
>
> == JIT in Pixman ==
> ORC was investigated as a potential JIT for pixman. A lot of talk has
> happened, but no clear conclusions were reached. The idea to share a
> JIT with Mesa's GLSL stack was also brought up.
> Links:
> * http://gstreamer.freedesktop.org/wiki/VideoHackfest/Notes
> Actions:
> * Continue investigating JIT options
> * Prototype ORC integration into Pixman
>
> == Video decoding Acceleration ==
> Hardware video decoding is a feature that everybody is very excited
> about and wants to integrate into GStreamer as soon as possible. But
> developers feel that the current APIs available - the focus was on
> VAAPI and VDPAU - to do hardware acceleration fail to integrate well.
> No developer managed to create even demo-quality integration with
> gst-plugins-cairo, even though quite a few tried. In particular, both
> VDPAU and VAAPI...
>
> ... do not integrate with existing frameworks
> Both libraries fail to use (or allow easy conversion to) existing
> objects (GEM handles, GL textures, ...) but only provide access to an
> encapsulation. This makes it hard for a flexible framework like
> GStreamer to make use of its features without limiting itself.
>
> ... do not have a clear scope
> In particular VDPAU advertises itself as a video playback framework
> using hardware acceleration. Unfortunately, they both limit themselves
> to only the formats and functionalities supported by the hardware and
> see fullscreen video playback as the single usecase. This needlessly
> complicates integration with existing frameworks
>
> ... provide a very complicated API
> For decoding video, an API like provided by libtheora, libmpeg2 or
> even ffmpeg is very simple and allows easy integration with both the
> demuxing and the postprocessing/display side. VAAPI and VDPAU require
> complex setups and preprocessing of the data to work properly.
>
> ... overlap with GL functionality
> It was felt that a lot of processing features provided by these
> libraries are equally well available using shaders in GL or by
> providing GL extensions. It was unclear why it is necessary to use a
> separate way to do this.
>
> Links:
> * http://gstreamer.freedesktop.org/wiki/VideoHackfest/Notes
> *
> http://gstreamer.freedesktop.org/wiki/VideoHackfest?action=AttachFile&do=view&target=VAinGST.pdf
> Actions:
> * Get in contact with developers of the APIs
> * Encourage revision of public
> * Work closer together in integrating the provided functionality into
> GStreamer
>
> = Timeline =
> The end goal of all of this is to get the code into users' hands
> quickly, but allow a smooth and non-disrupting upgrade. Desired dates
> have been put forth to achieve this:
> * End of January: release new versions of Cairo and Pixman that
> contain the new APIs reuired by GStreamer
> * End of March: X server and Mesa releases are due - make sure the
> required Mesa extension is part of this. Ideally XrenderPutImage would
> be included, too.
> * April/May, after next Fedora/Ubuntu releases: Merge Cairo support
> into gst-plugins-base and start porting elements to it. Encourage
> application developers (browser, Flash players) to make use of the new
> APIs
> * October: another Fedora/Ubuntu release that switches all users to
> the new APIs
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20091126/2a1f1c09/attachment.htm>
More information about the gstreamer-devel
mailing list