[cairo] Threaded animation with cairo_gl backend over a GtkWidget
Carlos López González
genetita at gmail.com
Tue Jan 15 11:39:35 PST 2013
I've modified the mentioned Cairo animation with miltithreading example 
to use a cairo_gl_surface, expecting to have some GPU acceleration. It
works fine (doesn't crash) but when I use a cairo_gl_surface it runs much
slow than when I use a image surface (!). See code here:
commenting the line at 135 and 137 I can use cairo_image or cairo_gl.
Same code has been compiled and run in a iMac 2011 using XQuarz as Xserver
with the same result.
Am I missing something at the cairo_gl code or simply I would never could
make use of my GPU in my linux laptop or my iMac?
I appreciate any help.
2013/1/15 Carlos López González <genetita at gmail.com>
> I forgot to CC cairo list
> ---------- Forwarded message ----------
> From: Carlos López González <genetita at gmail.com>
> Date: 2013/1/15
> Subject: Re: [cairo] Threaded animation with cairo_gl backend over a
> To: Uli Schlachter <psychon at znc.in>
> I've upgraded to Ubuntu 12.10 and as part of the upgrade Ubuntu disabled
> the proprietary nvidia driver.
> With the the nouveau driver enabled and simply enable multithreading, it
> carlos at laptop:~/my-test-area/build$ LANG=C ./cairo-sample
> [xcb] Unknown request in queue while dequeuing
> [xcb] Most likely this is a multi-threaded client and XInitThreads has not
> been called
> [xcb] Aborting, sorry about that.
> cairo-sample: ../../src/xcb_io.c:178: dequeue_pending_request: Assertion
> `!xcb_xlib_unknown_req_in_deq' failed.
> Abortado (`core' generado)
> But when add XIniThreads() as shown in the previous post, it doesn't
> crash but it runs *extremely* slow (?). I'm using a GeForce 8400M GS
> graphic card (glxgears runs smoothly).
> If I enable the private nvidia-current driver it crashes in any case with
> the same message than I had before. The suggested breakpoint or the --sync
> option doesn't help much.
> So which are my alternatives?
> If I create the cairo_gl_surface but not using
> cairo_gl_surface_create_for_window but the cairo_gl_create_surface, would
> it have GPU acceleration as well?
> I just want to create a minimal example of multithreading drawing over a
> gtkwidget using cairo_gl to later translate to a bigger application, but it
> seems that it is impossible.
> Is there any *real* application that uses Cairo with GPU acceleration in
> 2013/1/14 Uli Schlachter <psychon at znc.in>
>> On 14.01.2013 21:24, Carlos López González wrote:
>> > The program 'cairo-sample' received an X Window System error.
>> > This probably reflects a bug in the program.
>> > The error was 'BadMatch (invalid parameter attributes)'.
>> > (Details: serial 230 error_code 8 request_code 135 minor_code 5)
>> minor_code 5 likely is DRI2's GetBuffer request, but could also be a
>> RANDRGetScreenInfo, RenderChangePicture, SHAPEQueryExtents,
>> SHMCreatePixmap or
>> SyncQueryCounter. Of course, this doesn't really help us (does it?).
>> > (Note to programmers: normally, X errors are reported asynchronously;
>> > that is, you will receive the error a while after causing it.
>> > To debug your program, run it with the --sync command line
>> > option to change this behavior. You can then get a meaningful
>> > backtrace from your debugger if you break on the gdk_x_error()
>> do "break gdk_x_error" before you "run" the program.
>> > [Thread 0xb4738b40 (LWP 3625) exited]
>> > [Thread 0xb54ffb40 (LWP 3624) exited]
>> > [Thread 0xb6224880 (LWP 3620) exited]
>> > [Inferior 1 (process 3620) exited with code 01]
>> > (gdb) where
>> > No stack.
>> > (gdb)
>> > How can I add the --sync option?
>> If the program supports this option: "run --sync".
>> "Why make things difficult, when it is possible to make them cryptic
>> and totally illogical, with just a little bit more effort?" -- A. P. J.
>> cairo mailing list
>> cairo at cairographics.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cairo