[cairo] Fwd: cairo_paint() with GPU Buffer

Abimathi Natarajan abimathi08 at gmail.com
Mon Feb 11 10:50:19 UTC 2019


Hi,

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().

However, to improve the performance of my code I need to use this GPU
buffer directly.

Is there a way to make cairo_paint() work faster with uncached memory?

Thanks.


On Mon, Feb 11, 2019, 1:37 ON Uli Schlachter <psychon at znc.in> wrote:

> Hi,
>
> On 11.02.19 08:11, Abimathi Natarajan wrote:
> [...]
> >          The above command will decode the input file (input.mp4) with
> > hardware accelerations(vaapi) and hwmap will directly map the hardware
> >          frames to system memory.
> [...]
> >    - I will directly feed this memory to
> >
> >                 cairo_image_surface_create_for_data ((unsigned char
> > *)buffer, CAIRO_FORMAT_ARGB32,width, height, stride) to create a
> > cairo_surface for the given frame.
>
> From the information you provided, I can only make a guess. My guess is
> that CPU access to the buffer in GPU memory is uncached and thus slow.
>
> You could try copying the image to a buffer in main memory and using
> that copy for cariro_image_surface_create_for_data(). That way
> cairo/pixman get to operate on cached memory.
>
> Cheers,
> Uli
> --
> "Are you preparing for another war, Plutarch?" I ask.
> "Oh, not now. Now we're in that sweet period where
> everyone agrees that our recent horrors should never
> be repeated," he says.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20190211/ab57cb2f/attachment.html>


More information about the cairo mailing list