Ubuntu Nvidia Compiz “Black Window Bug” Fix

Black Window Bug

Some Nvidia graphics cards suffer from a bug called the “Black Window Bug” when running Compiz (the Linux 3D desktop). The Nvidia drivers will stop rendering windows after a certain memory limit has been reached. This is a known Nvidia driver bug and has been fixed but did not make it into the Ubuntu Gutsy 7.10 release. Fortunately, there is a fairly simple fix.

BWB Fix

  1. Download the fixed file and use Archive Manager to unzip the file to your desktop.
  2. Open a terminal (Applications->Accessories->Terminal).
  3. Back up the broken file by entering the following command into the terminal (without the ‘$’). No output should show:
    $ cp /usr/bin/compiz ~/Desktop/compiz.back
  4. Replace the broken file by entering the following command into the terminal (without the ‘$’). You should have to enter your password after entering the command for the command to run. No output should show besides the password prompt:
    $ sudo cp ~/Desktop/compiz-manager/compiz-manager /usr/bin/compiz
  5. Enable the fix by entering the following command into the terminal (without the ‘$’). No output should show:
    $ echo "INDIRECT=yes" > ~/.config/compiz/compiz-manager
  6. Close all your programs and restart X by hitting Ctrl + Alt + Backspace.

Reverting “the Fix”

When the fixed version of the Nvidia drivers are packaged into the next release of Ubuntu, to undo this “fix,” simply remove the .config/compiz/compiz-manager file. Other fixes for this problem do exists, though I feel they are harder and more risky.

More “Fix” Details

There are two things causing the BWB. The first is that indirect rendering needs to be enabled to work around the Nvidia driver bug. That’s what the “$ echo “INDIRECT=yes” > [...]” command does. The second problem is that compiz has a bug where it doesn’t read the setting that the former line is intended to direct. The file I’ve linked too is an official development version of the file that takes care of reading the indirect rendering setting.

    None Found
  • an onymous
    I encountered this with a 256MB nvidia 6600GT AGP card when the 'AGP Aperture size' in the BIOS was set to a value lower than the amount of memory on the video card. After upping the value in the BIOS, the problem went away.
  • noob ubuntu
    THANK YOU
  • Zeljko
    Hi, you have solved bwb issue, but after applying this patch desktop environment is not as responsive as it used to be. Windows are 20-30% slower, even my coursor lags sometimes. Overall feeling in use is like I have downgraded my machine.. could you help me with this?
  • I'm no expert but this could be a result of using indirect rendering. Indirect rendering, if I recall correctly, means all the desktop rendering is done through the X server which then renders on the graphics card instead of rendering straight from compiz to the graphics card. Extra buffers are introduced in this case. If you are experiencing slowdowns when using indirect rendering, chances are the problem is somewhere in there. I'll try to look into this more when I get a chance.

    Looks like for now you unfortunately have either the direct rendering BWB or the indirect rendering desktop slowdown. Let me know if you can fix either of these problems. Hopefully an Nvidia fix to the direct rendering reaches stable distros soon.
  • RobTaintor
    Thank you very much for this fix. It seems so far that it has been very effective. I will update if I run into another problem. Keep up the good work
  • Thanks a lot! I'm just trying to help.
  • Chino
    PSS: Wiat a moment... then "The second problem is that compiz has a bug where it doesn’t read the setting that the former line is intended to direct. The file I’ve linked too is an official development version of the file that takes care of reading the indirect rendering setting. " so when we moved this file to the /usr/bin/compiz we told the compiz-fusion to look for the other file we created afterwards.... Now it makes sense.

    Thanks a lot, LukeHoersten. This is as you said a lot easier than othe fixes, even for me who is a newbie with linux, just a matter of understand some things. I'll make sure to paste this link whenever I see the BWB mentioned :-). Awesome work, keep it up, regards.
  • It looks like you understand. If you've done everything correctly, you should never see any black windows as far as I know (I'm no expert though).
  • Chino
    PS. I mean I undesrtand that with indirect rendering the windows are painted in a different way, which is probably why it solves the BWB problem, but the reason why compiz nows it has to pickup that file that did not exist before intrigues me....
  • Chino
    Hi there, that problem with the windows rendering at in a weird part of the screen was solved by enabling place-window plugin of compiz.

    Since I intalled the new Nvidia Driver with envy (and finally getting ubuntu to use it by modifyong the xorg.conf, by some strange reason it was always configuring my laptop LCD in a weird resolution and not telling ubuntu to use nvidia driver instead of vesa anyways...) the appearing of the BWB has been less frequent but it still occurs, I did what you suggested and it's actually working awesome I have like Twelve windows opened on the same desktop, no way I could do that before even after installing the new nVidia Driver.

    But I have some doubts, I did not have that file inside that folder before (I checked) how does compiz now it has to go there and use it, I actually don't get it, Could you pls explain a little to know why it worked?
blog comments powered by Disqus