# KMS modelines not recognized on boot [NOT solved]

## Abraxas

I am currenty using xorg-server-1.6.0, libdrm-2.4.5, xf86-video-intel-2.6.3-r1, and mesa-7.4.  When I boot initially I get an error that says:

```
Undefined video mode number ffff

Press <ENTER> to see video modes available, <SPACE> to continue
```

If I continue it then sets the resolution correctly to 1400x1050 but when GDM loads up you can tell immediately that the bit color depth is not correct.  Once in X everything works the way it should except for the color depth and lousy performance.Last edited by Abraxas on Fri May 08, 2009 2:46 pm; edited 4 times in total

----------

## marsark

I have same problem with 1400x1050 resolution.

It is described in this thread https://forums.gentoo.org/viewtopic-t-753437.html

----------

## Abraxas

I posted in that thread already, I just didn't see it when I posted this initially.  No one else seems to be having the problem of the resolution not being detected initially though.  I have no idea what is causing it because as soon as I press the spacebar to continue it sets the mode correctly.

----------

## Sadako

 *Abraxas wrote:*   

> I posted in that thread already, I just didn't see it when I posted this initially.  No one else seems to be having the problem of the resolution not being detected initially though.

 I'm actually experiencing that particular issue, and with the experimental ATI KMS rather than intel, although the colour depth is just fine.

I'm pretty sure it's just a kernel configuration issue, as I have a very minimalist kernel, nothing in it I don't use or need.

I haven't played with fixing it much yet, but one culprit I'm suspecting is CONFIG_FB_MODE_HELPERS, which I have disabled.

How about you?

----------

## marsark

 *Hopeless wrote:*   

>  *Abraxas wrote:*   I posted in that thread already, I just didn't see it when I posted this initially.  No one else seems to be having the problem of the resolution not being detected initially though. I'm actually experiencing that particular issue, and with the experimental ATI KMS rather than intel, although the colour depth is just fine.
> 
> I'm pretty sure it's just a kernel configuration issue, as I have a very minimalist kernel, nothing in it I don't use or need.
> 
> I haven't played with fixing it much yet, but one culprit I'm suspecting is CONFIG_FB_MODE_HELPERS, which I have disabled.
> ...

 

I tried various configurations with the CONFIG_FB_MODE_HELPERS enabled/disabled, but it did no work for me.

I have found this lines in my dmesg:

```
allocated 1400x1050 fb: 0x007df000, bo f68d62a0                                                                  

[drm] LVDS-8: set mode 1400x1050 15                                                                              

Console: switching to colour frame buffer device 175x65                                                          

fb0: inteldrmfb frame buffer device 
```

There is number 15 at the second row after the mode resolution. I have suspection, that 15 points to 16 bit color depth.

----------

## Sadako

 *marsark wrote:*   

> I have found this lines in my dmesg:
> 
> ```
> allocated 1400x1050 fb: 0x007df000, bo f68d62a0                                                                  
> 
> ...

 I noticed something similar in my logs;

```
[drm] TMDS-10: set mode 1680x1050 20

Console: switching to colour frame buffer device 210x65

fb0: radeondrmfb frame buffer device
```

I kinda thought it was related to refresh rates myself, but I just greped /usr/src/linux and found this;

```
        DRM_INFO("%s: set mode %s %x\n", drm_get_encoder_name(encoder),

             mode->name, mode->base.id);
```

Assuming this is where it's coming from, then my guess is it's just a somewhat arbitrary numerical id assigned to each resolution...

----------

## Moloch

This actually is not a color depth problem, rather a dithering problem related to the video output. Knowing this I did some digging and found a patch in the intel-drm branch.

Works great for me, enjoy!

EDIT: I should clarify this fixes the "color depth" issue. I was not having problems with resolution using KMS, probably because my resolution is 1280x800.

----------

## marsark

 *Moloch wrote:*   

> This actually is not a color depth problem, rather a dithering problem related to the video output. Knowing this I did some digging and found a patch in the intel-drm branch.
> 
> Works great for me, enjoy!
> 
> EDIT: I should clarify this fixes the "color depth" issue. I was not having problems with resolution using KMS, probably because my resolution is 1280x800.

 

YES, this worked for me.

----------

## Abraxas

That makes sense now.  It does look more like a dithering issue, because the issue was really only apparent on gradients.  As for CONIG_FB_MODE_HELPERS I have tried with and without that option.  I have also tried compiling video related stuff as modules and as built in with no luck.  I thought it was an issue with a driver being a module and not loading until after I booted but building everything into the kernel didn't seem to make a difference and the resolution is set  before modules load anyway.  I went through several options swithing them on and off trying to get the resolution to set automatically with no luck.  I even copied someone's config from a Fedora install with KMS but to no avail.  I still feel like it is a missing option in the kernel but there is little documentation on everything needed to get KMS to work properly.

----------

## Abraxas

The patch fixes the dithering issue but performance is very poor on my 2.6.29 kernel and I still can't seem to resolve the issue with my resolution not being set automatically.

----------

## Moloch

The performance issue is most likely a xf86-video-intel related issue. I have had lots of problems using KMS, in the past it was a horrible memory leak in X after while. With 2.6.3-r1 I was getting performance issues as well. If you are comfortable using overlays I recommend trying out x11-drivers/xf86-video-intel-9999_pre27 from the x11 overlay.

I'd say it's safe to assume the resolution problem is something in the kernel. The 'Udefined video mode number ffff' sounds like VESA which should not be enabled. In the kernel config make sure AGP and DRI stuff is compiled in the kernel rather than modules. Nothing needs to be selected under 'Support for frame buffer devices.' Paritcularly vesa and intelfb will conflict with with the dri fb drivers.

----------

## Abraxas

 *Moloch wrote:*   

> The performance issue is most likely a xf86-video-intel related issue. I have had lots of problems using KMS, in the past it was a horrible memory leak in X after while. With 2.6.3-r1 I was getting performance issues as well. If you are comfortable using overlays I recommend trying out x11-drivers/xf86-video-intel-9999_pre27 from the x11 overlay.
> 
> I'd say it's safe to assume the resolution problem is something in the kernel. The 'Udefined video mode number ffff' sounds like VESA which should not be enabled. In the kernel config make sure AGP and DRI stuff is compiled in the kernel rather than modules. Nothing needs to be selected under 'Support for frame buffer devices.' Paritcularly vesa and intelfb will conflict with with the dri fb drivers.

 

All graphics support is compiled in the kernel, vesa and intelfb are not enabled.  I figured that much out before I posted anything but I still get an undefined mode number.

----------

## Abraxas

I just tried the latest git drivers for intel and performance is just as bad as it was before and I'm still can't figure out why I'm getting an undefined mode number.

----------

## marsark

I have noticed increase of performance with x11-drivers/xf86-video-intel-9999_pre27.

----------

## Moloch

 *Abraxas wrote:*   

> All graphics support is compiled in the kernel, vesa and intelfb are not enabled.  I figured that much out before I posted anything but I still get an undefined mode number.

 Just being thorough...

Back to the performance issue, although I'm mostly stumped, you may want to try Option "Tiling" "No" in the device section of your xorg.conf

I've had strange results using this setting, with xf86-video-intel-2.6.3 and back it seemed to help. With 9999_pre27 X becomes sluggish after about 5 mins of use, so now I leave it at the default which is tiling on.

Regarding the other problem maybe posting your dmesg output and kernel .config will help.

----------

## Moloch

Actually I just grepped the error message you were getting in the kernel source, if you note the code in 'arch/x86/boot/video.c' at line 311 with the function set_video(void). This error message might be triggered due to a kernel boot parameter. If vga and/or video parameters are set in your grub.conf try taking them out.

----------

## Abraxas

 *Moloch wrote:*   

> Actually I just grepped the error message you were getting in the kernel source, if you note the code in 'arch/x86/boot/video.c' at line 311 with the function set_video(void). This error message might be triggered due to a kernel boot parameter. If vga and/or video parameters are set in your grub.conf try taking them out.

 

The only video related option I have in grub.conf is i915.modeset=1 to enable KMS because when I set the kernel option to default to KMS it doesn't boot.  I haven't tried that since making several changes though so maybe I will try to make it default to KMS again to see if that works.  Tiling is on right now, let me try it with it off to see if that makes a difference.  Thanks for all the help.

----------

## Abraxas

It's a slow progression.  Turning tiling off boosted my performance to 2.6.28 levels which makes it usable now.  Thx.  I still have the undefined video mode problem though.  I recompiled the kernel and set KMS to default but that didn't make a difference.

----------

## Moloch

Well, glad something I suggested helped out.

My boot options are fairly sparse as well. I also have i915.modeset=1 in mine, but mostly so I can easily turn it on and off in case KMS breaks something and I can't remember the boot option off the top of my head.

I really have no idea, hopefully somebody with your resolution may step up with some ideas. Just a wild guess here, but you could try setting: 

```
vga=0F01
```

 This basically tells the console to boot up with the default console resolution, then once KMS kicks in it will override what is set to your native resolution. I tried this on my laptop and did not change it's current boot up behavior at all. Perhaps it will bypass the error message on yours...

Well, good luck, maybe this is just a bug in the kernel and later revisions will eventually fix it.   :Confused: 

----------

## Abraxas

I really do think it is a kernel bug at this point.  I have tried everything I could find regarding KMS without success.  I am still a bit hesitant to report it as a bug just yet because I really have no idea what the specific cause is.

----------

## Abraxas

BTW, thanks for the vga=0F01 tip but it didn't work.  Now I get "undefined mode number: 0" instead of "undefined mode number: ffff".  Back to *.28 for now.

----------

## rahulthewall

 *Abraxas wrote:*   

> BTW, thanks for the vga=0F01 tip but it didn't work.  Now I get "undefined mode number: 0" instead of "undefined mode number: ffff".  Back to *.28 for now.

 

Why don't you remove vga=### from your grub.conf (I guess this is where you have it) and then try. Actually, there is no need to use vga along with KMS since KMS provides a nice framebuffer terminal (admittedly it does so when processing uevents during the boot process, so the kernel boot messages would be displayed at 80X40 resolution or something like that but that is fine). I am not using vga=... and it works fine here.

----------

## Abraxas

 *rahulthewall wrote:*   

>  *Abraxas wrote:*   BTW, thanks for the vga=0F01 tip but it didn't work.  Now I get "undefined mode number: 0" instead of "undefined mode number: ffff".  Back to *.28 for now. 
> 
> Why don't you remove vga=### from your grub.conf (I guess this is where you have it) and then try. Actually, there is no need to use vga along with KMS since KMS provides a nice framebuffer terminal (admittedly it does so when processing uevents during the boot process, so the kernel boot messages would be displayed at 80X40 resolution or something like that but that is fine). I am not using vga=... and it works fine here.

 

If you followed the whole thread you would have noticed that it was a last ditch effort to ADD vga=0F01.  I haven't ever tried to use it on this machine before.  My problem is that with all graphics drivers compiled into the kernel, with framebuffer enabled, without framebuffer drivers like vesa or intelfb enabled, and no boot options in grub, my machine still boots to an undefined mode number but when I tell it to continue it properly sets the mode using KMS.

----------

## Abraxas

Kernel 2.6.29.2 solved the modelines issue.  The correct mode is now detected on boot.

----------

## Abraxas

The problem is back again.  I rebuilt my kernel after adding some kernel options under USB without changing anything to do with the graphics and when I rebooted the modelines issue reappeared.  I decided to grab the latest gentoo-sources (r3) and try again.  No luck.  The is starting to drive me crazy.

----------

## pdw_hu

You've to remove the vga= line from grub.

----------

## Abraxas

 *pdw_hu wrote:*   

> You've to remove the vga= line from grub.

 

Please read the the thread before commenting.  No offense but this has been gone over several times already in this thread.

----------

## pdw_hu

 *Abraxas wrote:*   

> Please read the the thread before commenting.  No offense but this has been gone over several times already in this thread.

 

Right, sorry. Can't help you then. I've the "use it by default" set in the kernel and KMS has worked nicely since 2.6.29 for me, and it's even better (few minor issues gone) with 2.6.30-rc4 (which is rock stable since -rc1!).Last edited by pdw_hu on Fri May 08, 2009 3:45 pm; edited 1 time in total

----------

## Sadako

 *Abraxas wrote:*   

> The problem is back again.  I rebuilt my kernel after adding some kernel options under USB without changing anything to do with the graphics and when I rebooted the modelines issue reappeared.  I decided to grab the latest gentoo-sources (r3) and try again.  No luck.  The is starting to drive me crazy.

 Did the problem re-appear under gentoo-sources r2?

----------

## Abraxas

 *Hopeless wrote:*   

>  *Abraxas wrote:*   The problem is back again.  I rebuilt my kernel after adding some kernel options under USB without changing anything to do with the graphics and when I rebooted the modelines issue reappeared.  I decided to grab the latest gentoo-sources (r3) and try again.  No luck.  The is starting to drive me crazy. Did the problem re-appear under gentoo-sources r2?

 

When I first switched to r2 everything just worked.  Then I recompiled to add some options to the same kernel and it freaked out on me again.  I upgraded to r3 this morning and it's having the same issues.

----------

## Sadako

 *Abraxas wrote:*   

>  *Hopeless wrote:*    *Abraxas wrote:*   The problem is back again.  I rebuilt my kernel after adding some kernel options under USB without changing anything to do with the graphics and when I rebooted the modelines issue reappeared.  I decided to grab the latest gentoo-sources (r3) and try again.  No luck.  The is starting to drive me crazy. Did the problem re-appear under gentoo-sources r2? 
> 
> When I first switched to r2 everything just worked.  Then I recompiled to add some options to the same kernel and it freaked out on me again.  I upgraded to r3 this morning and it's having the same issues.

 Ah.

I have the same thing under r3, but without kms or any framebuffer console, just vga.

From the changelog it looks like one of the few differences between r2 and r3 was the addition of the fbcondecor patch, and as you said it worked with r2 I thought maybe that was the cause.

It might be worth seeing if the issue persists with vanilla-sources, and if it's still there without KMS, as it is for me.

I still think it may just be a kernel config issue.

----------

## Abraxas

 *Quote:*   

> I still think it may just be a kernel config issue.

 

I thought so too but I've tried every option I have ever seen in relation to KMS and it never worked until I upgraded to r2, without making a single config change.

----------

## Sadako

 *Abraxas wrote:*   

>  *Quote:*   I still think it may just be a kernel config issue. 
> 
> I thought so too but I've tried every option I have ever seen in relation to KMS and it never worked until I upgraded to r2, without making a single config change.

 Do you have "Configure standard kernel features (for small systems)" (CONFIG_EMBEDDED) and similar minimalist options enabled?

----------

## Abraxas

 *Hopeless wrote:*   

>  *Abraxas wrote:*    *Quote:*   I still think it may just be a kernel config issue. 
> 
> I thought so too but I've tried every option I have ever seen in relation to KMS and it never worked until I upgraded to r2, without making a single config change. Do you have "Configure standard kernel features (for small systems)" (CONFIG_EMBEDDED) and similar minimalist options enabled?

 

No

----------

## Abraxas

The issue is still there with the latest vanilla sources.  I'm going to check my config yet again.

----------

## Xake

Did you solve this problem yet? It really starts to annoy me...

----------

