plugins: check if negotiate dmabuf with downstream

In order to enable, in the future, dmabuf-based buffers, the vaapi base
plugin needs to check if downstream can import dmabuf buffers.

This patch checks if downstream can handle dmabuf, by introspecting the
shared GL context. If the GL context is EGL/GLES2 and have the extension
EGL_EXT_image_dma_buf_import, then dmabuf can be negotiated.

Original-patch-by: Julien Isorce <j.isorce@samsung.com>
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-06-02 22:13:51 +02:00
parent 33af1fc578
commit 37b7743934
2 changed files with 10 additions and 1 deletions

View file

@ -1103,8 +1103,14 @@ gst_vaapi_plugin_base_set_gl_context (GstVaapiPluginBase * plugin,
display_type = GST_VAAPI_DISPLAY_TYPE_GLX; display_type = GST_VAAPI_DISPLAY_TYPE_GLX;
break; break;
#endif #endif
#if USE_EGL
case GST_GL_PLATFORM_EGL: case GST_GL_PLATFORM_EGL:
#if VA_CHECK_VERSION (0,36,0) && USE_GST_GL_HELPERS
plugin->srcpad_can_dmabuf =
(!(gst_gl_context_get_gl_api (gl_context) & GST_GL_API_GLES1)
&& gst_gl_context_check_feature (gl_context,
"EGL_EXT_image_dma_buf_import"));
#endif
#if USE_EGL
display_type = GST_VAAPI_DISPLAY_TYPE_EGL; display_type = GST_VAAPI_DISPLAY_TYPE_EGL;
break; break;
#endif #endif

View file

@ -87,6 +87,8 @@ typedef struct _GstVaapiPluginBaseClass GstVaapiPluginBaseClass;
(GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_caps) (GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_caps)
#define GST_VAAPI_PLUGIN_BASE_SRC_PAD_INFO(plugin) \ #define GST_VAAPI_PLUGIN_BASE_SRC_PAD_INFO(plugin) \
(&GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_info) (&GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_info)
#define GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAN_DMABUF(plugin) \
(GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_can_dmabuf)
#define GST_VAAPI_PLUGIN_BASE_DISPLAY(plugin) \ #define GST_VAAPI_PLUGIN_BASE_DISPLAY(plugin) \
(GST_VAAPI_PLUGIN_BASE(plugin)->display) (GST_VAAPI_PLUGIN_BASE(plugin)->display)
@ -146,6 +148,7 @@ struct _GstVaapiPluginBase
GstCaps *allowed_raw_caps; GstCaps *allowed_raw_caps;
GstAllocator *sinkpad_allocator; GstAllocator *sinkpad_allocator;
GstAllocator *srcpad_allocator; GstAllocator *srcpad_allocator;
gboolean srcpad_can_dmabuf;
}; };
struct _GstVaapiPluginBaseClass struct _GstVaapiPluginBaseClass