Re: Hardware accelerated 2D graphics (with gtk-osx)



On 1 Aug 2010, at 21:49, Kristian Rietveld wrote:

On Jul 27, 2010, at 10:49 AM, John Emmas wrote:
Under Windows and Linux the (2D) scrolling display is smooth.  But under OS-X it's horribly jerky and has 
a very 'klunky' look to it.  I happen to be viewing it on a Mac Mini but other people have seen the same 
effect with more powerful machines.  It isn't a processor issue because even with my lowly Mac Mini, the 
cpu usage rarely gets higher than about 30 percent.

On my Macs the GTK+ graphics rendering is pretty fast.  There might have been issues in the past, but 
recent GTK+ releases should be pretty good.

That said, some people do see performance issues that cannot be reproduced on other machines, for example 
https://bugzilla.gnome.org/show_bug.cgi?id=615917.  What exactly is causing this and whether this is 
hardware-specific still has to be found out.  We need to collect GTK+ version in use and hardware details 
in these cases.

My guess is either that gtk-osx isn't using any technology that's compatible with Quartz Compositor - or 
if it is, it's maybe using QuartzGL.  Disappointingly, QuartzGL DISABLES 2D hardware acceleration by 
default and I'm wondering if this might explain the poor performance that we observe under OS-X?  As I 
said earlier, Windows and Linux are both fine.

GTK+ OSX does all drawing using CoreGraphics, this should be hardware-accelerated whenever possible.


This morning I installed Apple's developer tools which include a utility called the Quartz Debug Application. 
 This allows you to enable and disable certain graphical features and see what affect they have on your 
program's graphics performance.  The first thing I noticed was that the option to disable 2D hardware 
acceleration seems to be working the wrong way around.  Checking the box to disable 2D acceleration initially 
had no effect.  Unchecking it though (i.e. theoretically enabling acceleration) made my scrolling performance 
considerably worse.  My impression is that the checkbox seems to be wrongly worded which might explain why so 
many people believe that 2D hardware acceleration is disabled by default.  Either that or the wikipedia 
article is right and enabling 2D hardware acceleration on a Mac can actually degrade the graphics performance 
(!).

Whatever the truth of the matter, one option that made a huge improvement to my canvas scrolling was the 
setting called "Autoflush drawing".  I assume that this must execute all drawing operations immediately, 
instead of trying to intelligently queue them.  So it looks as if some judiciously placed flush calls might 
be all I need to improve the problem of my poor GTK canvas scrolling.

Before I go around adding flush calls willy-nilly, I just wondered if there's any API call in GTK/GDK that 
might already "auto flush" my canvas drawing operations automatically?  If so, I'd like to experiment with 
it.  If not, I'll just have to figure out some sensible places in my code where I can flush the drawing 
operations.

Thanks,

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]