AW: AW: [External] Re: ZeroCopy + AppSink + VAAPI + Qt

Timtchenko, Michael Michael.Timtchenko at agcocorp.com
Wed Feb 12 14:48:42 UTC 2020


Hi again,

[Subjects: Appsink - ZeroCopy - EGL (without X) - glupload]

i've now implemented the suggested solution and encountered several minor problems, especially with the "GST_MESSAGE_NEED_CONTEXT"-message. I assumed that there
is only on possibility to retrieve bus-callbacks from gstreamer, now i know, that there is a synchronous as well as an asynchronous callback.

However, after reading (1), i tried to setup the GstGlContext before launching the pipeline. This caused a interesting situation. Without the context setup, i
received increasing textureIds over time. Right now, with configured context i run into several errors. When i'm trying to pull the a sample from appsink,
i face an endless loop, which causes the following debug print:

"Failed to create a OpenGL context: EGL_BAD_CONTEXT". I've attached the related log files below and categorized them in

A: Retrieving context
B: Setup GStreamer
C: Pulling Frame

Also i see that, the glcontextXX increases over the time from 0 to 197 (I dont think that this is valid, isn't it?)

  glcontext gstglcontext.c:1244:gst_gl_context_create_thread:<glcontextegl97> Failed to create context

I'm receiving my OpenGl-Context by the following methods:

    auto platform = GST_GL_PLATFORM_EGL;
    auto api = gst_gl_context_get_current_gl_api( platform, NULL, NULL )
    auto ctx = gst_gl_context_get_current_gl_context( platform );
    auto disp = gst_gl_display_egl_new_with_egl_display( eglDisplay );
    auto context = gst_gl_context_new_wrapped( ( GstGLDisplay* )disp, ctx, platform, api );

    GError* error;

    gst_gl_context_activate( context, TRUE );

    if( !gst_gl_context_fill_info( context, &error ) )
    {
        qDebug() << "error:" << error->code << error->domain << error->message;
    }

and this code is executed on the Renderer-Thread which has an valid OpenGl-Context (context is not null). I think this should gonna work, shouldn't it?

Could someone provide some advice on this? It seems like a general problem, which only appears in some corner cases. (2) is suffering the same issues, probably due to a different reason.

(1) http://gstreamer-devel.966125.n4.nabble.com/Problem-with-context-sharing-glupload-with-an-OVR-thread-Oculus-Mobile-SDK-td4685964.html
(2) https://forum.qt.io/topic/104824/qmlglsink-fails-with-egl_bad_context-or-fails-to-retrieve-wrapped-context-on-creation-on-jetson-tx1

Thanks in advance,
Help is really appreciated :)

Michael

A: Retrieving Context:

0:00:11.502866090 10473 0x7f4e50004890 TRACE              gldisplay gstgldisplay.c:205:gst_gl_display_init: init 0x7f4e380c6850
0:00:11.503288599 10473 0x7f4e50004890 DEBUG              glcontext gstglcontext.c:754:gst_gl_context_activate:<glwrappedcontext0> activate:1
0:00:11.535806814 10473 0x7f4e50004890 INFO               glcontext gstglcontext.c:1080:_create_context_info:<glwrappedcontext0> GL_VERSION: OpenGL ES 3.2 Mesa 18.3.3
0:00:11.535862809 10473 0x7f4e50004890 INFO               glcontext gstglcontext.c:1083:_create_context_info:<glwrappedcontext0> GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL ES 3.20
0:00:11.535881346 10473 0x7f4e50004890 INFO               glcontext gstglcontext.c:1085:_create_context_info:<glwrappedcontext0> GL_VENDOR: Intel Open Source Technology Center
0:00:11.535901756 10473 0x7f4e50004890 INFO               glcontext gstglcontext.c:1087:_create_context_info:<glwrappedcontext0> GL_RENDERER: Mesa DRI Intel(R) HD Graphics 500 (Broxton 2x6)
0:00:11.536465506 10473 0x7f4e50004890 DEBUG              glcontext gstglcontext.c:1424:gst_gl_context_fill_info:<glwrappedcontext0> GL_EXTENSIONS: GL_ANDROID_extension_pack_es31a GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_APPLE_texture_max_level GL_EXT_base_instance GL_EXT_blend_func_extended GL_EXT_blend_minmax GL_EXT_buffer_storage GL_EXT_clip_cull_distance GL_EXT_color_buffer_float GL_EXT_compressed_ETC1_RGB8_sub_texture GL_EXT_copy_image GL_EXT_discard_framebuffer GL_EXT_disjoint_timer_query GL_EXT_draw_buffers GL_EXT_draw_buffers_indexed GL_EXT_draw_elements_base_vertex GL_EXT_frag_depth GL_EXT_geometry_point_size GL_EXT_geometry_shader GL_EXT_gpu_shader5 GL_EXT_map_buffer_range GL_EXT_multi_draw_arrays GL_EXT_occlusion_query_boolean GL_EXT_polygon_offset_clamp GL_EXT_primitive_bounding_box GL_EXT_read_format_bgra GL_EXT_render_snorm GL_EXT_robustness GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_framebuffer_fetch_non_coherent GL_EXT_shader_integer_mix GL_EXT_shader_io_blocks GL_EXT_shader_samples_identical GL_EXT_tessellation_point_size GL_EXT_tessellation_shader GL_EXT_texture_border_clamp GL_EXT_texture_buffer GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map_array GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_norm16 GL_EXT_texture_rg GL_EXT_texture_sRGB_decode GL_EXT_texture_type_2_10_10_10_REV GL_EXT_unpack_subimage GL_INTEL_conservative_rasterization GL_INTEL_performance_query GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_KHR_context_flush_control GL_KHR_debug GL_KHR_no_error GL_KHR_robust_buffer_access_behavior GL_KHR_robustness GL_KHR_texture_compression_astc_hdr GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_sliced_3d GL_MESA_framebuffer_flip_y GL_MESA_shader_integer_functions GL_NV_draw_buffers GL_NV_fbo_color_attachments GL_NV_fragment_shader_interlock GL_NV_image_formats GL_NV_read_buffer GL_NV_read_depth GL_NV_read_depth_stencil GL_NV_read_stencil GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_EGL_sync GL_OES_compressed_ETC1_RGB8_texture GL_OES_copy_image GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_draw_buffers_indexed GL_OES_draw_elements_base_vertex GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_geometry_point_size GL_OES_geometry_shader GL_OES_get_program_binary GL_OES_gpu_shader5 GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_primitive_bounding_box GL_OES_required_internalformat GL_OES_rgb8_rgba8 GL_OES_sample_shading GL_OES_sample_variables GL_OES_shader_image_atomic GL_OES_shader_io_blocks GL_OES_shader_multisample_interpolation GL_OES_standard_derivatives GL_OES_stencil8 GL_OES_surfaceless_context GL_OES_tessellation_point_size GL_OES_tessellation_shader GL_OES_texture_3D GL_OES_texture_border_clamp GL_OES_texture_buffer GL_OES_texture_cube_map_array GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_texture_stencil8 GL_OES_texture_storage_multisample_2d_array GL_OES_texture_view GL_OES_vertex_array_object GL_OES_vertex_half_float GL_OES_viewport_array
0:00:11.536557429 10473 0x7f4e50004890 DEBUG              glfeature gstglfeature.c:193:_gst_gl_feature_check: core, 0x18003, 1.0 vs 0x10000, 3.2
0:00:11.536593596 10473 0x7f4e50004890 TRACE              glfeature gstglfeature.c:222:_gst_gl_feature_check: glBindTexture should be in core
0:00:11.536619421 10473 0x7f4e50004890 TRACE              glfeature gstglfeature.c:222:_gst_gl_feature_check: glBlendFunc should be in core
0:00:11.536640541 10473 0x7f4e50004890 TRACE              glfeature gstglfeature.c:222:_gst_gl_feature_check: glClear should be in core
...

B: Start

0:00:15.202714608 10473       0x5bbe00 DEBUG               glupload gstglupload.c:1599:gst_gl_upload_new:<glupload0> Created new GLUpload for context (NULL)
0:00:17.874761733 10473       0x5bbe00 LOG              GST_CONTEXT gstcontext.c:170:gst_context_new: creating new context 0x7f4e380022a0
0:00:17.874974260 10473       0x5bbe00 DEBUG            GST_CONTEXT gstelement.c:3460:gst_element_set_context:<upload> set context 0x7f4e380022a0 context, context=(GstGLContext)"\(GstGLWrappedContext\)\ glwrappedcontext0";
0:00:17.875583556 10473       0x5bbe00 DEBUG           glbasefilter gstglbasefilter.c:429:gst_gl_base_filter_change_state:<upload> changing state: NULL => READY
0:00:17.875874598 10473       0x5bbe00 INFO             GST_CONTEXT gstglutils.c:115:pad_query:<upload:src> pad peer query failed
0:00:17.875977611 10473       0x5bbe00 INFO             GST_CONTEXT gstglutils.c:115:pad_query:<upload:sink> pad peer query failed
0:00:17.876006475 10473       0x5bbe00 INFO             GST_CONTEXT gstglutils.c:177:_gst_context_query:<upload> posting need context message
0:00:17.876262358 10473       0x5bbe00 INFO               gldisplay gstgldisplay.c:289:gst_gl_display_new: creating a display, user choice:(NULL) (platform: (NULL))
0:00:17.877011751 10473       0x5bbe00 TRACE              gldisplay gstgldisplay.c:205:gst_gl_display_init: init 0x7f4e380c6df0
0:00:17.877212958 10473       0x5bbe00 DEBUG              gldisplay gstgldisplay_egl.c:116:gst_gl_display_egl_get_from_native: egl no display extensions: EGL_EXT_client_extensions EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_KHR_debug EGL_MESA_platform_gbm
0:00:17.877470593 10473       0x5bbe00 LOG              GST_CONTEXT gstcontext.c:170:gst_context_new: creating new context 0x7f4e38002360
0:00:17.877536255 10473       0x5bbe00 LOG              GST_CONTEXT gstgldisplay.c:458:gst_context_set_gl_display: setting GstGLDisplay(<gldisplayegl1>) on context(context 'gst.gl.GLDisplay'='context;')
0:00:17.877738913 10473       0x5bbe00 DEBUG            GST_CONTEXT gstelement.c:3460:gst_element_set_context:<upload> set context 0x7f4e38002360 context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayEGL\)\ gldisplayegl1";
0:00:17.877783804 10473       0x5bbe00 LOG              GST_CONTEXT gstgldisplay.c:488:gst_context_get_gl_display: got GstGLDisplay(0x7f4e380c6df0) from context(0x7f4e38002360)
0:00:17.877815007 10473       0x5bbe00 TRACE              gldisplay gstgldisplay.c:385:gst_gl_display_filter_gl_api:<gldisplayegl1> filtering with api any
0:00:17.877845791 10473       0x5bbe00 INFO             GST_CONTEXT gstglutils.c:241:gst_gl_element_propagate_display_context:<upload> posting have context (0x7f4e38002360) message with display (0x7f4e380c6df0)
0:00:17.877932934 10473       0x5bbe00 TRACE              gldisplay gstgldisplay.c:385:gst_gl_display_filter_gl_api:<gldisplayegl1> filtering with api any
0:00:17.878893460 10473       0x5bbe00 DEBUG           glbasefilter gstglbasefilter.c:429:gst_gl_base_filter_change_state:<upload> changing state: READY => PAUSED
0:00:17.879149074 10473       0x5bbe00 LOG                  glutils gstglutils.c:438:gst_gl_handle_context_query:<upload> handle context query context query: 0xc77230, GstQueryContext, context-type=(string)gst.vaapi.Display;
0:00:17.879250655 10473       0x5bbe00 INFO             GST_CONTEXT gstvaapivideocontext.c:136:context_pad_query:<postproc:src> context pad peer query failed
0:00:17.879289997 10473       0x5bbe00 INFO             GST_CONTEXT gstvaapivideocontext.c:136:context_pad_query:<postproc:sink> context pad peer query failed
0:00:17.879314265 10473       0x5bbe00 INFO             GST_CONTEXT gstvaapivideocontext.c:210:_gst_context_query:<postproc> posting `need-context' message
0:00:17.885944734 10473       0x5bbe00 LOG              GST_CONTEXT gstcontext.c:170:gst_context_new: creating new context 0xfb6460
0:00:17.886173661 10473       0x5bbe00 DEBUG            GST_CONTEXT gstelement.c:3460:gst_element_set_context:<postproc> set context 0xfb6460 context, gst.vaapi.Display=(GstVaapiDisplay)"\(GstVaapiDisplayDRM\)\ vaapidisplaydrm2";
0:00:17.886212029 10473       0x5bbe00 INFO             GST_CONTEXT gstvaapivideocontext.c:299:gst_vaapi_video_context_propagate:<postproc> posting `have-context' (0xfb6460) message with display <vaapidisplaydrm2>
0:00:17.886444482 10473       0x5bbe00 LOG              GST_CONTEXT gstcontext.c:170:gst_context_new: creating new context 0xfb64c0
0:00:17.886484999 10473       0x5bbe00 INFO             GST_CONTEXT gstvaapivideocontext.c:179:_gst_context_get_from_query:<dec> found context (context 'gst.vaapi.Display'='context, gst.vaapi.Display=(GstVaapiDisplay)"\(GstVaapiDisplayDRM\)\ vaapidisplaydrm2";') in downstream query
0:00:17.886507328 10473       0x5bbe00 DEBUG            GST_CONTEXT gstelement.c:3460:gst_element_set_context:<dec> set context 0xfb64c0 context, gst.vaapi.Display=(GstVaapiDisplay)"\(GstVaapiDisplayDRM\)\ vaapidisplaydrm2";
0:00:17.887390066 10473       0x5bbe00 DEBUG           glbasefilter gstglbasefilter.c:429:gst_gl_base_filter_change_state:<upload> changing state: PAUSED => PLAYING

C:

Pulling frame

0:02:32.240269522 10473       0xc698a0 LOG                  glutils gstglutils.c:438:gst_gl_handle_context_query:<upload> handle context query context query: 0x7f4e14046800, GstQueryContext, context-type=(string)gst.vaapi.Display;
0:02:32.240322167 10473       0xc698a0 INFO             GST_CONTEXT gstvaapivideocontext.c:136:context_pad_query:<postproc:src> context pad peer query failed
0:02:32.240342256 10473       0xc698a0 LOG              GST_CONTEXT gstcontext.c:170:gst_context_new: creating new context 0x7f4e2c007240
0:02:32.240377292 10473       0xc698a0 INFO             GST_CONTEXT gstvaapivideocontext.c:179:_gst_context_get_from_query:<postproc> found context (context 'gst.vaapi.Display'='context, gst.vaapi.Display=(GstVaapiDisplay)"\(GstVaapiDisplayDRM\)\ vaapidisplaydrm2";') in upstream query
0:02:32.240401205 10473       0xc698a0 DEBUG            GST_CONTEXT gstelement.c:3460:gst_element_set_context:<postproc> set context 0x7f4e2c007240 context, gst.vaapi.Display=(GstVaapiDisplay)"\(GstVaapiDisplayDRM\)\ vaapidisplaydrm2";
0:02:32.242163439 10473       0xc698a0 INFO             GST_CONTEXT gstglutils.c:115:pad_query:<upload:src> pad peer query failed
0:02:32.242217147 10473       0xc698a0 INFO             GST_CONTEXT gstglutils.c:115:pad_query:<upload:sink> pad peer query failed
0:02:32.242239391 10473       0xc698a0 DEBUG              gldisplay gstgldisplay.c:676:_get_gl_context_for_thread_unlocked:<gldisplayegl1> No GL context for thread (nil)
0:02:32.242254050 10473       0xc698a0 DEBUG              gldisplay gstgldisplay.c:701:gst_gl_display_get_gl_context_for_thread:<gldisplayegl1> returning context (NULL) for thread (nil)
0:02:32.242288055 10473       0xc698a0 INFO               glcontext gstglcontext.c:337:gst_gl_context_new: creating a context for display <gldisplayegl1>, user choice:(null)
0:02:32.242355961 10473       0xc698a0 DEBUG              glcontext gstglcontext.c:371:gst_gl_context_new:<glcontextegl0> Done creating context for display <gldisplayegl1> (user_choice:(null))
0:02:32.242372507 10473       0xc698a0 DEBUG              gldisplay gstgldisplay.c:534:gst_gl_display_create_context:<gldisplayegl1> creating context <glcontextegl0> from other context <glwrappedcontext0>
0:02:32.242384687 10473       0xc698a0 DEBUG              glcontext gstglcontext.c:1025:gst_gl_context_create:<glcontextegl0>  other_context:<glwrappedcontext0>
0:02:32.242421842 10473       0xc698a0 INFO                glwindow gstglwindow.c:251:gst_gl_window_new: creating a window, user choice:(null)
0:02:32.242431197 10473       0xc698a0 WARN                glwindow gstglwindow.c:293:gst_gl_window_new: Could not create window. user specified (null), creating dummy window
0:02:32.242664687 10473       0xc698a0 DEBUG              glcontext gstglcontext.c:934:gst_gl_context_set_window:<glcontextegl0> window:<gldummywindow0>
0:02:32.243176652 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext.c:1183:gst_gl_context_create_thread:<glcontextegl0> Creating thread
0:02:32.243304472 10473 0x7f4e140469e0 INFO               glcontext gstglcontext.c:1240:gst_gl_context_create_thread:<glcontextegl0> Attempting to create opengl context. user chosen api(s) (any), compiled api support (gles2) display api (any)
0:02:32.243319454 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:301:gst_gl_context_egl_create_context:<glcontextegl0> Creating EGL context
0:02:32.243362048 10473 0x7f4e140469e0 LOG                gldisplay gstgldisplay_egl.c:260:gst_gl_display_egl_from_gl_display:<gldisplayegl1> display <gldisplayegl1>is already a GstGLDisplayEGL
0:02:32.257483977 10473 0x7f4e140469e0 INFO               glcontext gstglcontext_egl.c:339:gst_gl_context_egl_create_context: egl initialized, version: 1.4
0:02:32.257542511 10473 0x7f4e140469e0 INFO               glcontext gstglcontext_egl.c:451:gst_gl_context_egl_create_context: Bound OpenGL|ES
0:02:32.257615773 10473 0x7f4e140469e0 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:32.257640213 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.2 flags 1 profile 0
0:02:32.257723735 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.2 flags 0 profile 0
0:02:32.257805533 10473 0x7f4e140469e0 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:32.257844593 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.1 flags 1 profile 0
0:02:32.257861734 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.1 flags 0 profile 0
0:02:32.257908268 10473 0x7f4e140469e0 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:32.257924042 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.0 flags 1 profile 0
0:02:32.257953974 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.0 flags 0 profile 0
0:02:32.258008836 10473 0x7f4e140469e0 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:32.258038004 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 2.0 flags 1 profile 0
0:02:32.258055534 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 2.0 flags 0 profile 0
0:02:32.258214645 10473 0x7f4e140469e0 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:32.258234785 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 0.0 flags 1 profile 0
0:02:32.258267139 10473 0x7f4e140469e0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 0.0 flags 0 profile 0
0:02:32.258357512 10473 0x7f4e140469e0 WARN               glcontext gstglcontext.c:1244:gst_gl_context_create_thread:<glcontextegl0> Failed to create context
0:02:32.258545818 10473       0xc698a0 INFO               glcontext gstglcontext.c:1046:gst_gl_context_create:<glcontextegl0> gl thread created
0:02:32.258658378 10473       0xc698a0 WARN            glbasefilter gstglbasefilter.c:395:gst_gl_base_filter_decide_allocation:<upload> error: Failed to create a OpenGL context: EGL_BAD_CONTEXT
0:02:32.259370113 10473       0xc698a0 INFO             GST_CONTEXT gstglutils.c:115:pad_query:<upload:src> pad peer query failed
0:02:32.259411468 10473       0xc698a0 INFO             GST_CONTEXT gstglutils.c:115:pad_query:<upload:sink> pad peer query failed
0:02:32.259430838 10473       0xc698a0 DEBUG              gldisplay gstgldisplay.c:676:_get_gl_context_for_thread_unlocked:<gldisplayegl1> No GL context for thread (nil)
0:02:32.259444400 10473       0xc698a0 DEBUG              gldisplay gstgldisplay.c:701:gst_gl_display_get_gl_context_for_thread:<gldisplayegl1> returning context (NULL) for thread (nil)
0:02:32.259464785 10473       0xc698a0 INFO               glcontext gstglcontext.c:337:gst_gl_context_new: creating a context for display <gldisplayegl1>, user choice:(null)
0:02:32.259522079 10473       0xc698a0 DEBUG              glcontext gstglcontext.c:371:gst_gl_context_new:<glcontextegl1> Done creating context for display <gldisplayegl1> (user_choice:(null))
0:02:32.259538396 10473       0xc698a0 DEBUG              gldisplay gstgldisplay.c:534:gst_gl_display_create_context:<gldisplayegl1> creating context <glcontextegl1> from other context <glwrappedcontext0>
0:02:32.259549911 10473       0xc698a0 DEBUG              glcontext gstglcontext.c:1025:gst_gl_context_create:<glcontextegl1>  other_context:<glwrappedcontext0>
0:02:32.259560678 10473       0xc698a0 INFO                glwindow gstglwindow.c:251:gst_gl_window_new: creating a window, user choice:(null)
0:02:32.259569883 10473       0xc698a0 WARN                glwindow gstglwindow.c:293:gst_gl_window_new: Could not create window. user specified (null), creating dummy window
0:02:32.259618574 10473       0xc698a0 DEBUG              glcontext gstglcontext.c:934:gst_gl_context_set_window:<glcontextegl1> window:<gldummywindow1>
0:02:32.260003122 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext.c:1183:gst_gl_context_create_thread:<glcontextegl1> Creating thread
0:02:32.260118220 10473 0x7f4e140468f0 INFO               glcontext gstglcontext.c:1240:gst_gl_context_create_thread:<glcontextegl1> Attempting to create opengl context. user chosen api(s) (any), compiled api support (gles2) display api (any)
0:02:32.260134220 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:301:gst_gl_context_egl_create_context:<glcontextegl1> Creating EGL context
0:02:32.260171794 10473 0x7f4e140468f0 LOG                gldisplay gstgldisplay_egl.c:260:gst_gl_display_egl_from_gl_display:<gldisplayegl1> display <gldisplayegl1>is already a GstGLDisplayEGL
0:02:32.260200245 10473 0x7f4e140468f0 INFO               glcontext gstglcontext_egl.c:339:gst_gl_context_egl_create_context: egl initialized, version: 1.4
0:02:32.260210446 10473 0x7f4e140468f0 INFO               glcontext gstglcontext_egl.c:451:gst_gl_context_egl_create_context: Bound OpenGL|ES
0:02:32.260283470 10473 0x7f4e140468f0 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:32.260319738 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl1> attempting to create OpenGL ES context version 3.2 flags 1 profile 0
0:02:32.260339703 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl1> attempting to create OpenGL ES context version 3.2 flags 0 profile 0
0:02:32.260395647 10473 0x7f4e140468f0 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:32.260423743 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl1> attempting to create OpenGL ES context version 3.1 flags 1 profile 0
0:02:32.260441567 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl1> attempting to create OpenGL ES context version 3.1 flags 0 profile 0
0:02:32.260486237 10473 0x7f4e140468f0 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:32.260502877 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl1> attempting to create OpenGL ES context version 3.0 flags 1 profile 0
0:02:32.260529545 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl1> attempting to create OpenGL ES context version 3.0 flags 0 profile 0
0:02:32.260625711 10473 0x7f4e140468f0 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:32.260648525 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl1> attempting to create OpenGL ES context version 2.0 flags 1 profile 0
0:02:32.260666305 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl1> attempting to create OpenGL ES context version 2.0 flags 0 profile 0
0:02:32.260728561 10473 0x7f4e140468f0 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:32.260748118 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl1> attempting to create OpenGL ES context version 0.0 flags 1 profile 0
0:02:32.260765578 10473 0x7f4e140468f0 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl1> attempting to create OpenGL ES context version 0.0 flags 0 profile

...

compiled api support (gles2) display api (any)
0:02:35.303389619 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:301:gst_gl_context_egl_create_context:<glcontextegl96> Creating EGL context
0:02:35.303427520 10473 0x7f4e14157b20 LOG                gldisplay gstgldisplay_egl.c:260:gst_gl_display_egl_from_gl_display:<gldisplayegl1> display <gldisplayegl1>is already a GstGLDisplayEGL
0:02:35.303454332 10473 0x7f4e14157b20 INFO               glcontext gstglcontext_egl.c:339:gst_gl_context_egl_create_context: egl initialized, version: 1.4
0:02:35.303469176 10473 0x7f4e14157b20 INFO               glcontext gstglcontext_egl.c:451:gst_gl_context_egl_create_context: Bound OpenGL|ES
0:02:35.303550747 10473 0x7f4e14157b20 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:35.303576749 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl96> attempting to create OpenGL ES context version 3.2 flags 1 profile 0
0:02:35.303603708 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl96> attempting to create OpenGL ES context version 3.2 flags 0 profile 0
0:02:35.303672315 10473 0x7f4e14157b20 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:35.303696830 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl96> attempting to create OpenGL ES context version 3.1 flags 1 profile 0
0:02:35.303722198 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl96> attempting to create OpenGL ES context version 3.1 flags 0 profile 0
0:02:35.303791393 10473 0x7f4e14157b20 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:35.303815452 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl96> attempting to create OpenGL ES context version 3.0 flags 1 profile 0
0:02:35.303840089 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl96> attempting to create OpenGL ES context version 3.0 flags 0 profile 0
0:02:35.303905358 10473 0x7f4e14157b20 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:35.303931712 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl96> attempting to create OpenGL ES context version 2.0 flags 1 profile 0
0:02:35.303956453 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl96> attempting to create OpenGL ES context version 2.0 flags 0 profile 0
0:02:35.304021428 10473 0x7f4e14157b20 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:35.304059736 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl96> attempting to create OpenGL ES context version 0.0 flags 1 profile 0
0:02:35.304116501 10473 0x7f4e14157b20 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl96> attempting to create OpenGL ES context version 0.0 flags 0 profile 0
0:02:35.304142499 10473 0x7f4e14157b20 WARN               glcontext gstglcontext.c:1244:gst_gl_context_create_thread:<glcontextegl96> Failed to create context
0:02:35.304426728 10473       0xc698a0 INFO               glcontext gstglcontext.c:1046:gst_gl_context_create:<glcontextegl96> gl thread created
0:02:35.304482599 10473       0xc698a0 WARN            glbasefilter gstglbasefilter.c:395:gst_gl_base_filter_decide_allocation:<upload> error: Failed to create a OpenGL context: EGL_BAD_CONTEXT
0:02:35.335604841 10473       0xc698a0 INFO             GST_CONTEXT gstglutils.c:115:pad_query:<upload:src> pad peer query failed
0:02:35.335669893 10473       0xc698a0 INFO             GST_CONTEXT gstglutils.c:115:pad_query:<upload:sink> pad peer query failed
0:02:35.335746605 10473       0xc698a0 DEBUG              gldisplay gstgldisplay.c:676:_get_gl_context_for_thread_unlocked:<gldisplayegl1> No GL context for thread (nil)
0:02:35.335770159 10473       0xc698a0 DEBUG              gldisplay gstgldisplay.c:701:gst_gl_display_get_gl_context_for_thread:<gldisplayegl1> returning context (NULL) for thread (nil)
0:02:35.335801748 10473       0xc698a0 INFO               glcontext gstglcontext.c:337:gst_gl_context_new: creating a context for display <gldisplayegl1>, user choice:(null)
0:02:35.335869290 10473       0xc698a0 DEBUG              glcontext gstglcontext.c:371:gst_gl_context_new:<glcontextegl97> Done creating context for display <gldisplayegl1> (user_choice:(null))
0:02:35.335898708 10473       0xc698a0 DEBUG              gldisplay gstgldisplay.c:534:gst_gl_display_create_context:<gldisplayegl1> creating context <glcontextegl97> from other context <glwrappedcontext0>
0:02:35.335916602 10473       0xc698a0 DEBUG              glcontext gstglcontext.c:1025:gst_gl_context_create:<glcontextegl97>  other_context:<glwrappedcontext0>
0:02:35.335932902 10473       0xc698a0 INFO                glwindow gstglwindow.c:251:gst_gl_window_new: creating a window, user choice:(null)
0:02:35.335946595 10473       0xc698a0 WARN                glwindow gstglwindow.c:293:gst_gl_window_new: Could not create window. user specified (null), creating dummy window
0:02:35.336139888 10473       0xc698a0 DEBUG              glcontext gstglcontext.c:934:gst_gl_context_set_window:<glcontextegl97> window:<gldummywindow97>
0:02:35.336818707 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext.c:1183:gst_gl_context_create_thread:<glcontextegl97> Creating thread
0:02:35.336945996 10473 0x7f4e1414d800 INFO               glcontext gstglcontext.c:1240:gst_gl_context_create_thread:<glcontextegl97> Attempting to create opengl context. user chosen api(s) (any), compiled api support (gles2) display api (any)
0:02:35.336966148 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:301:gst_gl_context_egl_create_context:<glcontextegl97> Creating EGL context
0:02:35.337000226 10473 0x7f4e1414d800 LOG                gldisplay gstgldisplay_egl.c:260:gst_gl_display_egl_from_gl_display:<gldisplayegl1> display <gldisplayegl1>is already a GstGLDisplayEGL
0:02:35.337025655 10473 0x7f4e1414d800 INFO               glcontext gstglcontext_egl.c:339:gst_gl_context_egl_create_context: egl initialized, version: 1.4
0:02:35.337040154 10473 0x7f4e1414d800 INFO               glcontext gstglcontext_egl.c:451:gst_gl_context_egl_create_context: Bound OpenGL|ES
0:02:35.337156290 10473 0x7f4e1414d800 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:35.337186898 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl97> attempting to create OpenGL ES context version 3.2 flags 1 profile 0
0:02:35.337216145 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl97> attempting to create OpenGL ES context version 3.2 flags 0 profile 0
0:02:35.337284964 10473 0x7f4e1414d800 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:35.337316426 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl97> attempting to create OpenGL ES context version 3.1 flags 1 profile 0
0:02:35.337342571 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl97> attempting to create OpenGL ES context version 3.1 flags 0 profile 0
0:02:35.337408722 10473 0x7f4e1414d800 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:35.337438338 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl97> attempting to create OpenGL ES context version 3.0 flags 1 profile 0
0:02:35.337464028 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl97> attempting to create OpenGL ES context version 3.0 flags 0 profile 0
0:02:35.337529383 10473 0x7f4e1414d800 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:35.337553211 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl97> attempting to create OpenGL ES context version 2.0 flags 1 profile 0
0:02:35.337578807 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl97> attempting to create OpenGL ES context version 2.0 flags 0 profile 0
0:02:35.337643594 10473 0x7f4e1414d800 INFO               glcontext gstglcontext_egl.c:206:gst_gl_context_egl_choose_config: config set: 139973119593440, 1
0:02:35.337669105 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl97> attempting to create OpenGL ES context version 0.0 flags 1 profile 0
0:02:35.337694013 10473 0x7f4e1414d800 DEBUG              glcontext gstglcontext_egl.c:250:_create_context_with_flags:<glcontextegl97> attempting to create OpenGL ES context version 0.0 flags 0 profile 0
0:02:35.337717361 10473 0x7f4e1414d800 WARN               glcontext gstglcontext.c:1244:gst_gl_context_create_thread:<glcontextegl97> Failed to create context
0:02:35.337800474 10473       0xc698a0 INFO               glcontext gstglcontext.c:1046:gst_gl_context_create:<glcontextegl97> gl thread created
0:02:35.337912740 10473       0xc698a0 WARN            glbasefilter gstglbasefilter.c:395:gst_gl_base_filter_decide_allocation:<upload> error: Failed to create a OpenGL context: EGL_BAD_CONTEXT


-----Ursprüngliche Nachricht-----
Von: Timtchenko, Michael
Gesendet: Dienstag, 11. Februar 2020 07:33
An: 'Discussion of the development of and with GStreamer' <gstreamer-devel at lists.freedesktop.org>
Betreff: AW: AW: [External] Re: ZeroCopy + AppSink + VAAPI + Qt

Hi,

thx 4 response!

> >I'll summarize my situation:
>>
> >- Setup: udpsrc -> vaapi -> glupload -> appsink
> >- Pulling Frames with retrieving texture ids (ids are increased by
> >every
>>   frame) via appsink

> They shouldn't increase forever. That would mean you're leaking textures.

>> - Mapped texture ids are propagated to rendering code, but they are not mapped
>>   properly

> What does that mean?

I'm receiving a textureId within my new_sample callback and passing this to my application. In my application I'm using this textureId for creating a Qt-ScreneGraph-Node. The problem I'm facing is, that I got obviously two opengl contexts (the context from gstreamer and those from my application). When I'm receiving a textureId from new_sample, this textureId has a different meaning in my application context. For example I'm receiving the textureId 2 in my new_sample callback, which should be a frame... in my application context, this can be an icon or sth else, what was previously uploaded. (at least this is what I see).

Is my assumption right, that I should be able to use/reference a texture by the textureId within my application context? Or is this approach invalid?

Kind regards,
Michael

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] Im Auftrag von Víctor Jáquez
Gesendet: Montag, 10. Februar 2020 17:18
An: Discussion of the development of and with GStreamer <gstreamer-devel at lists.freedesktop.org>
Betreff: Re: AW: [External] Re: ZeroCopy + AppSink + VAAPI + Qt

On Mon, 10 Feb 2020 at 12:30, Timtchenko, Michael wrote:
>
> I'll summarize my situation:
>
> - Setup: udpsrc -> vaapi -> glupload -> appsink
> - Pulling Frames with retrieving texture ids (ids are increased by every
>   frame) via appsink

They shouldn't increase forever. That would mean you're leaking textures.

> - Mapped texture ids are propagated to rendering code, but they are not mapped
>   properly

What does that mean?

>
> My guess is, that there is sth wrong with content sharing. But
> unfortunately i don't know what.
>
> Am i right, that gstreamer creates its own gl context, and the passed
> context by the bus-message "GST_MESSAGE_NEED_CONTEXT" is merely used
> for sharing textures between both? In the case that this is correct,
> should it be possible to bind an textureid in Thread/Context A, which
> has been created in Thread/Context B?

gl pipeline will create is own context, but you can pass, with that bus message, *your application's gl context*, thus gl pipeline's thread will create a shared GL context with your application's one (where both context can share objects),

>
> Furthermore i get three context requests over the bus with the following types:
>
> gst.gl.app_context
> gst.gl.GLDisplay
> gst.vaapi.Display
>
> Is it nescessary to provide all three contexts, or is the application
> context sufficient for appsink?

No. Only app_context will be enough.

>
> Does anybody has suggestions towards this issue? I really appreciate
> any help/advice or coding examples. Unfortunately i cannot find any
> complete example :-/

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/blob/master/tests/examples/gl/sdl/sdlshare.c

vmjl


Bitte beachten / Please note!

*******************************************************************************

AGCO GmbH
Sitz der AGCO GmbH: Johann-Georg-Fendt-Str.4, 87616 Marktoberdorf, Germany
Registergericht Amtsgericht Kempten HRB 10327
Geschäftsführer: Christoph Groeblinghoff, Ingrid Bussjaeger-Martin, Dr. Heribert Reiter, Ekkehart Glaeser
Vorsitzender des Aufsichtsrates: Torsten Dehner

*******************************************************************************

Diese E-Mail ist nur für den Empfänger bestimmt, an den es gerichtet ist und kann vertrauliches
bzw. unter das Berufsgeheimnis fallendes Material enthalten. Jegliche darin enthaltene Ansicht
oder Meinungsäußerung ist die des Autors und stellt nicht notwendigerweise die Ansicht oder
Meinung von AGCO dar. Sind Sie nicht der Empfänger, so haben Sie diese E-Mail irrtümlich
erhalten und jegliche Verwendung, Veröffentlichung, Weiterleitung, Abschrift oder jeglicher
Druck dieser E-Mail ist strengstens untersagt. Weder AGCO noch der Absender übernehmen die
Haftung für Viren; es obliegt Ihrer Verantwortung, die E-Mail und deren angehängte
Dateien (sofern vorhanden) auf Viren zu überprüfen.

*******************************************************************************

This email is intended solely for the use of the individual to whom it is addressed and may contain
confidential and/or privileged material. Any views or opinions presented are solely those of the
author and do not necessarily represent those of AGCO. If you are not the intended recipient, be
advised that you have received this email in error and that any use, dissemination, forwarding,
printing or copying of this email is strictly prohibited. Neither AGCO nor the sender accepts any
responsibility for viruses and it is your responsibility to scan and virus check the email and its
attachment(s) (if any).

*******************************************************************************


More information about the gstreamer-devel mailing list