Sharing EGL context with glimagesink

Jorge Fernandez Monteagudo jorgefm at cirsa.com
Wed Oct 7 07:51:06 PDT 2015


Thanks Matt! The note do the trick :)

I was using GST_GL_API_GLES1 API. I've converted my little app to ES2.0 and now it works...
Well I've to paint the glimagesink texture in the 'client-draw' callback but it works. Now I'll try to
found a way to save the texture and paint it in my drawing loop.

________________________________________
From: Matthew Waters [ystreet00 at gmail.com]
Sent: Wednesday, October 07, 2015 4:27 AM
To: Jorge Fernandez Monteagudo; gstreamer-devel at lists.freedesktop.org
Subject: Re: Sharing EGL context with glimagesink

On 06/10/15 23:52, Jorge Fernandez Monteagudo wrote:

Hi,

I'm trying to share the main EGL context from my application and the glimagesink element
from the pipeline I'm implementing, using the 'other-context' field. I'm trying to paint the
texture with the video frame with my code.


glimagesink in 1.6 does not have an 'other-context' property anymore and so that information needs to be provided with GstContext. See <http://ystreet00.blogspot.com.au/2015/09/gstreamer-16-and-opengl-contexts.html> http://ystreet00.blogspot.com.au/2015/09/gstreamer-16-and-opengl-contexts.html for the details.


Now I have the next vars initialized ok (I can paint using gl commands)

EGLDisplay dpy;
EGLSurface surface;
EGLContext context;


The question is if you can actually simply use the EGLDisplay without first going through the winsys, wayland/X11/dispmanx/etc.  Android is the only platform that I know of that will allow using the EGLDisplay natively without first having an existing display connection.  Essentially you must pass the winsys display handle if you have it over the EGLDisplay handle.


and the 'eglMakeCurrent(dpy, surface, surface, context)' call returns success.
Then I set up the pipeline and the glimagesink with:

  GstGLDisplay *glDisplay;
  GstGLContext *glContext;
 ...

  // Set glimagesink gl context.
  eglMakeCurrent( dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
  glDisplay = (GstGLDisplay *)gst_gl_display_egl_new_with_egl_display( dpy );
  glContext = gst_gl_context_new_wrapped( glDisplay, (guintptr) context, GST_GL_PLATFORM_EGL, GST_GL_API_GLES1 );

Just a note that we don't actually support the GST_GL_API_GLES1 API.  If you're actually using GLES1-only api calls I'm afraid this will not work at all.

That should help you along the way.

Cheers
-Matt


  g_object_set( G_OBJECT(glimagesink), "other-context", glContext, NULL );
  eglMakeCurrent( dpy, surface, surface, context );
  printf( "glDisplay=%p   glContext=%p\n", glDisplay, glContext );

When I run the code I see the printf trace

glDisplay=0x24c78   glContext=0x255848

and the backtrace

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x713fc460 (LWP 15929)]
__glInitFramebufferStates (gc=gc at entry=0x37b2ec) at src/glcore/gc_es_fbo.c:998
998     src/glcore/gc_es_fbo.c: No such file or directory.
(gdb) bt
#0  __glInitFramebufferStates (gc=gc at entry=0x37b2ec) at src/glcore/gc_es_fbo.c:998
#1  0x768cba1c in __glInitContextState (gc=gc at entry=0x37b2ec) at src/glcore/gc_es_context.c:702
#2  0x768cc048 in __glCreateContext (clientVersion=<optimized out>, imports=0x713fbc88, sharedCtx=0x22e974) at src/glcore/gc_es_context.c:1043
#3  0x76d1b504 in _CreateApiContext (Thread=Thread at entry=0x262204, Context=Context at entry=0x37b1cc, Config=0x1b5f0c, Config at entry=0x31be, SharedContext=0x22e974)
    at gc_egl_context.c:593
#4  0x76d1bdf4 in eglCreateContext (Dpy=0x1b4204, config=<optimized out>, SharedContext=0x1b77dc, attrib_list=0x713fbd6c) at gc_egl_context.c:1385
Backtrace stopped: Cannot access memory at address 0x302a


Any hint?

Regards


Este mensaje se dirige exclusivamente a su destinatario y puede contener información privilegiada o CONFIDENCIAL. Si no es vd. el destinatario indicado, queda notificado de que la utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción.

This message is intended exclusively for its addressee and may contain information that is CONFIDENTIAL and protected by professional privilege.
If you are not the intended recipient you are hereby notified that any dissemination, copy or disclosure of this communication is strictly prohibited by law. If this message has been received in error, please immediately notify us via e-mail and delete it.




More information about the gstreamer-devel mailing list