<div dir="ltr">I create bug for this context share problem here <a href="https://bugzilla.gnome.org/show_bug.cgi?id=725640">https://bugzilla.gnome.org/show_bug.cgi?id=725640</a> ,more test  demo will be uploaded, hopes this help. Thank you<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 4, 2014 at 5:41 PM, Matthew Waters <span dir="ltr"><<a href="mailto:ystreet00@gmail.com" target="_blank">ystreet00@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 04/03/14 12:35, comicfans44 wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi<br>
<br>
Matthew Waters <<a href="mailto:ystreet00@gmail.com" target="_blank">ystreet00@gmail.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1 :  in Qt GL callback,  use glXGetCurrentContext get current GL<br>
context ,  I don't know how to get  x11 Display*  from Qt so I<br>
use XOpenDisplay(getenv("DISPLAY")<u></u>) to open One<br>
</blockquote>
Another option is to create your display normally and then pass that<br>
into gst-gl using the GstContext query.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
3:  pass the GstGLContextGLX*  to a   global variable ,  hack<br>
gst_gl_context_glx_create_<u></u>context  to use this variable (which will<br>
run the share context code path) .    I didn't know how to do this<br>
step through gst-gl public API , since  GstGLImageSink always call<br>
gst_gl_context_create  with shared context=0 . GstGLFilter has<br>
other-context property but I did not always have a GstGLFilter all<br>
the time.<br>
</blockquote>
Hmm, it should be possible to add that property to glimagesink, the<br>
workaround, as you suggested, is to use some GstGLFilter subclass<br>
(glcolorscale or gleffects with effect property set to 0).  Also, you<br>
should use gst_gl_context_new_wrapped to wrap an existing GL context.<br>
<br>
</blockquote>
Thanks for advising, but  I'm afraid this also suffered<br>
from the random lock problem, since its also goes through the<br>
context share code path .I'll try this and report later.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
plus , I found that if I draw the  result texture in both<br>
thread , more random locks.(I wait Qt GL draw completed then draw<br>
it in clientDrawCallback,so texture is not used at the same time.<br>
at least at my opengl code level)<br>
<br>
so , I wonder if this is a problem in my misused code , or a bug in<br>
driver?<br>
</blockquote>
Sounds like a driver bug to me.  Unfortunately I do not have any<br>
radeon GPU's to test with.  You could alternatively try with the mesa<br>
stack (which AMD is contributing to)<br>
<br>
</blockquote>
unfortunately , I tried the mesa but when running program, stdout gives<br>
radeon: The kernel rejected CS, see dmesg for more information.<br>
dmesg shows:[drm:radeon_cs_parser_<u></u>relocs] *ERROR* gem object lookup<br>
failed 0x39 [drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation -2!<br>
seems that mesa or kernel has some problem. plus draw performance of<br>
mesa not satisfied my requirement.<br>
</blockquote>
<br></div></div>
:(. That sounds like the contexts aren't being shared properly, or a driver bug.<div class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I can receive gl texture ,but<br>
the texture id always increases in every buffer receive (seems<br>
texture never freed ), instead of two id swapping as glimagesink, I<br>
don't know which part of code does the trick  ?<br>
</blockquote>
Bufferpools allow the reuse of GstBuffer's.  And GstBuffer's contain<br>
GstMemory's and there's a GstGLMemory which holds a GL texture.<br>
Although that *should* already be used.<br>
<br>
</blockquote>
I tried a pipeline like   videotestsrc -> glfilterblur ->myappsink ,I<br>
found the BufferPool usage in glfilter ,but I still found texture not<br>
freed. plus there is comment in glfilter.c :790<br>
<br>
   /* we need at least 2 buffer because we hold on to the last one */<br>
   gst_query_add_allocation_pool (query, pool, size, 1, 0);    -->1 or 2?<br>
<br>
but in gstglimagesink.c:919<br>
<br>
   /* we need at least 2 buffer because we hold on to the last one */<br>
   gst_query_add_allocation_pool (query, pool, size, 2, 0);<br>
<br>
why this difference? I also tried to change glfilter argument to 2 but<br>
texture still not freed.  override appsink's<br>
propose_allocation and do as glimagesink, still no luck<br>
</blockquote>
<br></div>
The filter comment is wrong, it only needs one.  glimagesink needs 2 because it (GstVideoSink) holds onto the last buffer for redisplay.<div class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

can somebody provide some suggestions? if sharing texture between<br>
thread (option A) is not stable, should we provide a easier way to<br>
use custom GstGLContext/GstGLWindow (option B) ?  or how to use<br>
appsink (option C)to receive buffer and correctly release it ?<br>
Thanks<br>
<br>
<br>
<br>
</blockquote>
It would be stupendous if you could file a bug here<br>
<a href="https://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer" target="_blank">https://bugzilla.gnome.org/<u></u>enter_bug.cgi?product=<u></u>GStreamer</a> against<br>
gst-plugins-gl with the example program/s.<br>
</blockquote>
OK, I'll clean my code and post it , Great thanks for suggestion.<br>
<br>
</blockquote>
<br></div>
Awesome, thanks.<div class="HOEnZb"><div class="h5"><br>
______________________________<u></u>_________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.<u></u>freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/<u></u>mailman/listinfo/gstreamer-<u></u>devel</a><br>
</div></div></blockquote></div><br></div>