Bug 10365

Summary: AGP error when initializing DRI
Product: xorg Reporter: Andreas Kloeckner <inform>
Component: Driver/intelAssignee: Eric Anholt <eric>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: khashayar.lists, thomas
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 10102    
Attachments:
Description Flags
xorg log file
none
xorg config none

Description Andreas Kloeckner 2007-03-21 09:14:51 UTC
I have an i915 that I am trying to run using the Debian experimental packages of the upcoming X.org 7.2 server. Everything but non-legacy DRI works fine.

However when I try to run with the new DRI driver, I get the following errors:

------------------------------------------------------
$ glxinfo
name of display: :0.0
Error -22
Failed to initialize batch pool - possible incorrect agpgart installed
------------------------------------------------------

First sketchy thing in dmesg:

------------------------------------------------------
Trying to vfree() nonexistent vm area (c1f4c000)
BUG: at mm/vmalloc.c:331 __vunmap()
 [<f886d682>] intel_i830_free_by_type+0x42/0x70 [intel_agp]
 [<c024b352>] agp_free_memory+0x72/0x90
 [<c0249dc5>] agpioc_deallocate_wrap+0x15/0x20
 [<c024a0f0>] agp_ioctl+0x230/0x410
 [<c012e0c0>] autoremove_wake_function+0x0/0x50
 [<c01772a8>] do_ioctl+0x78/0x90
 [<c017731c>] vfs_ioctl+0x5c/0x2b0
 [<c016a5f0>] do_sync_write+0x0/0x110
 [<c01775e2>] sys_ioctl+0x72/0x90
 [<c01040a4>] syscall_call+0x7/0xb
 [<c0310000>] vcc_create+0x50/0x100
 =======================
------------------------------------------------------

More sketchiness in dmesg:

------------------------------------------------------
agpgart: pg_start == 0x00000038,intel_i830_private.gtt_entries == 0x000007bf
agpgart: Trying to insert into local/stolen memory
[drm:drm_agp_bind_ttm] *ERROR* AGP Bind memory failed
[drm:drm_bind_ttm] *ERROR* Couldn't bind backend.
[drm:drm_buffer_object_validate] *ERROR* Failed moving buffer.
------------------------------------------------------

I'll also attach my xorg.0.log.

Software versions:
------------------------------------------------------
X Window System Version 1.2.99.902 (1.3.0 RC 2)
Release Date: 14 March 2007
X Protocol Version 11, Revision 0, Release 1.2.99.902
Build Operating System: Linux Debian

libdrm: Debian 2.3.0-1
xserver-xorg-video-intel: Debian 2:1.9.92-1
Kernel: 2.6.21-rc4
drm: git://anongit.freedesktop.org/git/mesa/drm
agp: git://git.freedesktop.org/git/mesa/linux-agp-compat
------------------------------------------------------
Comment 1 Andreas Kloeckner 2007-03-21 09:15:18 UTC
Created attachment 9250 [details]
xorg log file
Comment 2 Michel Dänzer 2007-03-21 09:24:36 UTC
My guess would be the amount of aperture space reserved for the DRM memory manager is too small. Or maybe Thomas has an idea.
Comment 3 Andreas Kloeckner 2007-03-21 09:52:40 UTC
agpgart says the aperture is "256M @ 0xb0000000" (see below), and the xorg log file says it's only asking for 32M.

------------------------------------------
(II) intel(0): Will try to reserve 32768 kiB of AGP aperture space
        for the DRM memory manager.
------------------------------------------

More details in relation to agp stuff:
-------------------------------------------
$ dmesg | grep -i agp
Linux agpgart interface v0.102 (c) Dave Jones
agpgart: Detected an Intel 915GM Chipset.
agpgart: Detected 7932K stolen memory.
agpgart: AGP aperture is 256M @ 0xb0000000
 [<f8858682>] intel_i830_free_by_type+0x42/0x70 [intel_agp]
 [<c024b352>] agp_free_memory+0x72/0x90
 [<c0249dc5>] agpioc_deallocate_wrap+0x15/0x20
 [<c024a0f0>] agp_ioctl+0x230/0x410
 [<f8858682>] intel_i830_free_by_type+0x42/0x70 [intel_agp]
 [<c024b352>] agp_free_memory+0x72/0x90
 [<c0249dc5>] agpioc_deallocate_wrap+0x15/0x20
 [<c024a0f0>] agp_ioctl+0x230/0x410
 [<f8858682>] intel_i830_free_by_type+0x42/0x70 [intel_agp]
 [<c024b352>] agp_free_memory+0x72/0x90
 [<c0249dc5>] agpioc_deallocate_wrap+0x15/0x20
 [<c024a0f0>] agp_ioctl+0x230/0x410
agpgart: pg_start == 0x00000038,intel_i830_private.gtt_entries == 0x000007bf
agpgart: Trying to insert into local/stolen memory
[drm:drm_agp_bind_ttm] *ERROR* AGP Bind memory failed
-------------------------------------------------------------

I'll also attach my xorg.conf.
Comment 4 Andreas Kloeckner 2007-03-21 09:53:24 UTC
Created attachment 9251 [details]
xorg config
Comment 5 Thomas Hellström 2007-03-22 11:57:46 UTC
Debian is probably not using a compatible AGP driver and probably an old DRM.

Please upgrade to currend drm git and either a 2.6.21 kernel or fetch an agpgart driver from 
git://git.freedesktop.org/git/mesa/linux-agp-compat.

Comment 6 Andreas Kloeckner 2007-03-22 13:26:01 UTC
Quoting from my version note above:

-----------------------------------------------------------
Kernel: 2.6.21-rc4
drm: current from git://anongit.freedesktop.org/git/mesa/drm
agp: current from git://git.freedesktop.org/git/mesa/linux-agp-compat
-----------------------------------------------------------
Comment 7 Thomas Hellström 2007-03-22 14:02:50 UTC
(In reply to comment #6)
> Quoting from my version note above:
> 
> -----------------------------------------------------------
> Kernel: 2.6.21-rc4
> drm: current from git://anongit.freedesktop.org/git/mesa/drm
> agp: current from git://git.freedesktop.org/git/mesa/linux-agp-compat
> -----------------------------------------------------------
> 

Sorry,
It's me not reading properly at this late hour.

This is the root of the problem:
(II) intel(0): 0x00000000-0x0001ffff: ring buffer (128 kB)
(II) intel(0): 0x00020000-0x00027fff: logical 3D context (32 kB)
(II) intel(0): 0x00028000-0x00037fff: xaa scratch (64 kB)
(II) intel(0): 0x00038000-0x00237fff: DRI memory manager (2048 kB)

The memory manager is placed in the stolen memory area but it needs a fixed 
area of unused aperture space, and cannot be moved. Ever. That's why it was originally placed at the very end of the aperture.
 
Need to figure out why AGP crashes, though.

/Thomas

 
Comment 8 Thomas Hellström 2007-03-22 14:13:07 UTC
> Need to figure out why AGP crashes, though.
> 
> /Thomas
> 

Hmm,
Seems like the intel xorg driver is trying to free an agp area it never allocated, and agpgart is not doing proper input checking.

This is all probably due to recent changes in aperture space allocation strategies in xf86-video-intel.

/Thomas


Comment 9 Khashayar Naderehvandi 2007-03-27 05:13:30 UTC
Added myself to the CC list since I'm having the exact same problem and interested in a resolution.
Comment 10 Michel Dänzer 2007-03-27 06:18:54 UTC
I think this is a regression that should be looked into before release.
Comment 11 Khashayar Naderehvandi 2007-03-28 11:44:01 UTC
(In reply to comment #10)
> I think this is a regression that should be looked into before release.
> 

I just wanted to say that I've tried this with the intel driver from git head + xserver 1.3RC3, as well as mesa-git. It's still a no-go. I'm on a 855GM. I really hope this gets fixed before release...

If I can help in anyway, please let me know.
Comment 12 Khashayar Naderehvandi 2007-03-31 02:54:07 UTC
Using the dri drivers from mesa-git solves this problem, although 3D-performance is noticeably worse. Compiz, e.g. is no longer usable (under AIGLX). It feels like some of the actions are done in software mode (high CPU usage when scrolling, etc.)
Comment 13 Gordon Jin 2007-08-20 20:55:56 UTC
Closing as comment#12 says mesa-git fixes the reported issue.

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.