[Xquartz-dev] Porting XCopyArea to plain OS X

Platon Fomichev pfomichev at elverils.com
Tue May 12 13:31:58 PDT 2009

Dear List members

I've been looking inside the XScreenSaver package to understand some  
specifics about X11 stuff and I stumbled upon pretty big performance  
problem in port where the author himself acknowledges he is currently  
unaware what to do. The author replaced XCopyArea with something like  

If source is 'WINDOW'

     // get the bits (desired sub-rectangle) out of the NSView via  
     NSBitmapImageRep *bm = [NSBitmapImageRep alloc];
     [bm initWithFocusedViewRect:nsfrom];
     unsigned char *data = [bm bitmapData];
     int bps = [bm bitsPerSample];
     int bpp = [bm bitsPerPixel];
     int bpl = [bm bytesPerRow];
     releaseme = bm;


  CGDataProviderCreateWithData(.. data .. )

It's quite an overkill - check http://jwz.livejournal.com/628118.html  
for more information.

So the question is - what to do in order to move bits faster in  
window backing store or whatever i.e. get as close to the real buffer  
as possible. Lots of stuff hint as libXPlugin as a source of  
'acceleration' for X Server. Is there any way to get a public API for  
it as well as documentation. May be there is some info on  
CGBlt_copyBytes function in CoreGraphics as well?

I am also quite at a loss - I looked at SDL code - they use QuickDraw  
to get access to video buffer content, yet QuickDraw is deprecated..  
So what's the fastest possible memory to draw to window, access and  
modify it's internal backing store?

Best regards,

More information about the Xquartz-dev mailing list