[cairo] Fwd: cairo_paint() with GPU Buffer

Theo Veenker theo.veenker at beexy.nl
Thu Feb 14 20:51:12 UTC 2019


On 13/02/19 16:18, Uli Schlachter wrote:
> Hi,
> 
> On 11.02.19 11:50, Abimathi Natarajan wrote:
>> I have tried using "av_hwframe_transfer_data()" API in FFMPEG to transfer
>> GPU memory to CPU which takes approximately 16ms for a 4k frame and then
>> passing that memory to cariro_image_surface_create_for_data().
> 
> that's already 25 times faster than the original code. I guess this
> means my theory was right.
> 
>> However, to improve the performance of my code I need to use this GPU
>> buffer directly.
> 
> Okay, can you do that somehow? I mean, can you somehow use GL to draw
> things? From my limited understanding that should avoid a round-trip to
> the GPU.
> 
>> Is there a way to make cairo_paint() work faster with uncached memory?

My 2 cents. If you already have the image on the GPU side you should 
problably use some GPU call to have transfer it to the target window and 
use cairo only to draw your primitives onto that window. A scenario like 
that would avoid the full cairo_paint(). Note, a simple memcpy() of a 4k 
frame already will take 5-7ms and I guess cairo-paint would take even 
longer (not sure), so you should try to avoid copying/painting rather 
than trying to speeding it up. If possible.

Theo

-- 
Theo Veenker  |  Beexy - Behavioral Experiment Software
+31(0)524-541531  |  +31(0)6-42525777 mobile
theo.veenker at beexy.nl  |  www.beexy.nl


More information about the cairo mailing list