2005-11-17 00:01:46

by David Härdeman

[permalink] [raw]
Subject: X and intelfb fight over videomode

Using the information from this thread:
http://marc.theaimsgroup.com/?t=112593256400003&r=1&w=2

I've now compiled a kernel with the intelfb and fbcon drivers linked in
(no other fb drivers). By booting the kernel with vga=0x318 I get a
1024x768@16bpp console and drm/agp also seems happy.

However, as soon as X starts, the following message is printed to the
kernel log:

mtrr: base(0xe0020000) is not aligned on a size(0x300000) boundary
[drm:drm_unlock] *ERROR* Process 3013 using kernel context 0

Everything seems to work in X though. The first time that I switch
from X to a vc, the screen stays black for a few seconds before I get
the VC and then I get this:

intelfb: Changing the video mode is not supported.
intelfb: ring buffer : space: 61488 wanted 65472
intelfb: lockup - turning off hardware acceleration

I have X set to also use 1024x768@16bpp, what else do I need to do to
make sure that intelfb and X play nice together?

Re,
David

PS
Please CC me on any replies


2005-11-17 01:12:07

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: X and intelfb fight over videomode

David H?rdeman wrote:
> Using the information from this thread:
> http://marc.theaimsgroup.com/?t=112593256400003&r=1&w=2
>
> I've now compiled a kernel with the intelfb and fbcon drivers linked in
> (no other fb drivers). By booting the kernel with vga=0x318 I get a
> 1024x768@16bpp console and drm/agp also seems happy.
>
> However, as soon as X starts, the following message is printed to the
> kernel log:
>
> mtrr: base(0xe0020000) is not aligned on a size(0x300000) boundary
> [drm:drm_unlock] *ERROR* Process 3013 using kernel context 0
>
> Everything seems to work in X though. The first time that I switch from
> X to a vc, the screen stays black for a few seconds before I get the VC
> and then I get this:
>
> intelfb: Changing the video mode is not supported.
> intelfb: ring buffer : space: 61488 wanted 65472
> intelfb: lockup - turning off hardware acceleration
>
> I have X set to also use 1024x768@16bpp, what else do I need to do to
> make sure that intelfb and X play nice together?
>

Try booting with video=intelfb:1024x768-16@60,mtrr=0. Do not include
the vga=0x318 option. This prevents intelfb from changing the videomode.

Tony

2005-11-17 01:46:00

by David Härdeman

[permalink] [raw]
Subject: Re: X and intelfb fight over videomode

On Thu, Nov 17, 2005 at 09:11:53AM +0800, Antonino A. Daplas wrote:
>David H?rdeman wrote:
>> intelfb: Changing the video mode is not supported.

>Try booting with video=intelfb:1024x768-16@60,mtrr=0. Do not include
>the vga=0x318 option. This prevents intelfb from changing the videomode.

It seems that intelfb can't change it no matter what....booting with
video=intelfb:1024x768-16@60,mtrr=0 gives me the usual vga console and
no framebuffer. The following is printed during boot:

[...]
Linux agpgart interface v0.101 (c) Dave Jones
agpgart: Detected an Intel 855 Chipset.
agpgart: Detected 8060K stolen memory.
agpgart: AGP aperture is 128M @ 0xe0000000
[drm] Initialized drm 1.0.0 20040925
intelfb: Framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G chipsets
intelfb: Version 0.9.2
ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 11
ACPI: PCI Interrupt 0000:00:02.0[A] -> Link [LNKA] -> GSI 11 (level, low) -> IRQ 11
intelfb: 00:02.0: Intel(R) 852GM, aperture size 128MB, stolen memory 8060kB
intelfb: Non-CRT device is enabled ( LVDS port ). Disabling mode switching.
intelfb: Video mode must be programmed at boot time.
[...]

On the other hand, the vga=0x318 gives a 1024x768 console (and the vc
<-> X fight) with the following messages during boot:

[...]
Linux agpgart interface v0.101 (c) Dave Jones
agpgart: Detected an Intel 855 Chipset.
agpgart: Detected 8060K stolen memory.
agpgart: AGP aperture is 128M @ 0xe0000000
[drm] Initialized drm 1.0.0 20040925
intelfb: Framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G chipsets
intelfb: Version 0.9.2
ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 11
ACPI: PCI Interrupt 0000:00:02.0[A] -> Link [LNKA] -> GSI 11 (level, low) -> IRQ 11
intelfb: 00:02.0: Intel(R) 852GM, aperture size 128MB, stolen memory 8060kB
intelfb: Non-CRT device is enabled ( LVDS port ). Disabling mode switching.
intelfb: Initial video mode is 1024x768-32@60.
intelfb: Changing the video mode is not supported.
Console: switching to colour frame buffer device 128x48
[...]

(I tried X in 1024x768-32bpp after seeing the messages from the vga=...
boot but the problems remained)

Suggestions?


//David

2005-11-17 02:04:07

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: X and intelfb fight over videomode

David H?rdeman wrote:
> On Thu, Nov 17, 2005 at 09:11:53AM +0800, Antonino A. Daplas wrote:
>> David H?rdeman wrote:
>>> intelfb: Changing the video mode is not supported.
>
>> Try booting with video=intelfb:1024x768-16@60,mtrr=0. Do not include
>> the vga=0x318 option. This prevents intelfb from changing the videomode.
>
> It seems that intelfb can't change it no matter what....booting with
> video=intelfb:1024x768-16@60,mtrr=0 gives me the usual vga console and
> no framebuffer. The following is printed during boot:
>

Ah, okay, you have a flatpanel display, so you really need vesa to program
the mode.


> Suggestions?
>

The main problem is that when check_var fails, set_par is not called
which means that the ringbuffer is not set up correctly after switching
from X.

Try this first, then we'll think of a definitive solution later.

Open drivers/video/intelfb/intelfbdrv.c and look at intelfb_check_var().

Look for this particular snippet...

if (FIXED_MODE(dinfo) &&
(change_var ||
var->yres_virtual > dinfo->initial_var.yres_virtual ||
var->yres_virtual < dinfo->initial_var.yres ||
var->xoffset || var->nonstd)) {
if (first) {
ERR_MSG("Changing the video mode is not supported.\n");
first = 0;
}
return -EINVAL;
}


And then insert a line so it looks like this:

if (FIXED_MODE(dinfo) &&
(change_var ||
var->yres_virtual > dinfo->initial_var.yres_virtual ||
var->yres_virtual < dinfo->initial_var.yres ||
var->xoffset || var->nonstd)) {
if (first) {
ERR_MSG("Changing the video mode is not supported.\n");
first = 0;
}
intelfb_set_par(info); /* insert this line */
return -EINVAL;
}

2005-11-17 04:50:10

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: X and intelfb fight over videomode

David H?rdeman wrote:
> On Thu, Nov 17, 2005 at 09:11:53AM +0800, Antonino A. Daplas wrote:
>> David H?rdeman wrote:
>>> intelfb: Changing the video mode is not supported.
>
>
> Suggestions?

Ignore the hack I mentioned in the previous thread. Try this patch instead.

Tony

--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -1283,6 +1283,14 @@ intelfb_set_par(struct fb_info *info)

if (FIXED_MODE(dinfo)) {
ERR_MSG("Changing the video mode is not supported.\n");
+
+ /*
+ * We need to at least initialize the 2D engine even
+ * if changing the mode is not allowed
+ */
+ if (ACCEL(dinfo, info))
+ intelfbhw_2d_start(dinfo);
+
return -EINVAL;
}

2005-11-17 23:45:34

by David Härdeman

[permalink] [raw]
Subject: Re: X and intelfb fight over videomode

On Thu, Nov 17, 2005 at 12:49:54PM +0800, Antonino A. Daplas wrote:
>Ignore the hack I mentioned in the previous thread. Try this patch instead.

Didn't help, the messages remain the same (tried with vga=0x318 and
video=intelfb:1024x768-32@60,mtrr=0 vga=0x318).

Boot:
intelfb: 00:02.0: Intel(R) 852GM, aperture size 128MB, stolen memory 8060kB
intelfb: Non-CRT device is enabled ( LVDS port ). Disabling mode switching.
intelfb: Initial video mode is 1024x768-32@60.
intelfb: Changing the video mode is not supported.
Console: switching to colour frame buffer device 128x48

Starting X:
mtrr: base(0xe0020000) is not aligned on a size(0x300000) boundary
[drm:drm_unlock] *ERROR* Process 2976 using kernel context 0

First time I switch from X to VC:
intelfb: Changing the video mode is not supported.
intelfb: ring buffer : space: 6024 wanted 65472
intelfb: lockup - turning off hardware acceleration

Other suggestions?

//David

2005-11-18 01:08:47

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: X and intelfb fight over videomode

David H?rdeman wrote:
> On Thu, Nov 17, 2005 at 12:49:54PM +0800, Antonino A. Daplas wrote:
>> Ignore the hack I mentioned in the previous thread. Try this patch
>> instead.
>
> Didn't help, the messages remain the same (tried with vga=0x318 and
> video=intelfb:1024x768-32@60,mtrr=0 vga=0x318).
>
> Boot:
> intelfb: 00:02.0: Intel(R) 852GM, aperture size 128MB, stolen memory 8060kB
> intelfb: Non-CRT device is enabled ( LVDS port ). Disabling mode
> switching.
> intelfb: Initial video mode is 1024x768-32@60.
> intelfb: Changing the video mode is not supported.
> Console: switching to colour frame buffer device 128x48
>
> Starting X:
> mtrr: base(0xe0020000) is not aligned on a size(0x300000) boundary
> [drm:drm_unlock] *ERROR* Process 2976 using kernel context 0
>
> First time I switch from X to VC:
> intelfb: Changing the video mode is not supported.
> intelfb: ring buffer : space: 6024 wanted 65472
> intelfb: lockup - turning off hardware acceleration
>

Well, intelfb is at the mercy of X if it's in 'fixed mode'.

> Other suggestions?

I'm adding Sylvain, the intelfb maintainer, to the CC list.

How about this one? It also resets the ringbuffer before re-initializing
it again.

Tony

diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index 427689e..f1e7778 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -1283,6 +1283,16 @@ intelfb_set_par(struct fb_info *info)

if (FIXED_MODE(dinfo)) {
ERR_MSG("Changing the video mode is not supported.\n");
+
+ /*
+ * We need to at least initialize the 2D engine even
+ * if changing the mode is not allowed
+ */
+ if (ACCEL(dinfo, info)) {
+ intelfbhw_2d_stop(dinfo);
+ intelfbhw_2d_start(dinfo);
+ }
+
return -EINVAL;
}

2005-11-18 18:36:34

by David Härdeman

[permalink] [raw]
Subject: Re: X and intelfb fight over videomode

On Fri, Nov 18, 2005 at 09:08:26AM +0800, Antonino A. Daplas wrote:
>David H?rdeman wrote:
>> First time I switch from X to VC:
>> intelfb: Changing the video mode is not supported.
>> intelfb: ring buffer : space: 6024 wanted 65472
>> intelfb: lockup - turning off hardware acceleration
>>
>
>Well, intelfb is at the mercy of X if it's in 'fixed mode'.
>
>> Other suggestions?
>
>I'm adding Sylvain, the intelfb maintainer, to the CC list.
>
>How about this one? It also resets the ringbuffer before re-initializing
>it again.

That made no change at all unfortunately, the messages are exactly the
same as before...

//David

2005-11-18 20:33:14

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: X and intelfb fight over videomode

David H?rdeman wrote:
> On Fri, Nov 18, 2005 at 09:08:26AM +0800, Antonino A. Daplas wrote:
>> David H?rdeman wrote:
>>> First time I switch from X to VC:
>>> intelfb: Changing the video mode is not supported.
>>> intelfb: ring buffer : space: 6024 wanted 65472
>>> intelfb: lockup - turning off hardware acceleration
>>>
>>
>> Well, intelfb is at the mercy of X if it's in 'fixed mode'.
>>
>>> Other suggestions?
>>
>> I'm adding Sylvain, the intelfb maintainer, to the CC list.
>>
>> How about this one? It also resets the ringbuffer before re-initializing
>> it again.
>
> That made no change at all unfortunately, the messages are exactly the
> same as before...

That's the limit to what I can do (I don't have the hardware) and let's just
wait for the maintainer to respond.

For now, you can eliminate that message by turning acceleration off.

video=intelfb:accel:0

Another solution is to disable direct rendering, but I don't think you want
that.

Tony

PS: I saw this problem before with i810fb, and this is because the i810 driver
of X and i810fb shared the same ringbuffer. But the i810 chipset has 2 ringbuffers,
so I just made i810fb use the ringbuffer that is not touched by X/DRI. (I don't
know the status now since I don't have this chipset anymore). That is one
solution.