Fwd: cairo_paint() with GPU Buffer
Abimathi Natarajan <[email protected]> Mon, 11 Feb 2019 12:41:30 +0530
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAPxWy4h_=7qsjsyLfcx4CR2EC3ACQSxLc_rmKQPs_PzKN0uj+Q@mail.gmail.com> |
---------- Forwarded message --------- From: Abimathi Natarajan <[email protected]> Date: Thu, Feb 7, 2019, 6:27 PM Subject: Re: [cairo] cairo_paint() with GPU Buffer To: Uli Schlachter <[email protected]> Hi, My sample code contains two parts, PART 1 ------------ - Decoding an input file using ffmpeg and get raw buffers (GPU allocated within FFMPEG ) in rgb32 format. My code does exactly what the below ffmpeg command does. ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.mp4 -vf 'scale_vaapi,hwmap=mode=read+write+direct,format=rgb32' output.rgb 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. PART 2 ---------- - 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. - cairo_paint() in https://github.com/wayland-project/weston/blob/master/clients/image.c#L160 will paint the cairo_surface over weston compositor. - When we measured the time taken by this API to paint the GPU buffer, we observed it took approximately 400 ms to paint a single 4k frame. - The github link is not my actual sample code, However my application uses similar flow only. (I'm using cairo with weston compositor). On Wed, Feb 6, 2019, 12:40 AM Uli Schlachter <[email protected]> wrote: > Hi, > > On 05.02.19 07:16, Abimathi Natarajan wrote: > > I'm implementing a sample program with Weston to render video (decoded > > using ffmpeg VAAPI) frames using Cairo graphics. > > Each frame is of 4k size > > How complicated is your example program? Do you have a link to it or can > you send it by mail? > > > I'm passing GPU buffer directly to cairo_image_surface_create_for_data() > to > > create a cairo_surface for each frame. > > When I render the buffer using cairo_paint() , the API is taking > > approximately 400 ms for each buffer. > > Uhm, can you tell us more about the cairo_paint() call? I assume you are > copying from the image surface that you created. Where are you copying > to? Is it just the call to cairo_paint() that takes so long or did you > measure more than just that? > > Also, what exactly does "I'm passing GPU buffer directly" mean? Is the > GPU memory directly accessible to the CPU? If so, I would expect this to > be uncached and slow, which is why I am asking. > > Cheers, > Uli > -- > Homophobia - The fear that another man will treat you the way you treat > women. > -- cairo mailing list [email protected] https://lists.cairographics.org/mailman/listinfo/cairo