static void open_ogl (void) { TRACE_VC_MEMORY ("state 0"); #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_EGL) bcm_host_init (); TRACE_VC_MEMORY ("after bcm_host_init"); #endif /* Start OpenGLES */ init_ogl (state); TRACE_VC_MEMORY ("after init_ogl"); /* Wrap the EGL display */ state->gst_display = gst_egl_display_new (state->display, NULL); /* Setup the model world */ init_model_proj (state); TRACE_VC_MEMORY ("after init_model_proj"); /* initialize the OGLES texture(s) */ init_textures (state); TRACE_VC_MEMORY ("after init_textures"); }
gboolean gst_egl_adaptation_init_egl_display (GstEglAdaptationContext * ctx) { GstMessage *msg; EGLDisplay display; GST_DEBUG_OBJECT (ctx->element, "Enter EGL initial configuration"); if (!platform_wrapper_init ()) { GST_ERROR_OBJECT (ctx->element, "Couldn't init EGL platform wrapper"); goto HANDLE_ERROR; } msg = gst_message_new_need_context (GST_OBJECT_CAST (ctx->element), GST_EGL_DISPLAY_CONTEXT_TYPE); gst_element_post_message (GST_ELEMENT_CAST (ctx->element), msg); GST_OBJECT_LOCK (ctx->element); if (!ctx->set_display) { GstContext *context; GST_OBJECT_UNLOCK (ctx->element); display = eglGetDisplay (EGL_DEFAULT_DISPLAY); if (display == EGL_NO_DISPLAY) { GST_ERROR_OBJECT (ctx->element, "Could not get EGL display connection"); goto HANDLE_ERROR; /* No EGL error is set by eglGetDisplay() */ } ctx->display = gst_egl_display_new (display, (GDestroyNotify) eglTerminate); context = gst_context_new_egl_display (ctx->display, FALSE); msg = gst_message_new_have_context (GST_OBJECT (ctx->element), context); gst_element_post_message (GST_ELEMENT_CAST (ctx->element), msg); } if (!eglInitialize (gst_egl_display_get (ctx->display), &ctx->eglglesctx->egl_major, &ctx->eglglesctx->egl_minor)) { got_egl_error ("eglInitialize"); GST_ERROR_OBJECT (ctx->element, "Could not init EGL display connection"); goto HANDLE_EGL_ERROR; } /* Check against required EGL version * XXX: Need to review the version requirement in terms of the needed API */ if (ctx->eglglesctx->egl_major < GST_EGLGLESSINK_EGL_MIN_VERSION) { GST_ERROR_OBJECT (ctx->element, "EGL v%d needed, but you only have v%d.%d", GST_EGLGLESSINK_EGL_MIN_VERSION, ctx->eglglesctx->egl_major, ctx->eglglesctx->egl_minor); goto HANDLE_ERROR; } GST_INFO_OBJECT (ctx->element, "System reports supported EGL version v%d.%d", ctx->eglglesctx->egl_major, ctx->eglglesctx->egl_minor); eglBindAPI (EGL_OPENGL_ES_API); return TRUE; /* Errors */ HANDLE_EGL_ERROR: GST_ERROR_OBJECT (ctx->element, "EGL call returned error %x", eglGetError ()); HANDLE_ERROR: GST_ERROR_OBJECT (ctx->element, "Couldn't setup window/surface from handle"); return FALSE; }