<div dir="ltr"><div style>Hi!</div>I've modified the mentioned Cairo animation with miltithreading example [1] 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:<div>
<a href="https://github.com/genete/my-test-area/blob/direct_draw/src/cairo_sample.c">https://github.com/genete/my-test-area/blob/direct_draw/src/cairo_sample.c</a><br><div class="gmail_extra"><br></div><div class="gmail_extra">
commenting the line at 135 and 137 I can use cairo_image or cairo_gl.</div><div class="gmail_extra"><br>Same code has been compiled and run in a iMac 2011 using XQuarz as Xserver with the same result. </div><div class="gmail_extra">
<br></div><div class="gmail_extra" style>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?</div><div class="gmail_extra"><br></div><div class="gmail_extra" style>
I appreciate any help.</div><div class="gmail_extra" style>Thanks!</div><div class="gmail_extra"><br></div><div class="gmail_extra">[1] <a href="http://cairographics.org/threaded_animation_with_cairo/">http://cairographics.org/threaded_animation_with_cairo/</a><br>
<br><div class="gmail_quote">2013/1/15 Carlos López González <span dir="ltr"><<a href="mailto:genetita@gmail.com" target="_blank">genetita@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr">I forgot to CC cairo list<br><br><div class="gmail_quote"><div class="im">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Carlos López González</b> <span dir="ltr"><<a href="mailto:genetita@gmail.com" target="_blank">genetita@gmail.com</a>></span><br>

Date: 2013/1/15<br>Subject: Re: [cairo] Threaded animation with cairo_gl backend over a GtkWidget<br></div><div><div class="h5">To: Uli Schlachter <<a href="mailto:psychon@znc.in" target="_blank">psychon@znc.in</a>><br>
<br><br><div dir="ltr">Hi!<br><div>I've upgraded to Ubuntu 12.10 and as part of the upgrade Ubuntu disabled the proprietary nvidia driver.  </div>
<div>With the  the nouveau driver enabled and simply enable multithreading, it crash. </div>
<div>
<br></div><div><div>carlos@laptop:~/my-test-area/build$ LANG=C ./cairo-sample </div><div>[xcb] Unknown request in queue while dequeuing</div><div>[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called</div>


<div>[xcb] Aborting, sorry about that.</div><div>cairo-sample: ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.</div><div>Abortado (`core' generado)</div></div><div>


<br></div><div>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). </div><div><br></div>


<div>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.</div>


<div><br></div><div>So which are my alternatives?</div><div><br></div><div>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?</div>


<div><br></div><div>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.</div><div><br>
</div><div>Is there any *real* application that uses Cairo with GPU acceleration in production? </div><div><br></div><div>Thanks!</div></div><div class="gmail_extra"><div><div><br><br><div class="gmail_quote">
2013/1/14 Uli Schlachter <span dir="ltr"><<a href="mailto:psychon@znc.in" target="_blank">psychon@znc.in</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<br>
On 14.01.2013 21:24, Carlos López González wrote:<br>
[...]<br>
<div>> The program 'cairo-sample' received an X Window System error.<br>
> This probably reflects a bug in the program.<br>
> The error was 'BadMatch (invalid parameter attributes)'.<br>
>   (Details: serial 230 error_code 8 request_code 135 minor_code 5)<br>
<br>
</div>minor_code 5 likely is DRI2's GetBuffer request, but could also be a<br>
RANDRGetScreenInfo, RenderChangePicture, SHAPEQueryExtents, SHMCreatePixmap or<br>
SyncQueryCounter. Of course, this doesn't really help us (does it?).<br>
<br>
[...]<br>
<div>>   (Note to programmers: normally, X errors are reported asynchronously;<br>
>    that is, you will receive the error a while after causing it.<br>
>    To debug your program, run it with the --sync command line<br>
>    option to change this behavior. You can then get a meaningful<br>
>    backtrace from your debugger if you break on the gdk_x_error() function.)<br>
<br>
</div>do "break gdk_x_error" before you "run" the program.<br>
<div><br>
> [Thread 0xb4738b40 (LWP 3625) exited]<br>
> [Thread 0xb54ffb40 (LWP 3624) exited]<br>
> [Thread 0xb6224880 (LWP 3620) exited]<br>
> [Inferior 1 (process 3620) exited with code 01]<br>
> (gdb) where<br>
> No stack.<br>
> (gdb)<br>
><br>
><br>
> How can I add the --sync option?<br>
<br>
</div>If the program supports this option: "run --sync".<br>
<br>
Uli<br>
<span><font color="#888888">--<br>
"Why make things difficult, when it is possible to make them cryptic<br>
and totally illogical, with just a little bit more effort?" -- A. P. J.<br>
--<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org" target="_blank">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br>Carlos<br><a href="http://synfig.org" target="_blank">http://synfig.org</a><br>
</font></span></div>
</div></div></div><span class=""><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Carlos<br><a href="http://synfig.org" target="_blank">http://synfig.org</a><br>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Carlos<br><a href="http://synfig.org" target="_blank">http://synfig.org</a><br>
</div></div></div>