opengl context sharing with gstreamer
Matthew Waters
ystreet00 at gmail.com
Fri Sep 17 06:20:59 UTC 2021
1. Don't do 'gst_gl_display_egl_new_with_egl_display()' yourself
manually. You want to use gst_gl_display_egl_from_gl_display() from the
X11-wrapped GstGLDisplay.
2. You are creating an OpenGL ES 2.0 context but not advertising that to
GStreamer with gst_gl_display_filter_gl_api(). GStreamer may be
creating another context type. GST_DEBUG=3.gl*:7 will tell you.
3. You are not using the OpenGL context-specific function pointers.
Each OpenGL context can return completely different OpenGL function
pointers that are specific to each OpenGL context. Calling the wrong
function pointers is undefined behaviour. This is
gst_gl_context->gl_vtable for GStreamer.
4. There is no need to call gst_gl_context_activate() in
save_gst_tga(). gst_gl_context_thread_add() runs your function on the
correct thread with the correct OpenGL context current already. If you
change that, you must reset of course.
5. A gl tracing tool would also help you drill down into exactly what is
happening. e.g. apitrace.
Cheers
-Matt
On 17/9/21 2:23 am, Lusine Hayrapetyan via gstreamer-devel wrote:
> Hi Folks,
>
> I'm experimenting with gstreamer context sharing mechanism.
> I have /EGLContext context; /and creating gstreamer shared context
> from it with gst_gl_display_create_context()
>
> Then I want to access the texture which is created in /EGLContext/
> from gstreamer shared context.
> That is why I'm using gst_gl_context_thread_add to activate shared
> context and save the texture:
>
> gst_gl_context_thread_add(
> state->sharedContext,
> (GstGLContextThreadFunc)save_gst_tga,
> state
> );
>
> // Activate gstreamer context and save the texture to tga file.
> static bool save_gst_tga(GstGLContext * context, APP_STATE_T * state)
> {
> if (!gst_gl_context_activate(state->sharedContext, true))
> g_print("gst_gl_context_activate(true) returned error %d\n",
> eglGetError());
>
> // Gstreamer context is activated in gstreamer thread, now save
> the texture.
> // But this produces an empty file!!!
> return save_tga(state, "tga_file_gst.tga");
> }
>
> In save_gst_tga I activate gstreamer shared context and save the
> texture but it's empty. Am I missing something?
> I've posted the whole code here:
> https://github.com/LusineH/gstreamer_shared_context/blob/main/testegl.c
> <https://github.com/LusineH/gstreamer_shared_context/blob/main/testegl.c>
>
> Regards,
> Lusine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210917/1a14095f/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210917/1a14095f/attachment-0001.sig>
More information about the gstreamer-devel
mailing list