<div dir="ltr">Thanks for the info!<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 12, 2013 at 2:35 PM, Carlos Rafael Giani <span dir="ltr"><<a href="mailto:dv@pseudoterminal.org" target="_blank">dv@pseudoterminal.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
<div>On 2013-08-12 19:55, Stirling Westrup
wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="h5">
<div dir="ltr">
<div>
<div>I've never before had to delve into the depths on how
gstreamer allocates and passes video buffers along, but its
looking like I will soon need to know this.<br>
<br>
</div>
I am assisting in porting OpenCL to gstreamer 1.0, and we'll
need some method of allocating and passing around OpenCL
buffers. Ideally, for my purposes, we'll want to build a
pipeline that passes a single unchanging buffer pointer, but
attaches different metadata to describe transformations. When
someone needs an actual frame of data, we'll combine the
transformations and perform them with an OpenCL kernel that
writes to a standard memory buffer.<br>
<br>
</div>
The documentation on how memory allocation and passing works in
gstreamer is kinda scant though, and I was hoping folks could
point me to useful tutorials and/or example code that I can
learn from.<br clear="all">
<div>
<div>
<div>
<div><br>
-- <br>
Stirling Westrup<br>
Programmer, Entrepreneur.<br>
<a href="https://www.linkedin.com/e/fpf/77228" target="_blank">https://www.linkedin.com/e/fpf/77228</a><br>
<a href="http://www.linkedin.com/in/swestrup" target="_blank">http://www.linkedin.com/in/swestrup</a><br>
<a href="http://technaut.livejournal.com" target="_blank">http://technaut.livejournal.com</a><br>
<a href="http://sourceforge.net/users/stirlingwestrup" target="_blank">http://sourceforge.net/users/stirlingwestrup</a>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
gstreamer-devel mailing list
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
Hello, I have recently written a plugin which also passes around
hardware buffers, so here are my comments.<br>
<br>
You need these components: a buffer pool, an allocator, a metadata
type, and a memory type.<br>
<br>
The memory type is derived from GstMemory, and extends it by
whatever you need for the OpenCL buffers (id's, addresses etc.)<br>
The allocator is used to allocate your custom memory blocks.<br>
The metadata is necessary to let downstream elements know that the
buffers you are sending them contain OpenCL specific stuff.<br>
The buffer pool uses the allocator to allocate memory with your
allocator. In GStreamer 1.0 , a GstBuffer (which is what a buffer
pool produces) is a container for metadata and memory blocks. You
allocate one memory block with your allocator, and append it to the
GstBuffer. You also create the OpenCL metadata, and add it to the
buffer.<br>
<br>
Now you can use the buffer pool to create GstBuffers. The buffer
pool logic takes care of reclaiming buffers that are no longer used
etc. One important limitation of buffer pools is that they can only
be used for buffers with the same total memory size (= the sum of
all of the buffer memory block sizes) and the same caps. If this
limitation is unacceptable, omit the buffer pool, and manually
create buffers + append memory blocks to them.<br>
<br>
Keep in mind that memory blocks may be shared. This typically
happens when subbuffers are created. Decide whether or not this is
something you want to allow.<br>
<br>
cheers<br>
</div>
<br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Stirling Westrup<br>Programmer, Entrepreneur.<br><a href="https://www.linkedin.com/e/fpf/77228" target="_blank">https://www.linkedin.com/e/fpf/77228</a><br><a href="http://www.linkedin.com/in/swestrup" target="_blank">http://www.linkedin.com/in/swestrup</a><br>
<a href="http://technaut.livejournal.com" target="_blank">http://technaut.livejournal.com</a><br><a href="http://sourceforge.net/users/stirlingwestrup" target="_blank">http://sourceforge.net/users/stirlingwestrup</a>
</div>