Sunday, March 08, 2009

Make Intel 82845G/GL/GE card 3D Acceleration work on openSUSE 11.1.

This weekend I decided to update my home PC from openSUSE 10.2 to openSUSE 11.1.
After finishing the update, when X server starts, the OS stuck.
Re-configure my card using sax2, got vesa driver, without any 3D acceleration.

Using my card vendor id and device id searching on google, found a bug on launchpad, and it recommended to add this to xorg.conf in device section:
Option "NoAccel" "true" # works around LPB 304871 - probably disables the next two.

And the driver prints "failed to init memory manager", using git clone to get intel driver code, find the message in code:
if (!xf86InitFBManager(pScreen, &(pI810->FbMemBox))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to init memory manager\n");
return FALSE;

And google xf86InitFBManager, found it was related to XAA. Reading man intel, find:
Option "AccelMethod" "string"
Choose acceleration architecture, either "XAA" or "EXA".
So I tried to remove "NoAccel", and add the following line to xorg.conf:
Option "AccelMethod" "XAA".

Last more than 20 changes to xorg.conf, failed to start Xserver, but for this time, the Xserver starts normally, and running glxgears, the performance is the same as before.
Oh, I got the 3D acceleration back again.

After the Xserver is OK, I checked the src/i810_driver.c file again. I found that it doesn't include exa.h. So it seems not support EXA, but by default, the EXA is chosen instead of XAA, so this is the cause of the problem.

PS: my card id:
Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device [8086:2562] (rev 01)

Switch Editor from Vim to Emacs.

Recently I begin to maintain a new project in SUSE Linux, glad to return the C++ world. The new project is tough, but more challenging, so the last month is very busy.

On Feb 10, I am trying to switch editor to emacs. In the past, I use emacs for my own project, and use vim to make patches for SUSE Linux. But I still feel uncomfortable on mode editor like vim, already get used to mode-less editor. But I didn't know how to use emacs to browse function definitions in large projects before, finally I settled this.

First, turn cua-mode on, by which you can use Ctrl-X, Ctrl-C, Ctrl-V, for cut, copy, paste, and Ctrl-Z for undo.

Then use ctags or etags to generate TAGS files.
And enable emacs to browse multiple function definitions in C++ by using etags-select.el.
Here are the URL:

Now browsing C++ code is easy, but the code completion still does not work. It doesn't matter I don't rely on code completion much now.

PS: command examples for generating TAGS file.
$ctags -eR .
$find \( -name '*.h' -or -name '*.cpp' \) -print | etags -