GNOME Bugzilla – Bug 773453
vaapi: support GLTextureUpload for EGL/Wayland
Last modified: 2017-11-08 09:24:59 UTC
Currently, there are a couple of issues on gstreamer-vaapi, specifically running on Wayland https://bugzilla.gnome.org/show_bug.cgi?id=772838 https://bugzilla.gnome.org/show_bug.cgi?id=770025 On X11, vaapi can create proper GLX context by itself. But in case of EGL/Wayland, AFAIK, no. To make it working through GLTextureUploadMeta, vaapi elements need GL context /display to upload. If cluttersink can pass this information to upstream, gst-vaapi could use this info and make it working. What do you think? Or if there is other solution for this, that would be welcome!
What do think about the dmabuf support? There are patches floating around (for Cogl and ClutterGst). It seems like a much better way of exchanging buffer.
(In reply to Lionel Landwerlin from comment #1) > What do think about the dmabuf support? > There are patches floating around (for Cogl and ClutterGst). It seems like a > much better way of exchanging buffer. It could be much better than using GLTextureUploadMeta for sure, once it get started to work :) Need to discuss with Victor or Jullien, who are working on handling dmabuf on gst-vaapi.
Hi Lionel, Julien and I are working on dmabuf support for downstream in gstreamer-vaapi. We already have working branches for it, but we are waiting for the merge of the new caps feature memoy:dmabuf (bug 759358) and the having an vaapi-dmabuf allocator. These changes are going to be merged after the release 1.10 Do you have a branch with the patches needed for cluttersink in order to test?
Hi Victor, Here is the Cogl branch (just a single commit) : https://github.com/djdeath/cogl/tree/texture-dmabuf And the corresponding ClutterGst branch : https://github.com/djdeath/clutter-gst/tree/dmabuf
Created attachment 356914 [details] [review] gstreamer-vaapi-EGL-GLTextureUpload-2f368a4d.patch Here's a patch for gstreamer-vaapi that implements the EGL-GLTextureUpload path. This completely fixes bug 773453 and bug 784369. As an added bonus, it also helps to reduce the problem of bug 783850, but more work will be required on that one.
Created attachment 362733 [details] [review] libs: surface: egl: error message if no extension Instead of silently fail to export the image if there is not available the EGL_MESA_drm_image, log an error message. Also a code refactoring was done.
Created attachment 362734 [details] [review] libs: texture: egl: code style
Created attachment 362735 [details] [review] libs: display: egl: free leaked memory The EGL VAAPI display forgot to release the egl display, context and proxied VAAPI display.
Created attachment 362736 [details] [review] plugins: fix memory leak when GL context is created When the GL display and context are created inside an VAAPI element the created GL context is leaked.
Created attachment 362737 [details] [review] plugins: set GL objects if context is handled Only set the GL display and GL other context if they are extracted correctly from the gstreamer's context.
Created attachment 362738 [details] [review] plugins: set GL objects if ensured Only set the GL display and GL other context if they are ensured.
Created attachment 362739 [details] [review] plugins: centralize assignation of GL objects Add plugin_set_gst_gl() where the GstGL objects are assigned.
Created attachment 362740 [details] [review] libs: texture: egl: update EGL display and context It is required to use the context of the calling thread when wrapping a foreign texture. According the documentation of GstVideoGLTextureUploadMeta: "The caller of gst_video_gl_texture_upload_meta_upload() must have OpenGL set up and call this from a thread where it is valid to upload something to an OpenGL texture." This patch updates the EGL display and context in GstVaapiDisplay instance to the one used by te renderer that uploads the texture. Original-patch-by: Daniel van Vugt <daniel.van.vugt@canonical.com>
Created attachment 362741 [details] [review] libs: display: egl: add gst_vaapi_display_egl_set_current_display() Adds a new function that changes the internal EGL display to the current one (eglGetCurrentDisplay()) and sets the current context too (eglGetCurrentContext()). This new function is called by gst_vaapi_texture_egl_create() updating the GstVaapiDisplayEGL with the current EGL display.
Created attachment 362803 [details] [review] libs: display: egl: add gst_vaapi_display_egl_set_current_display() Adds a new function that changes the internal EGL display to the current one (eglGetCurrentDisplay()) and sets the current context too (eglGetCurrentContext()). This new function is called by gst_vaapi_texture_egl_create() updating the GstVaapiDisplayEGL with the current EGL display.
Created attachment 363066 [details] [review] libs: surface: egl: add comment Add a warning comment when using old intel-vaapi-drivers (>1.8.4), where the creation of surfaces from GEM fd may fail.
Attachment 362733 [details] pushed as ea503ed - libs: surface: egl: error message if no extension Attachment 362734 [details] pushed as 0840c08 - libs: texture: egl: code style Attachment 362735 [details] pushed as ac31160 - libs: display: egl: free leaked memory Attachment 362736 [details] pushed as 4866e4c - plugins: fix memory leak when GL context is created Attachment 362737 [details] pushed as fc1c415 - plugins: set GL objects if context is handled Attachment 362738 [details] pushed as 3d56306 - plugins: set GL objects if ensured Attachment 362739 [details] pushed as 8092537 - plugins: centralize assignation of GL objects Attachment 362740 [details] pushed as 98a136a - libs: texture: egl: update EGL display and context Attachment 362803 [details] pushed as 429e800 - libs: display: egl: add gst_vaapi_display_egl_set_current_display() Attachment 363066 [details] pushed as e1f9959 - libs: surface: egl: add comment
Still to make it work in mutter for clutter-gst it is needed to export GST_GL_WINDOW=wayland to avoid the automatic detection which goes with XWayland.