HOWTO: Enabling Kernel Mode Setting (KMS) in Debian Linux kernel
Purpose: So some of you must have heard about a new feature that got introduced since 2.6.29 Linux kernel known as Kernel Mode Setting (KMS).I will not go into the details about the benefits of KMS in this post but rather I will show you how to enable KMS on your Debian system. However I will provide you a list of websites through my del.icio.us account bookmarks which will tell you pros and cons (?) of KMS.
Background
So let’s see briefly what is KMS? KMS is a feature now in Linux kernel which will do the work of setting your screen resolution, depth, colors, etc. Earlier this was done by the XOrg graphics drivers. For example, before the kernel version 2.6.28, when you use to change your screen resolution from your GNOME/KDE, the XOrg driver use to do it. Now the same task is moved into the Linux kernel to speed up the things. Also a noticeable advantage that user can see is the flicker free and quick switch to any VT (Virtual Terminal) that you get by pressing Ctrl+Alt+F1 key. Now one you get KMS running you can almost instantaneously switch back and forth between VT (Ctrl+Alt+F1) and X server (Ctrl+Alt+F7). Also currently not all video drivers (Nvidia, ATI, etc.) have the KMS feature inside the Linux kernel. Only the Intel’s graphics hardware drivers (i915) have KMS feature inside the kernel. But eventually more and more drivers will have this feature. So in this post, I will show you how to enable KMS with the Intel’s i915 driver.
Requirements
So couple of things to remember. Just by upgrading to 2.6.29 kernel or later and configuring it properly, you cannot have KMS. You also need to make sure that you have relatively new user space installed i.e. XOrg system. Both, the Linux kernel and XOrg system have to work cooperatively to get KMS working. So you need to make sure that you are using xserver-xorg-video-intel package version 2.5.0 or later. Unfortunately currently, Debian Lenny’s (Stable) has version 2.3.2. This means that even if we upgrade to 2.6.29 or later kernel, we won’t have KMS working because we have an old user-space (2.3.2<2.5.0) which is typical of Debian considering it’s main criteria is stability. So we will try to get KMS working on Debian Testing (Squeeze) which has 2.9.0 version for xserver-xorg-video-intel package.
So let’s get started…
Step 1: Download and Install latest kernel
Get the latest version of kernel or at least try to get 2.6.29. I am currently using 2.6.30 kernel which is the default in Debian Testing as of time of this writing. Point your sources.list file to “testing” branch:
# nano /etc/apt/sources.list
Contents:
deb http://mirrors.kernel.org/debian testing main contrib non-free
deb-src http://mirrors.kernel.org/debian testing main contrib non-free
deb http://security.debian.org/ testing/updates main contrib non-free
Save and quit the file. Now install kernel sources using your preferred method:
# apt-get update
# apt-get upgrade
# apt-get install linux-source-2.6.30
Step 2: Configure your kernel for KMS
This is a very important step. First of all remove all the framebuffer drivers from your kernel config. Yes, that right drivers like vesafb, intelfb, etc are not compatible with KMS. Instead when you enable KMS for the Intel’s i915 driver, it will provide it’s own framebuffer drivers called inteldrmfb.Following is a snippet of dmesg once you boot from a KMS enabled kernel:
[ 0.327679] [drm] Initialized drm 1.1.0 20060810
[ 2.199142] [drm] DAC-6: set mode 640x480 0
[ 2.511505] [drm] TV-13: set mode NTSC 480i 0
[ 2.722014] [drm] LVDS-8: set mode 1024x768 15
[ 2.760091] fb0: inteldrmfb frame buffer device
[ 2.760101] [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0
So let’s start configuring kernel…
Make sure the following are enabled:
CONFIG_DRM_I915=m (or y)
CONFIG_DRM_I915_KMS=y
in
Device Drivers->Graphics Support->Direct Rendering Manager->Intel 830M, 845G, 852GM, 855GM, 865G->i915 Driver->Enable modesetting on intel by default (DRM_I915_KMS)
Note: The option CONFIG_DRM_I915_KMS=y is not necessary to get KMS working. What this option does is just enable the KMS by default. If you are using 2.6.29 or recent kernels just selecting CONFIG_DRM_I915=m (or y) should be sufficient to get KMS working although you will need to re-generate your initrd with certain command line options to enable KMS at the start of the boot process. See Step 4 for more details.
Next make sure that all the FRAMEBUFFER DRIVERS are disabled. Following is a snippet from my kernel config:
# Frame buffer hardware drivers
#
# CONFIG_FB_CIRRUS is not set
# CONFIG_FB_PM2 is not set
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_ARC is not set
# CONFIG_FB_ASILIANT is not set
# CONFIG_FB_IMSTT is not set
# CONFIG_FB_VGA16 is not set
# CONFIG_FB_VESA is not set
# CONFIG_FB_EFI is not set
# CONFIG_FB_N411 is not set
# CONFIG_FB_HGA is not set
# CONFIG_FB_S1D13XXX is not set
# CONFIG_FB_NVIDIA is not set
# CONFIG_FB_RIVA is not set
# CONFIG_FB_I810 is not set
# CONFIG_FB_LE80578 is not set
# CONFIG_FB_INTEL is not set
# CONFIG_FB_MATROX is not set
.........
# CONFIG_FB_VOODOO1 is not set
# CONFIG_FB_VT8623 is not set
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_ARK is not set
# CONFIG_FB_PM3 is not set
# CONFIG_FB_CARMINE is not set
However you need to make sure that the Framebuffer console driver is enabled otherwise you will get a blank/black screen upon boot:
# Console display driver support
#
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
# CONFIG_MDA_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
# CONFIG_FONTS is not set
That’s all the important things you need to keep in mind regarding the kernel config. Now compile and install your kernel.
Step 3: Install Xorg drivers
Since we enabled KMS for Intel drivers in the kernel config we need to make sure that we install the corresponding XOrg drivers (user-space).
apt-get install xserver-xorg-video-intel
and make you have correct version installed:
dpkg -l | grep video-intel
ii xserver-xorg-video-intel 2:2.9.0-1 X.Org X server -- Intel i8xx, i9xx display
As you can see the version is 2.9.0 > 2.5.0. So looks like we are all set.
Step 4: Enable the KMS module
Now we need to make sure that the KMS module kicks in right at the start of the boot process. If you compiled the KMS (CONFIG_DRM_I915_KMS=y) in your kernel then you can skip this step.
If you didn’t compile the above option in your kernel and your kernel requires an initrd to boot, do the following:
# nano /etc/initramfs-tools/modules
and add the following:
# Enable Kernel Modesetting
intel_agp
drm
i915 modeset=1
Save and quite file.
and after that regenerate your initrd for the kernel that you just compiled:
# update-initramfs -k 2.6.30-kms -u
Alternatively if you have initramfs-tools version 0.93.4 or later you need not do the above. Simply give the following parameter on kernel command line in your GRUB boot screen:
video=i915:modeset=1
or you can add this to your /boot/grub/menu.lst file to make the change permanently.
Also you need to remove any instances which are similar to the following in your menu.lst file:
vga=791
I understand that this entire Step 4 might be a bit confusing depending upon whether you are using Debian Stable or Debian Testing/Sid. Feel free to ask questions in the comment section.
Step 5: Finally reboot
Finally you are just one step closer tp bliss i.e. experience the magic of KMS. Reboot your system and cross your fingers.
Changes are that you have a successful boot with KMS module and text appear on your screen as you boot.
You can verify whether the KMS thing worked or not by looking at your dmesg:
# dmesg | grep drm
Output:
[ 0.327679] [drm] Initialized drm 1.1.0 20060810
[ 2.199142] [drm] DAC-6: set mode 640x480 0
[ 2.511505] [drm] TV-13: set mode NTSC 480i 0
[ 2.722014] [drm] LVDS-8: set mode 1024x768 15
[ 2.760091] fb0: inteldrmfb frame buffer device
[ 2.760101] [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0
[ 22.191132] [drm] DAC-6: set mode 640x480 0
[ 22.321921] [drm] DAC-6: set mode 640x480 0
[ 22.641029] [drm] TV-13: set mode NTSC 480i 0
[ 22.809440] [drm] TV-13: set mode NTSC 480i 0
...........
Text similar to above confirms that your KMS module (inteldrmfb) was loaded correctly. It should automatically detect the native screen resolution of your display device and set it to that during the boot process.
Finally once you are in your Graphics environment like GNOME/KDE/LXDE, trying switching to a VT1 as mentioned in the beginning of the post and you will notice a quick and flicker free transition.
That’s it. As promised here are some links for more information regarding this whole KMS thing.
Happy KMS’ing!
Subscribe for testking N10-004 training program and pass your real exam on first attempt. Our testking 220-701 study guide and testking 350-030 dumps contain everything that you must have to learn to pass real exam.


Email Subscription









November 3rd, 2009 at 11:47 am
Two things: 2.6.30 and 31 already have KMS enabled and you do not need to build your own kernel. There is NO REASON to disable the FB modules. They do not conflict if you don’t load them.
Second, there’s no reason to use /etc/initramfs-tools/modules … the initramfs-tools in Debian testing/unstable will automatically include the needed modules for Intel graphics IF your current /proc/cmdline has the above video=i915:modeset=1.
So, modify your grub (or grub2) configuration first, reboot, and then do the rest of the steps (sans building your own kernel).
Reply to this comment
November 3rd, 2009 at 12:18 pm
Jason,
For your first point, I have a kernel from Debian testing and KMS is not enabled by default:
debian:~# cat /boot/config-2.6.30-1-686 | grep KMS
# CONFIG_DRM_I915_KMS is not set
As for the FB modules, you might be right one does not need to completely remove them but they need to make sure that none of the FB modules are compiled in (y) instead they are just modules(m).
For the second point, I have mentioned that in my post that if you have a particular version and above of initramfs you don’t need to update your initrd.
Reply to this comment
November 3rd, 2009 at 2:03 pm
I have updated the post with some further clarification
Reply to this comment
November 3rd, 2009 at 10:18 pm
In latest Debian sid, all I have to do was:
rmmod i915
modprobe i915 modeset=1
(or add options i915 modeset=1 to /etc/modprobe.d/i915.conf)
Coolness!
Reply to this comment
November 3rd, 2009 at 10:33 pm
Hi Oren,
You are right. Unstable = Coolness (wrt latest software). :)
I wanted to write the article with regards to all kinds of Debian branches – Stable, Testing, Unstable. Also I wanted to cover some basic background on this subject.
Reply to this comment
November 4th, 2009 at 12:15 am
Each time I tested this on my eeepc, keyboard and mouse are freezed after hibernation :-(
Hope hurther versions of kernel and xserver-xorg-video-intel will correct this.
Reply to this comment
Admin Reply:
November 5th, 2009 at 1:26 am
What driver are you trying to use? i915?
Reply to this comment
Stéphane Péchard Reply:
November 5th, 2009 at 1:47 am
yes, i use the i915 driver, is it wrong?
Reply to this comment
November 17th, 2009 at 4:06 pm
Hello and nice article. The thing is that I have in dmesg the “[drm:intel_dp_i2c_init] *ERROR* i2c_init DPDD-B (& C) error”. It was a bug that was fixed last month I believe.
Anyway, my kernel is 2.6.31.6 and I have the latest intel driver installed and I can’t get rid of this error. Is there something in the kernel that I might have missed (apart from the framebuffer and KMS modules that are confiugred correctly) ?
Reply to this comment
Akis Foulidis Reply:
November 17th, 2009 at 4:09 pm
Let me also add that my X freezes and I can’t go to a virtual terminal or kill the X server. I believe that might be an xorg.conf error though and not the drm error in the kerner buffer that I mentioned above.
Reply to this comment
Admin Reply:
November 17th, 2009 at 7:06 pm
I think it is a bug in the kernel which I believe will be fixed in next release..See some links at:
http://www.google.com/search?hl=en&rlz=1B5GGGL_enUS318US319&q=drm%3Aintel_dp_i2c_init+*ERROR*++error&btnG=Search&aq=f&oq=&aqi=
Reply to this comment
Akis Foulidis Reply:
November 17th, 2009 at 7:53 pm
I believe this error is about the i2c connection via the DDC wire in order to get information from the monitor. Anyway, my KMS is still available and the error from the X server was irrelative.
Reply to this comment
November 20th, 2009 at 12:26 am
I had a debian/unstable box with i915 hardware (which has been freezing in X for weeks) suddenly stop recognizing its right mouse button last night. I get errors in Xorg.0.log about i810 module being missing and /dev/fb0 (no such file or directory).
Reply to this comment
Russell Senior Reply:
November 20th, 2009 at 9:47 pm
the mouse thing was a sawfish (wm) problem, that’s fixed, but freezes persist. multiple X sessions (startx — :1, startx — :2, etc) seems to exacerbate).
Reply to this comment
November 27th, 2009 at 9:07 pm
I found out that your kernel boot parameter is wrong.
DOES NOT WORK:
video=i915:modeset=1
WORKS:
i915.modeset=1
Reply to this comment
January 22nd, 2010 at 2:58 pm
Thanks for this very helpful article! I managed to get a beautiful 1920×1200 framebuffer with a radeon M66-P running squeeze on my asus laptop.
At the moment squeeze is still using a 2.6.30 kernel, but the following sid packages installed just fine:
* linux-image-2.6.32-trunk-686
* firmware-linux-nonfree
* firmware-linux-free
The only problem was the automatic start of the framebuffer. Appending these lines to /etc/initramfs-tools/modules resulted in a crash at boot:
ati_agp
drm
radeon modeset=1
Maybe I missed something important. :) Here’s how I ‘fixed’ it:
Create the file ‘radeon_framebuffer.conf’ in /etc/modprobe.d/ with the following content:
options radeon modeset=1
install video /sbin/modprobe radeon; /sbin/modprobe –ignore-install video
Reply to this comment
August 20th, 2010 at 7:01 am
btw a tip: if you want to remove DRM,this tool works like charm (if links dont work its ultimatedrmremoval.com)
Reply to this comment
September 30th, 2010 at 12:16 am
[...] I haven’t verified yet, but I think this driver uses the new KMS feature. [...]
October 20th, 2010 at 6:33 pm
[...] wi?cej: Enable Kernel Mode Setting (KMS) in Linux kernel on Debian … a-flicker-free, and-depth, and-quick, debian, enable-the, enable-the-kms, flicker-free, intel, [...]
October 20th, 2010 at 6:43 pm
[...] reading here: Enable Kernel Mode Setting (KMS) in Linux kernel on Debian … Posted in: Kernels ADD [...]
October 20th, 2010 at 6:48 pm
[...] Enable Kernel Mode Setting (KMS) in Linux kernel on Debian … [...]
October 20th, 2010 at 6:57 pm
[...] more here: Enable Kernel Mode Setting (KMS) in Linux kernel on Debian … ??: linux ??: debian, drm, enable-the-kms, flicker-free, intel, kms, linux, [...]
December 24th, 2012 at 9:21 am
it is quite old post but i have kernel 2.6.31.6 and I have the latest intel driver installed and I can’t get rid of error
Reply to this comment