Need Information on setting up Hardware Memory Buffers

Stirling Westrup swestrup at gmail.com
Mon Aug 12 12:05:30 PDT 2013


Thanks for the info!


On Mon, Aug 12, 2013 at 2:35 PM, Carlos Rafael Giani
<dv at pseudoterminal.org>wrote:

>  On 2013-08-12 19:55, Stirling Westrup wrote:
>
>  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.
>
>  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.
>
>  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.
>
> --
> Stirling Westrup
> Programmer, Entrepreneur.
> https://www.linkedin.com/e/fpf/77228
> http://www.linkedin.com/in/swestrup
> http://technaut.livejournal.com
> http://sourceforge.net/users/stirlingwestrup
>
>
> _______________________________________________
> gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.orghttp://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> Hello, I have recently written a plugin which also passes around hardware
> buffers, so here are my comments.
>
> You need these components: a buffer pool, an allocator, a metadata type,
> and a memory type.
>
> The memory type is derived from GstMemory, and extends it by whatever you
> need for the OpenCL buffers (id's, addresses etc.)
> The allocator is used to allocate your custom memory blocks.
> The metadata is necessary to let downstream elements know that the buffers
> you are sending them contain OpenCL specific stuff.
> 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.
>
> 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.
>
> 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.
>
> cheers
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>


-- 
Stirling Westrup
Programmer, Entrepreneur.
https://www.linkedin.com/e/fpf/77228
http://www.linkedin.com/in/swestrup
http://technaut.livejournal.com
http://sourceforge.net/users/stirlingwestrup
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130812/17097e14/attachment.html>


More information about the gstreamer-devel mailing list