Bug 19336

Summary: [GEM] X can't start on 2.6.28, with "Failed to pin front buffer: Cannot allocate memory"
Product: xorg Reporter: Peter Ganzhorn <peter.ganzhorn>
Component: Driver/intelAssignee: Eric Anholt <eric>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium Keywords: NEEDINFO
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Xorg.0.log on 2.6.28
none
xorg.conf
none
dmesg (2.6.28)
none
dmesg (2.6.28-git3)
none
Xorg.0.log (2.6.28-git3)
none
dmesg (2.6.28-git3 + "drm/i915: Respect the other stolen memory sizes we know of. "
none
Xorg.0.log (2.6.28-git3 + patch "drm/i915: Respect the other stolen memory sizes we know of. ") none

Description Peter Ganzhorn 2008-12-30 02:58:21 UTC
Created attachment 21562 [details]
Xorg.0.log on 2.6.28

My X-Server won't start when running the 2.6.28 kernel. No problems with 2.6.27.10.

Hardware:
Intel Core2 CPU
G45 Board (Asus P5Q-EM)
Intel GMA X4500HD
8 GB RAM

Software:
Ubuntu 8.10
Self-compiled kernel 2.6.27.10 and 2.6.28
Xorg 1.5.2
libdrm 2.4.0 (tried 2.4.3 as well)
xf86-video-intel 2.5.1 (tried 2.6.0-rc1 as well)
Mesa 7.2


Snippets from Xorg.0.log:
(--) intel(0): Linear framebuffer at 0xD0000000
(--) intel(0): IO registers at addr 0xFE400000
(WW) intel(0): libpciaccess reported 0 rom size, guessing 64kB
(==) intel(0): Using EXA for acceleration
(II) intel(0): 2 display pipes available.
[...]
(II) intel(0): detected 512 kB GTT.
(II) intel(0): detected 131068 kB stolen memory.
[...]
(II) intel(0): Attempting memory allocation with tiled buffers.
(WW) intel(0): Allocation error, framebuffer compression disabled
(II) intel(0): Tiled allocation successful.
[...]
(==) intel(0): Backing store disabled
(==) intel(0): Silken mouse enabled
(II) intel(0): Initializing HW Cursor
(II) intel(0): [DRI] installation complete
(EE) intel(0): Failed to pin front buffer: Cannot allocate memory

Fatal server error:
Couldn't bind memory for BO front buffer

Full Xorg.0.log is attached.

dmesg:
mtrr: type mismatch for d0000000,10000000 old: write-back new: write-combining
resource map sanity check conflict: 0xd0000000 0xdfffffff 0xd0000000 0xd7feffff
vesafb
------------[ cut here ]------------
WARNING: at arch/x86/mm/ioremap.c:226 __ioremap_caller+0x339/0x380()
Modules linked in: w83627ehf hwmon_vid
Pid: 3057, comm: Xorg Not tainted 2.6.28-pgzh #1
Call Trace:
 [<ffffffff8025b294>] warn_on_slowpath+0x64/0xa0
 [<ffffffff80261228>] iomem_map_sanity_check+0x98/0xc0
 [<ffffffff80247ad9>] __ioremap_caller+0x339/0x380
 [<ffffffff80491bdf>] i915_gem_entervt_ioctl+0x2cf/0x5a0
 [<ffffffff80491bdf>] i915_gem_entervt_ioctl+0x2cf/0x5a0
 [<ffffffff80491910>] i915_gem_entervt_ioctl+0x0/0x5a0
 [<ffffffff80480bf2>] drm_ioctl+0x112/0x340
 [<ffffffff802cc335>] vfs_ioctl+0x85/0xb0
 [<ffffffff802cc3dc>] do_vfs_ioctl+0x7c/0x460
 [<ffffffff802cc809>] sys_ioctl+0x49/0x80
 [<ffffffff8022a36b>] system_call_fastpath+0x16/0x1b
---[ end trace 7b9ce6d857e6ff4d ]---
[drm:i915_gem_object_bind_to_gtt] *ERROR* GTT full, but LRU list empty
[drm:i915_gem_object_pin] *ERROR* Failure to bind: -12<4>Clocksource tsc
unstable (delta = -143772081 ns)
iounmap: bad address ffffc20011780000
Pid: 3057, comm: Xorg Tainted: G        W  2.6.28-pgzh #1
Call Trace:
 [<ffffffff804911d9>] i915_gem_leavevt_ioctl+0x39/0x50
 [<ffffffff80480bf2>] drm_ioctl+0x112/0x340
 [<ffffffff802cc335>] vfs_ioctl+0x85/0xb0
 [<ffffffff802cc3dc>] do_vfs_ioctl+0x7c/0x460
 [<ffffffff802748d0>] hrtimer_wakeup+0x0/0x30
 [<ffffffff80673f9e>] do_nanosleep+0x7e/0xd0
 [<ffffffff802cc809>] sys_ioctl+0x49/0x80
 [<ffffffff80275487>] sys_nanosleep+0x77/0x80
 [<ffffffff8022a36b>] system_call_fastpath+0x16/0x1b
Xorg[3057]: segfault at 0 ip 00007f8c04da265f sp 00007fff10a12f10 error 6 in
intel_drv.so[7f8c04d5a000+69000]


I don't have a clue what might be wrong, the only thing that is obviously wrong is the following:
(II) intel(0): detected 512 kB GTT.
My BIOS reports GTT for the graphics card to be 2 MB and I can't change it there.
Comment 1 Eric Anholt 2008-12-30 16:00:49 UTC
Please attach xorg.conf and dmesg.
Comment 2 Peter Ganzhorn 2008-12-31 02:43:46 UTC
Created attachment 21585 [details]
xorg.conf
Comment 3 Peter Ganzhorn 2008-12-31 02:44:32 UTC
Created attachment 21586 [details]
dmesg (2.6.28)
Comment 4 Peter Ganzhorn 2008-12-31 09:01:30 UTC
Since drm-next was merged into 2.6.28-git3, I decided to give it a try. And what can I say, it seems to work better!
Since there are still the strangest errors in Xorg.0.log, I'll attach it as well as the dmesg, since I'm still getting "MTRR type mismatch ...".
Xorg.0.log says DRI wouldn't work, but "glxinfo | grep direct" gives me "direct rendering: Yes".
Please have a look at my logs, I still suspect something beeing wrong there. I'm gonna try run something using 3D next, I didn't dare to do so yet. ;)
Comment 5 Peter Ganzhorn 2008-12-31 09:02:26 UTC
Created attachment 21593 [details]
dmesg (2.6.28-git3)
Comment 6 Peter Ganzhorn 2008-12-31 09:02:51 UTC
Created attachment 21594 [details]
Xorg.0.log (2.6.28-git3)
Comment 7 Peter Ganzhorn 2008-12-31 09:21:06 UTC
So here's a bit more of information:
3D performance is quite poor, glxgears runs with about 268 FPS. I also tried wormux and ioquake3, wormux works but is quite slow, too (~22 FPS). ioquake3 is painfully slow, even the menus are a slideshow.

2D performance is about the same as ever, playing movies with xine works like a charm. 2D even feels a bit smoother than usual, but not much.

Please look especially at the following Xorg log lines:

(**) intel(0): Option "DRI" "true"
(II) Loading sub module "dri"
(II) LoadModule: "dri"
(II) Reloading /usr/lib/xorg/modules/extensions//libdri.so
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is -1, (No such device)
drmOpenDevice: open result is -1, (No such device)
drmOpenDevice: Open failed
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is -1, (No such device)
drmOpenDevice: open result is -1, (No such device)
drmOpenDevice: Open failed
[drm] failed to load kernel module "i915"
(EE) [drm] drmOpen failed.
(EE) intel(0): [dri] DRIScreenInit failed. Disabling DRI.
(II) AIGLX: Screen 0 is not DRI capable
(II) AIGLX: Loaded and initialized /usr/lib/dri/swrast_dri.so
(II) GLX: Initialized DRISWRAST GL provider for screen 0


At least it works. I guess one of the patches in drm-next fixed the worst problems :)
BTW: I did not need that swrast_dri.so ever before - had to install it as Xorg.log spit errors about it. (got it via "apt-file search" and "apt-get")
Comment 8 Peter Ganzhorn 2009-01-02 02:18:07 UTC
I know you guys are pretty busy with fixing lots of stuff due to the merge of GEM, so I had a look at the kernel sources and think I found where the problem is caused, since the dmesg on 2.6.28-git3 contains the following:

[drm:i915_probe_agp] *ERROR* video memory is disabled
[drm:i915_driver_load] *ERROR* failed to init modeset

The video memory disabled error is triggered in i915_dma.c (around line 900):

---
	case INTEL_915G_GMCH_GMS_STOLEN_64M:
		*preallocated_size *= 64;
		break;
	case INTEL_855_GMCH_GMS_DISABLED:
		DRM_ERROR("video memory is disabled\n");
		return -1;
	default:
		DRM_ERROR("unexpected GMCH_GMS value: 0x%02x\n",
			tmp & INTEL_855_GMCH_GMS_MASK);
		return -1;
	}
	*preallocated_size -= overhead;

	return 0;
}
---

Stolen memory sizes up to 64M are listed, but I think I have 128M stolen mem:

agpgart-intel 0000:00:00.0: detected 131068K stolen memory

Because I don't know anything about how the hardware works or if what I found really is the problem I'll now just shut up and leave this to the pros, I'm sure you'll have this figured out soon and have better things to do than read what I believe might be the problem.
Comment 9 Eric Anholt 2009-01-02 18:06:47 UTC
untested fix in for-review branch:
commit a3027a6fce93fb1b332e045811c87e33d399bc01
Author: Eric Anholt <eric@anholt.net>
Date:   Fri Jan 2 18:05:51 2009 -0800

    drm/i915: Respect the other stolen memory sizes we know of.
    
    fd.o bug #19336.
    
    Signed-off-by: Eric Anholt <eric@anholt.net>
Comment 10 Peter Ganzhorn 2009-01-03 02:45:43 UTC
I just tried the patch against 2.6.28-git3, and I've got good and bad news.
The good news is: The stolen memory detection seems to work now.
The bad news is: My monitor turns off when starting the new kernel (I see a few lines of text, then nothing). The system continues to boot and I think X starts, but I don't see a thing.
Hitting Ctrl+Alt+F1 and pressing Ctrl+Alt+Del to reboot the machine worked.

Funny thing: When I reduce video memory in the BIOS and use 2.6.28-git3 without your patch, the same thing happens! I suppose this means your patch is working fine, but there's still something wrong...

I'll attach dmesg + Xorg.0.log with your patch applied, dmesg has some errors on loading drm/i915 that may tell you whats wrong.

But thanks for the patch!
Comment 11 Peter Ganzhorn 2009-01-03 02:47:18 UTC
Created attachment 21639 [details]
dmesg (2.6.28-git3 + "drm/i915: Respect the other stolen memory sizes we know of. "
Comment 12 Peter Ganzhorn 2009-01-03 02:47:52 UTC
Created attachment 21640 [details]
Xorg.0.log (2.6.28-git3 + patch "drm/i915: Respect the other stolen memory sizes we know of. ")
Comment 13 Eric Anholt 2009-01-06 11:22:41 UTC
You'll need master of the 2D driver for KMS-supporting X.

I've pushed the stolen memory fix to my trees, so I'm marking this fixed.
Comment 14 Peter Ganzhorn 2009-01-07 08:57:56 UTC
Shouldn't xf86-video-intel-2.5.1 already support KMS? I'll check out the latest git repository of the driver and see if it works.
Regarding marking the bug as fixed I have no objections, I think this one in particular is really fixed.
So thanks for the help, keep up the good work! I'm really glad there's so much development on the driver for the Intel graphics cards, since there is no real alternative if you want decent 3D acceleration and working open-source drivers.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.