Hi all.
For all those who tried to have DRI work on Intel Sonoma chipset here are good news. That chipset is available in many laptops, including Dell Inspiron 6000 and Samsung X20. However the implementation varies quite a lot between brands and even within a brand itself. In fact the i915 supports some features, including high-definition audio. But hardware manufacturers are free to use it... or not. As far as I can tell, there is no HDA in Dell Inspiron 6000 for instance.
But it's not the topic of this thread. If, like me and many other ones, you have an Intel Sonoma chipset (i915GM) and never could get DRI to work properly - or tried and got poor results, this is for you
The following applies if...
- you have a i915 chipset and
- you have a recent vanilla-based kernel: >=suspend2-sources-2.6.12-r3, >=vanilla-sources-2.6.12_rc5(*), >=gentoo-sources-2.6.12-r6(*) and
- you have kernel support for i915 drm (either built-in or as a module) and
- you have selected xorg driver i810 in xorg.conf and
- you are not using DRI snapshots
I don't use modelines in my xorg.conf since XOrg >= 6.8.99 supports non-standard modes of i915 chipset. However you'll notice that XOrg is using VESA facilities to setup graphics mode:
Code: Select all
# grep -i vesa /var/log/Xorg.0.log
(II) I810(0): VESA BIOS detected
(II) I810(0): VESA VBE Version 3.0
(II) I810(0): VESA VBE Total Mem: 7872 kB
(II) I810(0): VESA VBE OEM: Intel(r)915GM/910ML/915MS Graphics Chip Accelerated VGA BIOS
(II) I810(0): VESA VBE OEM Software Rev: 1.0
(II) I810(0): VESA VBE OEM Vendor: Intel Corporation
(II) I810(0): VESA VBE OEM Product: Intel(r)915GM/910ML/915MS Graphics Controller
(II) I810(0): VESA VBE OEM Product Rev: Hardware Version 0.0
(II) I810(0): VESA BIOS detected
(II) I810(0): VESA VBE Version 3.0
(II) I810(0): VESA VBE Total Mem: 12288 kB
(II) I810(0): VESA VBE OEM: Intel(r)915GM/910ML/915MS Graphics Chip Accelerated VGA BIOS
(II) I810(0): VESA VBE OEM Software Rev: 1.0
(II) I810(0): VESA VBE OEM Vendor: Intel Corporation
(II) I810(0): VESA VBE OEM Product: Intel(r)915GM/910ML/915MS Graphics Controller
(II) I810(0): VESA VBE OEM Product Rev: Hardware Version 0.0
(II) I810(0): VESA VBE PanelID read successfully
(II) I810(0): VESA VBE DDC supported
(II) I810(0): VESA VBE DDC Level 2
(II) I810(0): VESA VBE DDC transfer in appr. 1 sec.
(II) I810(0): VESA VBE DDC read successfully
(II) I810(0): VESA BIOS detected
(II) I810(0): VESA VBE Version 3.0
(II) I810(0): VESA VBE Total Mem: 7872 kB
(II) I810(0): VESA VBE OEM: Intel(r)915GM/910ML/915MS Graphics Chip Accelerated VGA BIOS
(II) I810(0): VESA VBE OEM Software Rev: 1.0
(II) I810(0): VESA VBE OEM Vendor: Intel Corporation
(II) I810(0): VESA VBE OEM Product: Intel(r)915GM/910ML/915MS Graphics Controller
(II) I810(0): VESA VBE OEM Product Rev: Hardware Version 0.0A little bit of history
I have a Dell Inspiron 6000 that I immediately installed with Gentoo Linux. I had already installed a couple of machines with Gentoo so I was pretty confident. But when you deal with laptops, things can get terribly difficult, reminding how it's easy under... Window$ (sorry but that's true).
First time I tried xorg 6.8 on my laptop I got a black screen when I started X. I then used unmasked versions of Xorg. I tried 6.8.2 and almost every 6.8.99.xx. There were strange messages with dmesg like
Code: Select all
# dmesg | grep -i agpgart
Linux agpgart interface v0.101 (c) Dave Jones
agpgart: Detected an Intel 915GM Chipset.
agpgart: Detected 7932K stolen memory.
agpgart: AGP aperture is 256M @ 0xc0000000I also checked Gentoo forums: Dell Inspiron 6000, started by Sejam and i915 and xorg - how? started by Klavs. Many of us, posters, tried DRI snapshots and that mostly... did not work. (There are people who reported they do on their machine.) For instance checking glxinfo says
Code: Select all
$ glxinfo | grep direct
direct rendering: No.Code: Select all
(II) I810(0): detected 7932 kB stolen memory.
(II) I810(0): I830CheckAvailableMemory: -545582944 kB available
...
(II) I810(0): 15440 kBytes additional video memory is required to
enable tiling mode for DRI.
(II) I810(0): 3040 kBytes additional video memory is required to enable DRI.
(II) I810(0): Disabling DRI.I have searched for months in forums and Googled the Internet in vain. Yesterday, completely by chance, I saw this article on Gentoo wiki, especially the title "DRI, Xvideo and co.". It's about patching lnx_agp in Xorg source files, which is the topic of this thread.
Alan Hourihane (xorg developer) is tracking down the real reason why DRI may not work with i915 (http://lists.freedesktop.org/pipermail/ ... 08735.html). He provided a workaround as a patch. So let me remind you:
However the impact on DRI is - let's hope - the same.I wrote:this is just a workaround and not a fix.
The patches
Note: You will be creating patches from scratch. Be careful to replace indent spaces with tabs since this is a standard for ebuild, especially. If you don't replace spaces with tabs, patch may fail with an error message like:
Code: Select all
patching file xorg-x11-6.8.99.15.ebuild
Hunk #1 FAILED at 33.
Hunk #2 FAILED at 491.
2 out of 2 hunks FAILED -- saving rejects to file xorg-x11-6.8.99.15.ebuild.rejWhy? I went a bit frustrated with my fix attempts disappearing after an emerge sync. Don't worry, that's normal. So if you want your changes to pertain even after portage updates, use a portage overlay.
Update (9 oct. 2005): Portage overlays take precedence over official ebuilds in portage hence we're going to use that feature. At the time of this writing I initially renamed Xorg ebuild (xorg-x11-6.8.99.15) but you can simply copy the official ebuild to the portage overlay directory. Note you will have to repeat these steps and patch subsequent Xorg ebuild versions after a sync.
I also defined a USE flag to control whether the patch will be applied to lnx_agp or not. you must set dri-patch to compile Xorg with the DRI patch applied.
You might object this is a big overhead but if an new ebuild with the same name is released it won't conflict with this one. Finally since I'm working with the original sources I found it convenient to revert to the initial ebuild: just remove the use flag to emerge.
What will we do?
- We will first create the overlay structure.
- Then we'll save a custom file to patch XOrg's lnx_agp.c.
- We'll copy and patch the official xorg ebuild.
- We'll sign the new ebuild with the digest.
- We'll finally make sure make.conf directs portage to use the new overlay directory.
First create the overlay directory, typically /usr/local/portage/. XOrg patches are downloaded and applied in batch. Small patches are put into portage tree in the ./files sub-directory of the ebuild directory. This is where we'll put our custom patch. That directory is mapped to the $FILESDIR variable in ebuilds. Since you'll have to copy the exact structure of the ebuild you want to change hence you create the whole structure in one go:
Code: Select all
~ # mkdir -p /usr/local/portage/x11-base/xorg-x11/files/Code: Select all
~ # cp -p /usr/portage/x11-base/xorg-x11/xorg-x11-6.8.99.15.ebuild /usr/local/portage/x11-base/xorg-x11/Code: Select all
~ # nano /usr/local/portage/x11-base/xorg-x11/files/dri-lnx_agp.patch
~ # cat /usr/local/portage/x11-base/xorg-x11/files/dri-lnx_agp.patch
Note: This patch has been tweaked by VinzC to be applied using portage
Source: http://www.gentoo-wiki.com/HARDWARE_Samsung_X20#DRI.2C_Xvideo_and_co.
--- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c 2005-07-03 09:01:32.000000000 +0200
+++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c~ 2005-07-28 13:26:41.000000000 +0200
@@ -139,6 +139,12 @@
return NULL;
}
+ /*
+ * Workaround to get DRI working with i915
+ * (http://www.gentoo-wiki.com/HARDWARE_Samsung_X20#DRI.2C_Xvideo_and_co.)
+ */
+ memset((char*)&agpinf, 0, sizeof(agpinf));
+
if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
xf86DrvMsg(screenNum, X_ERROR,
"xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n",
Info: ebuilds are decompressed in a temporary location, /var/tmp/portage/<ebuild-category>/<ebuild-name>/work. They traditionnally apply patches in the ebuild unpack step (see ebuild: A Safer Approach for more information on how ebuilds work). This is where we place the new code to apply our custom patch lnx_agp.c.
Here's a patch (yeah, gimme one more patch!) to change the ebuild but you can change the ebuild manually. To patch the ebuild, save the text that follows the cat instruction below into /root/xorg-ebuild.diff:
Code: Select all
# nano ~/xorg-ebuild.diff
# cat ~/xorg-ebuild.diff
--- xorg-x11-6.8.99.15.ebuild 2005-07-21 22:05:58.000000000 +0200
+++ xorg-x11-6.8.99.15.ebuild~ 2005-07-28 22:35:41.000000000 +0200
@@ -33,7 +33,8 @@
# IUSE="gatos" disabled because gatos is broken on ~4.4 now (31 Jan 2004)
IUSE="3dfx bitmap-fonts cjk debug doc font-server insecure-drivers ipv6 minimal
- nls nocxx opengl pam sdk static truetype-fonts type1-fonts uclibc xprint xv"
+ nls nocxx opengl pam sdk static truetype-fonts type1-fonts uclibc xprint xv
+ dri-patch"
# IUSE_INPUT_DEVICES="synaptics wacom"
FILES_VER="0.1"
@@ -490,6 +491,11 @@
cd ${WORKDIR}
EPATCH_SUFFIX="patch" \
epatch ${PATCHDIR}
+
+ # Patch using DRI workaround
+ if use dri-patch; then
+ epatch ${FILESDIR}/dri-lnx_agp.patch
+ fi
cd ${S}
}
Important
The example above uses xorg-x11-6.8.99.15. With subsequent releases of xorg 6.8.99.15 you will have to edit the first two lines in xorg-ebuild.diff so that they match the new ebuild file name.
For example, to patch xorg-x11-6.8.99.15-r4:
Code: Select all
# head -n 2 ~/xorg-ebuild.diff
--- xorg-x11-6.8.99.15-r4.ebuild 2005-07-21 22:05:58.000000000 +0200
+++ xorg-x11-6.8.99.15-r4.ebuild~ 2005-07-28 22:35:41.000000000 +0200Code: Select all
# cd /usr/local/portage/x11-base/xorg-x11/
xorg-x11 # patch -p0 < ~/xorg-ebuild.diffCode: Select all
xorg-x11 # egrep -A 12 -B 0 '^do_patch' xorg-x11-6.8.99.15.ebuild
do_patch() {
# Bulk patching - based on patch name
# Will create excluded stuff once it's needed
cd ${WORKDIR}
EPATCH_SUFFIX="patch" \
epatch ${PATCHDIR}
# Patch using DRI workaround
if use dri-patch; then
epatch ${FILESDIR}/dri-lnx_agp.patch
fi
cd ${S}
}Code: Select all
xorg-x11 # nano /etc/make.conf
xorg-x11 # grep -i -C 1 overlay /etc/make.conf
PORT_DIR=/usr/portage
PORTDIR_OVERLAY="/usr/local/portage"
PORT_LOGDIR=/var/log/portageCode: Select all
xorg-x11 # ebuild xorg-x11-6.8.99.15.ebuild digest
>>> Generating digest file...
<<< eurofonts-X11.tar.bz2
<<< xfsft-encodings-0.1.tar.bz2
<<< gentoo-cursors-tad-0.3.1.tar.bz2
<<< gemini-koi8-u.tar.bz2
<<< xorg-x11-6.8.99.15-files-0.1.tar.bz2
<<< xorg-x11-6.8.99.15-patches-0.1.2.tar.bz2
<<< xorg-x11-6.8.99.15.tar.bz2
>>> Generating manifest file...
<<< xorg-x11-6.8.99.15.ebuild
<<< files/dri-lnx_agp.patch
<<< files/digest-xorg-x11-6.8.99.15
>>> Computed message digests.
xorg-x11 # ls -lR
.:
total 60
-rw-rw-r-- 1 root portage 213 Jul 28 22:50 Manifest
drwxr-xr-x 2 root root 136 Jul 28 14:17 files
-rw-r--r-- 1 root root 54182 Jul 28 22:35 xorg-x11-6.8.99.15.ebuild
./files:
total 8
-rw-rw-r-- 1 root portage 516 Jul 28 22:50 digest-xorg-x11-6.8.99.15
-rw-r--r-- 1 root root 901 Jul 28 14:14 dri-lnx_agp.patchInstalling the modified XOrg
Now the ebuild is ready and will update your current installation of XOrg with the overlay. Since you're using the same ebuild file name as the official one in portage and you've probably unmasked it, no further step is required. Remember we defined a USE flag to enable the patch on XOrg. Type USE="dri-patch" before the actual emerge instruction:
Code: Select all
xorg-x11 # USE="dri-patch" emerge -av xorg-x11
These are the packages that I would merge, in order:
Calculating dependencies ...done!
[ebuild U ] x11-base/xorg-x11-6.8.99.15 [6.8.99.15] -3dfx +bitmap-fonts -cjk -debug -doc +dri-patch* -font-server -insecure-drivers -ipv6 -minimal +nls -nocxx +opengl +pam -sdk -static +truetype-fonts +type1-fonts (-uclibc) -xprint +xv 0 kB [1]
Total size of downloads: 0 kB
Portage overlays:
[1] /usr/local/portage
Do you want me to merge these packages? [Yes/No] y
...Code: Select all
$ glxinfo | head -n 3
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
$ glxgears
6571 frames in 5.0 seconds = 1314.166 FPS
6509 frames in 5.0 seconds = 1301.620 FPS
6521 frames in 5.0 seconds = 1304.011 FPS
6569 frames in 5.0 seconds = 1313.762 FPS
6572 frames in 5.0 seconds = 1314.397 FPS
6624 frames in 5.0 seconds = 1324.633 FPS
6574 frames in 5.0 seconds = 1314.659 FPS
6492 frames in 5.0 seconds = 1298.331 FPSConclusion
You can revert the patch by clearing the use flag on the command line. Note if you don't add it to your /etc/make.conf you'll only have to type emerge xorg to re-emerge the same ebuild but without the lnx_agp patch.
I haven't tested this patch with earlier versions of XOrg. I have successfully applied it to all 6.8.99.xx releases, up to -r4. It might be applied to version 6.8.2 however. It doesn't make sense to apply it to even earlier versions as they don't support i915 chipset [properly].
Acknowledgements
Last but not least: thanks to everyone who posted in these forums (Sejam, Klavs, stormer, lancealtar, PolarXL, et al. Believe me, they are many
[Some]References
Here are some posts and articles I read that helped me; take your time
- freedesktop.org: i915 uses only 8mb video ram and disables xv, dri
- freedesktop.org: i915 driver. Mesa 6.3 implementation error.
- Gentoo Forums: Dell Inspiron 6000
- Gentoo Forums: [SOLVED]i915: Xorg only detects 8MB RAM
- Gentoo wiki: HOWTO Create an Updated Ebuild - Gentoo Linux Wiki
- Gentoo documentation: Ebuild HOWTO
- Prepared make.conf before computing the digest
- Ebuild patching changed (copy, patch and rename)
- Ebuild patch: date/time changed
- Patch level in ebuild patch
- Leading garbage partly removed from dri patch (Index)
- Note about spaces in patches (fix for patch failure)
- Removed rename instructions with overlay
- Note on recent releases of xorg.




