Saturday, August 18, 2007

GLX_EXT_texture_from_pixmap is missing compiz error with gutsy

I've been trying out Ubuntu's latest gutsy gibbon development version for a while now. The newest shiny, compiz (compiz fusion as of this week) was working very nicely with the open source radeon driver and AIGLX with no particular changes except xorg.conf tweaking on my old laptop (IBM T41p). Always a lover of newer and shinier, I upgraded to a T60p laptop. The open source radeon driver doesn't support the more recent ATI graphics cards. The T60p has an ATI MOBILITY FireGL V5200. The proprietary driver from ATI, fglrx, works fine with the new card (but not with older ones now!). However, it doesn't support AIGLX, so no compiz.

You then follow one of the many howtos out there to get compiz working with the fglrx driver by using Xgl. All working fine. Soon though, I began to suffer compiz (the window manager) not starting when I logged into X. In ~/.xsession.errors you can see these errors:

compiz.real: GLX_EXT_texture_from_pixmap is missing
compiz.real: Failed to manage screen: 0
compiz.real: No managable screens found on display :1.0

You get a terminal window, but no window manager. Starting compiz manually always works first time. What gives? It turns out that the fglrx driver is missing the GLX_EXT_texture_from_pixmap capability and to provide this you need to LD_PRELOAD the libGL shared object library that the Mesa driver provides (and fglrx replaces). This works just fine:

LD_PRELOAD=/usr/lib/fglrx/ /usr/bin/compiz.real --ignore-desktop-hints --indirect-rendering --replace ccp &

However, so does this:

/usr/bin/compiz --ignore-desktop-hints --indirect-rendering --replace ccp &

Huh? The wrapper script in gutsy, /usr/bin/compiz, detects and sets up the environment as needed. The problem is if you have Gnome set to save your session on logout. Gnome saves the currently running processes and assumes they can be started in the same way. So it tries to start compiz.real on login without the LD_PRELOAD variable set, resulting in the error messages you see in ~/.xsession-errors.

To confirm, try this:

$ grep compiz ~/.gnome2/session

10,CloneCommand=/usr/bin/compiz.real --ignore-desktop-hints --indirect-rendering --replace ccp
10,RestartCommand=/usr/bin/compiz.real --ignore-desktop-hints --indirect-rendering --replace ccp

The initial number will vary. Check in System > Preferences > Sessions and uncheck "Automatically remember running applications when logging out" in the Session Options tab. Delete your session file (rm ~/.gnome2/session) and logout and back into X to verify.