Screen flickering with nvidia on ubuntu 20
Another nasty side effect of using compiz with an nvidia video card is the screen flickering. Right when a compiz 3D effect kicks in or 30 seconds after it, the screen goes black for a fraction of a second. This is not a new issue, I have struggled with it since hardy and it happens with all nvidia driver versions I can remember (173, 177 and 180).
Cause The cause the is the Powermizer feature of the nvidia driver. It adjusts the GPU speed depending on the usage that is being made of the desktop. Every time Powermizer decides to change the frequency, the screen flickers. You can easily verify that by going to the "Nvidia X Server Settings" panel, Powermizer. Watch the "Performance Levels" and see how the level changes every time the screen flickers.
Solutions There are many related posts on the web. The most common solution that gets reported is described for example at Linux Outlaws Forum. Add the following lines to /etc/modprobe.d/options:
options nvidia NVreg_RegistryDwords='PerfLevelSrc=0x2222' options nvidia NVreg_Mobile=1
It didn’t worked for me in Intreprid or older Ubuntu releases.
So the real solution that does completely works for me is to freeze the powermizer performance level to 0 through the "Nvidia X Server Settings" panel in the "Clock frequencies" pane. But that panel is only available after setting the "Coolbits" option in /etc/X11/xorg.conf in the screen section. For example, this is what I have:
Section "Screen"
Identifier 'Default Screen'
Device 'nVidia Corporation G72M [Quadro NVS 110M/GeForce Go 7300]'
Monitor 'Generic Monitor'
Option 'AddARGBVisuals' 'True'
Option 'NoLogo' 'True'
Option 'RenderAccel' 'True'
Option 'Coolbits' '1'
Option 'RegistryDwords' 'PowerMizerLevel=0x3'
Option 'AddARGBGLXVisuals' 'True'
DefaultDepth 24
SubSection 'Display'
Depth 24
Modes '1680x1050'
EndSubSection
EndSection
Then after restarting X, you can open the Nvidia setting panel and do the following:
- Go to "Clock frequencies"
- Check the "Enable Overclocking" box and accept the warning
- Select "3D clock frequencies" and pick a GPU and Memory frequency
- Apply
On my 7300 card, setting GPU to 100MHz and Memory to 400MHz works just fine, compiz 3D effects are still very smooth. Unfortunately, this needs to be done every time you restart X. If somebody finds a better solution, please let me know.
Update for Jaunty 9.04 and nvidia 180 (4/24/2009): in Jaunty with 180.44 and xorg 1.6, where the flickering is worst than ever, the solution above with /etc/modprobe.d/options actually works and no there is no need to lock the 3D clock frequency.

thanks so much. I've had this issue with my new iMac that I exclusively use for Ubuntu. I didnt have the flicker in 8.10, but in 9.04 I do.
Great, I'd been looking for a solution to this since jaunty came out as it was very annoying. I didn't have an issue (or I hadn't noticed) with intrepid.
I just added those 2 options to /etc/modprobe.d/options and now no more flicker..
180.44 GeForce Go 7950GTX XPS M1710 laptop....
To make over-clocking settings permanent add/edit the .nvidia-settings-rc file in your home directory and add the following lines at the end:
0/GPUOverclockingState=1 0/GPU2DClockFreqs=xxx,yyy 0/GPU3DClockFreqs=xxx,yyy
change xxx with your GPU freq, yyy with your memory freq numbers lastly change the file permissions to readonly or the NVIDIA utility will overwrite the file reseting your settings
Enjoy
Thank you!
I've been looking for this since I upgraded to Jaunty. The black flashes were really starting to drive me nuts.
Okay, I have tried for three days on end to get rid of the flickering/flashes and nothing seemed to work for my GeForce Go7200 except for a temporary fix:
The problem however is with Nvidia not honoring the settings. The settings simply don't stick and Nvidia keeps doing whatever it wants without check.
Try also inserting "nvidia-settings --load-config-only" in Sessions (Hardy) or in Start-up applications (Jaunty)
Other than that nothing else works on my laptop. No more Nvidia cards - will go to ATI.
I have this same problem but I get lost in your instructions ... what is a zorg? how do you start X, let alone restart it?
For example when you say: "But that panel is only available after setting the "Coolbits" option in /etc/X11/xorg.conf in the screen section."
What exactly are you talking about? How do I get to the "/etc/X11/xorg.con"??? Why would anyone in there right mind name a program like that?
I have made a serious decision to never go back to microsoft, but if even the help instructions on Ubuntu are not easy to follow, I might have to go back to vista and live with pirating ... when do I get to just have a normal operating system that simply works?
Ok so I figured out that /etc/x11/xorg.com is not a program but a path to a file in the C drive. I found the file and added the Option to enable coolbit:
xorg.conf (X.Org X Window System server configuration file)
#
This file was generated by dexconf, the Debian X Configuration tool, using
values from the debconf database.
#
Edit this file with caution, and see the xorg.conf manual page.
(Type "man xorg.conf" at the shell prompt.)
#
This file is automatically updated on xserver-xorg package upgrades only
if it has not been modified since the last upgrade of the xserver-xorg
package.
#
Note that some configuration settings that could be done previously
in this file, now are automatically configured by the server and settings
here are ignored.
#
If you have edited this file but would like it to be automatically updated
again, run the following command:
sudo dpkg-reconfigure -phigh xserver-xorg
Section "Monitor" Identifier "Configured Monitor" EndSection
Section "Screen" Identifier "Default Screen" Monitor "Configured Monitor" Device "Configured Video Device" Option 'Coolbits' '1'
DefaultDepth 24 SubSection "Display" Virtual 1280 1024 EndSubSection EndSection
Section "Module" Load "glx" EndSection
Section "Device" Identifier "Configured Video Device" Driver "nvidia" Option "NoLogo" "True" EndSection
The problem for me is that it is saying I dont have permission to change the file .... So I cant save it. What do I do? Is this like a Vista thing where I have to give it administration permission somehow? Did you have the same problem? How do I save this file with the fix??? Help!
There is no instruction on how to get permission to save the file .... can anyone here please tell me how to do so with step by step baby instructions .... im on a terminal typing sudo this sudo that and I dont have a basic understanding of what I am doing, I just want to save the stupid file. I also noticed that no one gives step by step instructions on how to do basic things on ubuntu, its as if you are expected to know how to run a terminal from birth ... in windows you dont need to know how to use dos to mess with it ... why is the ubuntu community still acting like its 1992? Why are there no GUI options? ... now I am remembering why I left ubuntu so many years ago ....
Couldnt figure it out, any help will be greatly appreciated. =(
Cant even save the file ....
I just left 4 comments and they didnt save?!?!?!!!!
I dont know how to save the xorg.conf file, it is asking me for permissions. Please give me step by step instructions on what to do, thank you very much in advance.
finally found something that stopped that flickering!!
ok newbie if you haven't given up already, this is what i did.. i understand your frustration im also new to linux.
step one: add the coolbits option
step two: restart X
step 3: set the clock frequencies
step 4: set the permission of the file to read only
and now you should have no more flickers
Thanks a lot ! Worked perfectly.
Just a note for newbies: I am using Ubuntu Jaunty Jackalope 9.04 with NVIDIA Drivers 185.18.14
The /etc/modprobe.d/options file did not exist in my distribution. I created one, included the two lines that user bikethetam posted before and then saved this file in some other folder. You will need to sudo to move it into /etc/modprobe.d
Problem solved. No need to do anything else.
I wonder why NVIDIA does not include an option in their next driver release to deactivate the PowerMizer.
Thanks folks !
Tried carevalo and Nick's suggestions and screen flicker on ubuntu 9.04 1.85 NV drivers is gone. Thanks for all suggestions guys
I think we have a winner for 9.10 too.
All I did was follow the /etc/modprobe.d/options route.
No flicker.
I actually feel sane again :)
For ubuntu 9.04 and 9.10, the solution explained above using /etc/modprobe.d/options is very simple - just copy/paste in a console the following 3 lines (insert root password when asked):
echo '#Fix for nvidia flickering - (K)ubuntu 9.04 and 9.10' | sudo tee -a /etc/modprobe.d/options
echo 'options nvidia NVreg_RegistryDwords='\''PerfLevelSrc=0x2222'\' | sudo tee -a /etc/modprobe.d/options
echo 'options nvidia NVreg_Mobile=1' | sudo tee -a /etc/modprobe.d/options
Now just reboot and it should be fixed.
If it is not fixed, then this is not the solution to your problem, and you can "undo" the previous changes by executing in a console:
sudo sed -i '/#Fix for nvidia flickering/,+3d' /etc/modprobe.d/options
If the /etc/modprobe.d/option solution didn't work for you (as it happened in my case), then you can try the second solution (using "Coolbits" in /etc/X11/xorg.conf) by simply copy/pasting these commands in a console (give root password when asked):
# To try solution "Coolbits" in /etc/X11/xorg.conf, simply copy/paste in a console__
sudo sed '
/^Section "Screen"$/,/^EndSection$/ {
/^\x09Monitor\x09/ {
a\
\x09Option\x09"Coolbits"\x09"1"
}
}
' -i /etc/X11/xorg.conf
# Restart the computer now
# And discover the values of xxx, yyy and zzz for your nvidia card and change accordingly (for my nvidia 7300go, Nick indicated them as 100,400,270)
xxx=100
yyy=400
zzz=270
echo '0/GPUOverclockingState=1' >> ~/.nvidia-settings-rc
echo '0/GPU2DClockFreqs='"$xxx,$zzz" >> ~/.nvidia-settings-rc
echo '0/GPU3DClockFreqs='"$xxx,$yyy" >> ~/.nvidia-settings-rc
# Restart the computer again, and if this solution worked the flicker should have stopped
If the "Coolbits" solution didn't solved your problem, then you can "undo" the changes made, executing the following:
# To "Undo" the "Coolbits" solution, simply copy/paste in a console
sudo sed '
/^Section "Screen"$/,/^EndSection$/ {
/^\x09Option\x09"Coolbits"\x09"1"/ {
d
}
}
' -i /etc/X11/xorg.conf
sed '/^0\/GPUOverclockingState=1/d; /^0\/GPU2DClockFreqs=/d; /^0\/GPU3DClockFreqs=/d' -i ~/.nvidia-settings-rc
# Restart the computer now - all the changes have been rolled back
PD: these 2 last posts pretend ease the life for newbies, in such a way that to implement the proposed solutions, one just needs to copy/paste in a console, and if it didn't work, then just "undo" the changes. To make life simple.
Please share your success/problems and we all learn :)
PD2: Webadmin, please leave an option to deactivate "Markdown", as many script code gets messed up (like #comment lines... and more...)
Hello there, I have a 8700M GT card and does the same flicker on windoz and linux( regardless the distro ). Its a driver problem. Older drivers are ok ( like 17x) but the new ones are buggy. Thank you nvidia. You need to disable Nividia Powermizer or to set the GPU at a fixed frequency. I don't know if its from the variation of the frequency of the GPU or from its memmory.
none of these solutions have helped. running 9.10. no one will help me, and so my computer has become completely worthless, because i use it to game, and in a live-action battle 2 seconds of black screen can mean death. isnt there any way of making this actually work right? are there NO other options to fix this? shouldnt nvidia have done something about it? are there no other people with this problem that hasnt been fixed by these so-called "fixes"?
DO SOMETHING ABOUT IT AND HELP.
I am also running 9.10, using nvidia-190 drivers. It is still flickering using the solutions above
The file to edit in lieu of /etc/modprobe.d/options is:
/etc/modprobe.d/nvidia.conf
Seems to help a little bit, but nothing solves it. 195 beta drivers have the same bug. There is no way to disable PowerMizer. PowerMizerEnable=0x0 seems like it should work, but doesn't.