GNOME Bugzilla – Bug 788503
fix the check for dmabuf handling in downstream
Last modified: 2017-10-21 10:52:55 UTC
Intially the check if the sink could handle dmabuf importing, it was in the function gst_vaapi_plugin_set_gl_context() since it was only called by decide_allocation() vmethod, when GstGLUploadTexture feature was negotiated. Later, when the vaapi elements create their own GL context, if there is none in the pipeline, gst_vaapi_plugin_set_gl_context() was called, breaking the intent of the original function. Thus dmabuf handeling in dowstream is true if the GstGLContext (created or shared) is capable, but not restricted to downstream. The following patch serie fix that problem.
Created attachment 360897 [details] [review] plugins: add gst_vaapi_plugin_base_set_srcpad_can_dmabuf() This patch refactors the code by adding the function vaapi_plugin_base_set_srcpad_can_dmabuf(), it determines if the passed GstGLContext can handle dmabuf-based buffers. The function is exposed publicly since it is intended to be used later at GstVaapiDisplay instantiation.
Created attachment 360898 [details] [review] vaapivideocontext: return the direction of gl context In function gst_vaapi_find_gl_context() add a direction parameter to return back the direction where the GstGL context was found. This is going to be useful when checking if downstream can import dmabuf-based buffers.
Created attachment 360899 [details] [review] vaapivideocontext: add inline documentation Document function gst_vaapi_find_gl_local_context().
Created attachment 360900 [details] [review] plugins: only dmabuf on srcpad if downstream Set if source pad can handle dmabuf only if the GstGL context comes from downstream. It is possible to know that at two moments: 1\ In the case of GstGLTextureUpload caps feature is negotiated and downstream pool reports back gst.gl.GstGLContext. 2\ When GstGLContext is found as GstContext from dowstream.
These patches also shall be merged into branch 1.12
Created attachment 360902 [details] [review] plugins: only dmabuf on srcpad if downstream Set if source pad can handle dmabuf only if the GstGL context comes from downstream. It is possible to know that at two moments: 1\ In the case of GstGLTextureUpload caps feature is negotiated and downstream pool reports back gst.gl.GstGLContext. 2\ When GstGLContext is found as GstContext from dowstream.
Attachment 360897 [details] pushed as 998e79c - plugins: add gst_vaapi_plugin_base_set_srcpad_can_dmabuf() Attachment 360898 [details] pushed as 6b2b129 - vaapivideocontext: return the direction of gl context Attachment 360899 [details] pushed as 1135e8b - vaapivideocontext: add inline documentation Attachment 360902 [details] pushed as 0a36a70 - plugins: only dmabuf on srcpad if downstream