New acceleration architecture

Zack Rusin zrusin at trolltech.com
Sat Jun 25 09:20:11 PDT 2005


As some of you know I've been working on bringing in KAA to X.Org to 
replace XAA.

XAA is nowhere near being enough for the modern desktop usage. It's 
plagued by being rather complex and incapable of properly accelerating 
XRender. 
The two main goals of our new acceleration architecture were:
1) properly accelerating XRender,
2) being as simple as possible.
The first one is aimed at making sure that people can run composite 
manager on very low end hardware for as long as Xgl isn't ready to go 
mainstream. The second was set to make the transition as simple as 
possible for driver developers.
That's exactly what the new architecture achieves. For the purpose of 
this email lets call the new acceleration architecture Exa. It's 
heavily based on KAA. It incorporated the memory manager from KDrive 
which does wonders for the common desktop usage.

So lets get to the question everyone wants to ask and that is: how do I 
get a usable xcompmgr with the new architecture? 

1) include "exa.h" in your driver and load exa,
2) use the code from XAA primitives for solid-fills and screentoscreen 
copies to implement Exa's Solid and Copy hooks. So no real changes at 
this point. 
3) create an ExaDriverRec structure and fill in the accel hooks.
4) call exaCardInit(exaDriver, memory_base, off_screen_base,
	memory_size, offscreen_byte_align, offscreen_pitch,
	flags, max_x, max_y); to let the system know what are the 
capabilities of your card. This is really a convenience macro and you 
may fill in all those individually if you prefer that.
5) exaDriverInit(pScreen, exaDriver); once you connected yours hooks and 
setup your card.
6) replace xf86AllocateOffscreenArea with calls to ExaOffscreenAlloc

This should be enough to get a more less usable xcompmgr on your 
hardware.

Now if your hardware is below 1.5ghz you want to implement two more 
hooks:
- DownloadFromScreen,
- UploadToScreen,
this should be enough to get you happy with the basic composite manager 
on any hardware.

Now if the transparent windows aren't enough and you want things to be 
way more fancy, implement the last of Exa hooks meaning the Composite 
hooks. I'm planning to write a paper sometime early next week on how to 
implement composite acceleration and DownloadFromScreen/UploadToScreen 
hooks in a simplest/best manner on typical hardware. So don't worry if 
you're not certain about how to do it quite yet.

All in all the code is available at:
http://ktown.kde.org/~zrusin/dev/exa-snapshot.tar.bz2

I'll be here to respond to any questions. If there's anything you think 
is silly, I'll be more than happy to change it. 

I refuse to add acceleration hooks for low level primitives (e.g. 
lines). At this day and age it really just doesn't make any sense. 

I will also provide a sample ATI R200 driver implementation (didn't feel 
like cleaning it up today :) ) along a document on how to implement 
composite acceleration sometime next week. All the cards which don't 
currently have a maintainer but are using XAA will be ported by me, as 
soon as I get the respective hardware in my hands.

I want to make sure the following things are very clear:
1) Exa can coexist with XAA. You can keep code for both in your driver.
2) Exa doesn't depend on any changes to the Xserver. Once we'll feel it 
served its purpose we can simply remove the exa dir and the relevant 
driver code and we'll be sure that no cruft has been left in the 
server.
3) As everyone can see adding Exa support to a driver which already has 
XAA support is trivial. 
4) Following the 7 steps I outlined above will speed up the common 
desktop usage by quite a bit. Note that you don't have to be a driver 
developer to switch any of those drivers. Note that this also means 
that we can easily give the useless, but oh-so-wanted transparent 
windows to everyone right now. Not next year, not when library X will 
be ready - now, as in today. 
5) Implementing the download/upload/composite hooks will give us enough 
power to have very fancy effects that will let us compete with 
Microsoft/Apple desktops while we work on Xgl.
6) The code as presented in the snapshot will be checked in on Monday 
morning/Sunday night, dependently on the feedback I'm going to get.

Zack

-- 
"Share your knowledge. It is a way to achieve immortality."(The Dalai 
Lama)



More information about the xorg mailing list