[gst-devel] How to fit in a GPU accelerated rendering plugin

Simon Holm Thøgersen odie at cs.aau.dk
Sat Dec 15 20:56:44 CET 2007

lør, 15 12 2007 kl. 18:00 +0100, skrev Wladimir van der Laan:
>         I think you could augment the capabilities for your plugin
>         with a
>         property that says this is an opengl handle for a texture, and
>         write
>         your own sink that accepts capabilities correspondingly and
>         actually
>         shows the texture somehow. 
> This was close to what I had in mind, thanks. 
>         To allow for still downloading the rendered
>         frame from GPU to CPU memory you could write a plugin that
>         does exactly 
>         that conversion. I could also be just completely rambling
>         though :)
> Can a plugin detect somehow what its output expects? Could I do
> something like 'if attached to a normal plugin, download the video
> data to the CPU, if attached to a GPU plugin, pass pointer on GPU'. 

The capability matching system will take care of that given the scheme I
outlined. If your decoder element's src caps always have a special "GPU"
property, it will require that the receiver element's sink caps have
that special property too, in order to match. To allow the decoded image
to be used in a "CPU" pipeline, just do an element with the "GPU"
property on the sink pad and without the "GPU" property on the source

> Now that I think of it, I'd need something analogous to 'pads' but
> then in GPU memory to store the immediate result, and still have it
> pipeline nicely.
Just use pads. What you really want that is a bit special, is your own
buffer that extends GstBuffer that can keep track on allocation of
opengl resources.

>         It is indeed interesting and you should post your source code
>         somewhere :)
> I certainly will, probably after I solve these loose ends. At least I
> have everything working now, so I can think about details like
> this :) 
This would already be interesting too see :)

> If it turns out too complicated I'll first publish the version that
> downloads back, optimizations can always be added in the future.

Yeah. Happy coding.

Oh, btw, what are the performance numbers of the gpu vs cpu version? And
please supply hardware details.

Simon Holm Thøgersen

More information about the gstreamer-devel mailing list