title: X11 GUI performance
body: <p>I am working on a portable GUI toolkit for Linux and Windows and stuck on some performance problem. On several systems (as my netbook based on the infamous Intel GMA 3650) is very highly affected by the driver installed. </p>
  
  <p>But what is the paradox, when the fallback VESA driver is installed, the performance of my code is <strong>much higher</strong> than with the dedicated proprietary driver. </p>
  
  <p>On the other hand with the proprietary driver, <strong>as expected</strong> the performance of the computer is very good. Hardware acceleration works, high definition videos are played without problems and this way only <strong>my code</strong> is affected in this strange reverse manner.</p>
  
  <p>My code uses common libraries like Xlib, Xft, pthreads, etc.</p>
  
  <p>The Windows port (uses WinApi) runs in great speed without any problems. Even in Wine. As an another paradox, the same program, compiled for Windows and running in WINE draws much faster than the Linux compiled program.</p>
  
  <p>What can be the reason for this effect and where to dig in order to fix it.</p>
  
  <p>The source code repository is <a href="http://fresh.flatassembler.net/fossil/repo/fresh/index" rel="nofollow">managed by fossil scm</a></p>
  
  <p>One test example is in <code>trunk/freshlib/TestFreshLib.fpr</code> (for plain FASM compile <code>freshlib/test_code0/TestLib.asm</code>)</p>
  
  <p>This is portable example and can be compiled for Windows and Linux as well.</p>
  
  <p><strong>Update 1:</strong> After some thought and code exploration, I have an hypothesis. I am using two different methods to draw the graphics on the windows:</p>
  
  <ol>
  <li>Using XLib drawing functions for drawing lines and rectangles.</li>
  <li>Using Xft library to draw the texts. </li>
  </ol>
  
  <p>The controls I am testing use double buffering where the image buffer is a pixmap on the server side. </p>
  
  <p>But IIRC, Xft draws on the client side and then sends the image as a bitmap image to the X server, while XLib draws directly on the server side. </p>
  
  <p>Is it possible some conflict between these two methods (and somehow connection with the hardware acceleration) to cause this performance degradation?</p>