Native Poulsbo (GMA 500) graphics driver for Fedora 10+

So, yes - today I successfully got the 'psb' driver from the Ubuntu Mobile repositories built and working on Fedora 10, with my Sony Vaio P.

Some new packages showed up in the Ubuntu repositories this morning, newer versions built for 9.04. So I thought I'd give it another shot on Fedora. And, with a bit of fiddling, it works. The packages build on Rawhide, too, so it should also work on Fedora 11, but I haven't tested that yet. (I doubt video and 3D acceleration can work, as the proprietary Xpsb lump, which is some pre-built modules for X, hasn't been released for Ubuntu 9.04 yet - it's still only for 8.10, which is an older X server version).

Here's the .src.rpm's:

libdrm-poulsbo psb-kmod psb-firmware xpsb-glx xorg-x11-drv-psb

And here's binary packages, for Fedora 10 fully updated with kernel 2.6.27.21-170.2.56.fc10.i586 (you'll have to rebuild the psb-kmod .src.rpm for any other kernel, I can't figure out how to make it spit out an akmod package):

libdrm-poulsbo libdrm-poulsbo-devel (you only need that if you want to rebuild any of the other bits) kmod-psb-2.6.27 kmod-psb psb-firmware xpsb-glx xorg-x11-drv-psb

You need to download and install them all together. I haven't bothered building a dependency chain between them or creating a metapackage to require them all, yet. It's a bit rough and ready.

So far, 3D acceleration doesn't work - I think because I'm missing some kind of janky rebuilt version of the Mesa DRI libraries that's in the Ubuntu repositories. 2D video playback acceleration should be working, but I haven't yet built the special version of mplayer that's needed to test that. I'll take a shot at those two (and some tidying up) tomorrow. If you're interested, here is the Mesa DRI library stuff, and here is the patched mplayer (take note of the requirements at the bottom).

To get it going, you need to load psb on boot - it doesn't come with any modaliases (sigh), so it doesn't get automatically loaded - just stick 'modprobe psb' in /etc/rc.local . Then you need a /etc/X11/xorg.conf which specifies psb as the required driver. That should be all. UNLESS you have a Vaio P, at least by my experience. X will fail to start, with a strange error in Xorg.0.log: "could not mmap framebuffer...(operation not permitted)". There's another error in /var/log/messages - something like "program xorg tried to access /dev/mem between foo and bar". The workaround for this took a bit of lateral thinking - it's something to do with memory mapping, so...futz with the memory. Turns out that pretending you have 512MB, 1GB or 1.5GB of RAM makes it work (haven't tried higher than that yet - the P actually has 2GB). So just add:

mem=1500MB

as a kernel parameter. And then you should be good to go.

One thing I found impressive is that the driver actually has a rather good RandR implementation. It has the no-dynamic-framebuffer-resizing limitation, so you need to add a Screen section to xorg.conf something like this:

Section "Screen" Identifier "screen1" Device "Videocard0" DefaultColorDepth 24

    Subsection "Display"
            Depth 24
            Virtual 3280 1050
    EndSubsection

    Subsection "Display"
            Depth 16
            Virtual 3280 1050
    EndSubsection

    Subsection "Display"
            Depth 15
            Virtual 3280 1050
    EndSubsection

    Subsection "Display"
            Depth 8
            Virtual 3280 1050
    EndSubsection

EndSection

but once you have that, the chip is capable of driving my setup - the P's internal 1600x768 display, and an external 20", 1680x1050 display - side-by-side (since it's RandR 1.2+ stuff, you can configure it with gnome-display-properties). Pretty neat. It even seems to have some level of hotplugging - when I unplugged the external display, it automatically resized everything down to the internal display, without even needing to do xrandr --auto. Nice.

This should be fairly easy to adapt to other distros from my .src.rpm's, I might try and throw together Mandriva packages this weekend if I get time (have to turn the kmod package into a DKMS package). But, of course, it's not fully F/OSS, not suitable for inclusion in the repos for F/OSS distros. Let me know how you get on with this stuff in the comments.

Comments

Felix wrote on 2009-05-14 07:02:
It will spit out an akmod as soon as you comment out %define buildforkernels newest
adamw wrote on 2009-05-14 16:03:
Aha! So that's what that cryptic comment means. :) Thanks, Felix.
Oriol Rius wrote on 2009-05-14 09:25:
I can not found this packages in Ubuntu Jauty repository, can you tell me where did you find it?
adamw wrote on 2009-05-14 16:09:
Ah, you naive person, expecting it to be that easy ;) As discussed in earlier posts about this topic, this stuff blurts out of a fairly obscure PPA, to be found here: http://ppa.launchpad.net/ubuntu-mobile/ubuntu/pool/main/p/psb-kernel-source/ it's basically, as far as anyone can tell, the repository for stuff that winds up in the custom builds of Ubuntu that ship with Dell systems. Canonical, Dell and Intel are all very quiet about it. For reference, these bits are open source and the source is in the tarballs in that repository: libdrm-poulsbo, psb-kmod, xorg-x11-drv-psb . psb-firmware and xpsb-glx are proprietary lumps - the 'source' tarballs contain a firmware lump and several prebuilt libraries / X.org drivers (respectively), the packaging consists solely of dumping them into the appropriate location. The license on them specifically forbids modification, including reverse engineering (I'm not sure whether that would stand up in court).
pabr wrote on 2009-05-14 14:10:
I tried on a Vaio P, FC10, kernel 2.6.29. Gave up on solving the rpmfusion dependencies and compiled psb-kernel-source-4.40 manually with "make DRM_MODULES=psb". Merely inserting psb.ko kills the text console (screen goes black with green garbage at the top). Is this normal ? X is terminated by oom-killer on startup, after mmap'ing a total of 45 MB from /dev/dri/card0 (according to strace). "Program X tried to access /dev/mem between 7f6a3000->7fea4000" seems to be triggered by CONFIG_STRICT_DEVMEM and xf86MapVidMem(). This is puzzling - how do all the other drivers with "stolen" video memory avoid this ? So, still no luck for me, but thanks for all your work. After trying to match gregkh's staging drm driver with the Ubuntu 8.10 sources I can appreciate the effort. Maybe I will downgrade to 2.6.27 later.
[...] on Linux – that was unintentional because there’s no information here. Please look at Adam Williamson’s work on a native driver for Poulsbo [...]
adamw wrote on 2009-05-14 16:02:
pabr: "Merely inserting psb.ko kills the text console (screen goes black with green garbage at the top). Is this normal ?" No, here it just gives me a native resolution (think tiny!) framebuffer console. Did you load both the psb.ko and modified drm.ko modules? Oh, for rebuilding the package - to get the RPMFusion dependencies right you'll need to specify --target i586 (or --target i686 if you're on an i686 kernel) when building the modules. The architecture of the buildsys-build-rpmfusion-kerneldevpkgs-current dependency is actually dynamic, it's generated from the target CPU for the build. So installing buildsys-build-rpmfusion-kerneldevpkgs-i586 and then rebuilding the .src.rpm with --target i586 should work (that's how I built it). Having said all that - I haven't tried on 2.6.29 yet, because the wireless adapter in my P doesn't work with the latest 2.6.29 from Koji (it can never connect to my router). Does yours work?
pabr wrote on 2009-05-14 17:03:
adamw: Yes, WiFi works (including WPA) with vanilla 2.6.29 from kernel.org and userspace tools from FC10 updates. IIRC I set up some config files manually, but that's mostly because I am not familiar with the redhat GUIs.
adamw wrote on 2009-05-14 17:16:
interesting. Maybe it's something to do with my router, then. It *is* running a snapshot build of dd-wrt :) However, I was using Fedora's 2.6.29 (from Koji), not upstream. Did you have to patch the kmod build to work on 2.6.29 at all? I had to make two one-liner changes for it to build on 2.6.29 here (testing on my Rawhide desktop).
pabr wrote on 2009-05-14 17:40:
I did apply psb-kmod_build.patch from your source rpm, and it compiled under 2.6.29 with only warnings (notably about PAT).
adamw wrote on 2009-05-14 18:08:
it's possible one of the changes in that patch (the complete removal of a line) is the 'wrong' fix. I'm not a kernel hacker, I derived that fix from similar changes made to other drivers that I found on Google. So if you actually know more than me, you might want to check if it's the right fix for this case. :) That patch is only applied for 2.6.29 (not 2.6.27) - on 2.6.27 it builds unpatched and doesn't actually build after the patch - so there is a difference there: I haven't actually tested yet if it works patched myself. So it's possible that's the problem.
pabr wrote on 2009-05-16 17:21:
OK, one problem was that my kernel had CONFIG_FRAMEBUFFER_CONSOLE disabled, and psb.ko apparently cannot coexist with a regular text console. I now have basic 2D acceleration on 2.6.27.23 with a heavily customized kernel config, thanks ! On 2.6.29, X still triggers oom-killer on startup.
adamw wrote on 2009-05-16 18:38:
Ah, OK. I'll try and get 2.6.29 running here and see what happens for me...
pabr wrote on 2009-05-17 20:11:
Hmmm, I only just discovered the xrandr/multihead fiasco: http://modeemi.fi/~tuomov/b/archives/2008/07/13/T18_03_06/ I.e. recent X drivers do not support "zaphod mode" (multiple X screens) anymore. It looks like the ATI people have re-developed the functionality on top of xrandr, but the intel driver (which psb is based on) has dropped it entirely. This means only a few window managers will be usable with a dual-head setup on poulsbo...
adamw wrote on 2009-05-17 22:30:
That's an extremely misinformed post. RandR provides perfectly good cues for window managers to deal with multiple screens appropriately. GNOME / metacity work very well with RandR 1.2-based multiple displays, I have used such setups extensively. KDE rather screws it up in some ways, but that's KDE's fault, no-one else's.
[...] had a bit of luck getting the Poulsbo going on Fedora 10. I haven’t been so lucky under F11 yet, and the wireless card could apparently [...]
pabr wrote on 2009-05-18 09:18:
So you tested two mainstream window managers, and only one of them supports RandR hints correctly. I would say this confirms my opinion :-) (kwin probably handles RandR now, though.) Needless to say, most of the lesser-known window managers support neither RandR nor Xinerama - and they didn't need to, since X configured with multiple screens had been providing reasonable multihead functionality for about 20 years. Besides, nobody will bother hacking RandR support into every single WM on earth, because everybody expects RandR 1.3 to fix the problem sometime in the future. In the meantime I am stuck with clone mode.
adamw wrote on 2009-05-18 17:22:
Being a cheerfully biased kinda person, I prefer to see it as proof that KDE sucks =) Seriously, though, I take your point, but frankly, I think the way RandR 1.2 handles things is so massively better that it really rather offsets that issue. Of course, I use metacity :)
pabr wrote on 2009-05-19 10:06:
"[mi] EQ overflowing. The server is probably stuck in an infinite loop." This happens a couple times per day with the psb driver on Fedora 10. The display freezes (except the mouse pointer) and I have to kill the X server. I know this error message is not specific to psb; but I never got it with the vesa driver.
Poulsbo 2D Working « Tyroeternal wrote on 2009-06-03 19:08:
[...] These packages have also been brought over to the Fedora distribution for users of Fedora 10 and hopefully Fedora 11 as well: http://www.happyassassin.net/2009/05/13/native-poulsbo-gma-500-graphics-driver-for-fedora-10/ [...]
Olivier DAVID wrote on 2009-06-19 04:17:
Adam, we tried these src.rpm on a custom poulsbo platform, and it seems to have version incompatibilities. Where can we find a complete list of versions used for your test (for xorg, xserver, mesa, kernel, ...) ?
adamw wrote on 2009-06-19 04:38:
that post was done on fedora 10 with current updates, kernel 2.6.27. just look at what's in fedora 10 to know what I was using.
reiv wrote on 2009-06-19 13:03:
I make my eking i1(intel atom + gma500 umpc) working including 3D acceleration(direct rendering = yes). I use everything from this post(.src.rpm) except psb_dri.so(in xpsb-glx-0.11-1.aw_fc11.src.rpm), the one I used is from http://netbook-remix.archive.canonical.com/ubuntu/dists/hardy-dell-mini/main/binary-lpia/libgl1-mesa-dri-psb_0.24+repack+0038.1-0netbook1_lpia.deb below is the list of installed packages(or files) + install using portage (my system is gentoo) - kernel: 2.6.29-gentoo-r5(build kmod from .src.rpm) - x11-base/xorg-server: 1.4.2 - media-libs/mesa: 7.0.3 - x11-libs/libdrm: 2.3.0(from .src.rpm, libdrm-poulsbo) + install manually(compile & copy .so to system dir) - xorg-x11-drv-psb: use src.rpm version, compiled against libdrm-2.3.0, xorg-server-1.4.2 - psb_dir.so: from libgl1-mesa-dri-psb_0.24+repack+0038.1-0netbook1_lpia.deb - Xpsb.so, psb_drv_video.so: from xpsb-glx-0.11-1.aw_fc11.src.rpm PS: glxgears report the fps is about 220, is this a regular value?
adamw wrote on 2009-06-19 16:11:
I'm not sure, I don't have the 3D working. The Ubuntu forum thread has lots of success / failure reports about the 3D. Probably the easiest thing to do is just see if compiz works, if it does, the 3D's running well.
reiv wrote on 2009-06-20 03:34:
compiz claimed "GLX_EXT_texture_from_pixmap is missing" and exit, but glxinfo show there is GLX_EXT_texture_from_pixmap.
jeje35 wrote on 2009-06-22 07:52:
I've been using Fedora 10 with all your above rpm and I have a mismatch version in kernel modules. It seems the modules (drm.ko and psb.ko) are 2.6.27.21-170 version and the kernel in Fedora is 2.6.27.21-170 version. Is there a way to overpass this issue? Do I have the wrong modules version?
jeje35 wrote on 2009-06-23 15:38:
Hi Adam, Can you tell me where to find the 2.6.27.21-170.2.56.fc10.i586 rpm? Thanks
_stalker_ wrote on 2009-07-02 01:23:
hey guys, thanx adam for those packages. that's really helpful... even though I could not get to compile them :( I have the dell mini 12. it was shipped with the dell customized version of ubuntu. reiv: glxgears gave a rate of 900... anyway, I wanted to blast it out and to go for gentoo (I've been using it for 7 years) 1) I could not get to compile the kernel mod neither the xorg driver. my kernel is a 2.6.28 with the tuxonice patches (is 2.6.29 mandatory?). here is the error line of the compiler: "include/linux/mmzone.h:277: error: 'MAX_NR_ZONES' undeclared here" 2) for the xorg driver: " mm_drm.c: In function 'bufMask': mm_drm.c:207: error: 'drmBO' has no member named 'mask' " do you guys have any idea for a fix? reiv: you wrote you successfully compiled those. could you give some details on that? a quick how-to would be perfect :) :) :) thanx again for your work guys and (I hope) for your answers
kushalkoolwal wrote on 2009-07-05 21:13:
Hi, I am trying to make the Poulsbo driver work on Debian system. Does anybody has any pointers on how to get started on this? Can I just convert the rpm packages to deb using alien and install them? I do realize that I will still need to compile the psb drm module for my existing kernel. Or else if I have to build all the deb packages from the source, how do I get started? I am willing to spend some time on this but I need some direction as to how to proceed. Thanks
kushalkoolwal wrote on 2009-07-09 18:20:
Ok, last week I tried to get the psb driver work on Debian (5.0) using your sources. I was able to build the modules successfully and during boot it seems that the psb framebuffer module is getting loaded as my screens goes off for couple of seconds from ugly console and then it comes back with crisp resolution on the console while it is still booting. However, as soon as my Xserver starts I get the following error message in my Xorg log file: xf86MapVidMem: Could not mmap framebuffer (0x00000000, 0xdfe80000) (Cannot allocate memory) I also tried the mem=1500M parameter as suggested by AdamW but as soon as the kernel tries to boot I get the following message: Error 28: Selected item cannot fit into memory. Any clues?
sofauxboho wrote on 2009-07-14 01:23:
In Ubuntu Jaunty on my P588E setting the kernel parameter to mem=2000MB also allows the machine to boot without framebuffer errors, and also allows the use of all of the P's memory. It would seem something is detecting total memory incorrectly. Obvious but worth noting: with the mem=1500MB kernel option, the free command obviously reports only 1.5gb of memory available while running. You're tossing out half a gig of RAM there.
g675 wrote on 2009-07-16 18:11:
Adam, firstly I am completely new to Linux so excuse my wet behind the ears questions. I have found your blog invaluable in a number of areas the past week or two whilst I 'learn the ropes' having installed Ubuntu. Where I am still struggling, is one of your favourite subejcts; the video driver on the VAIO-P. I have followed your instructions, seen to have got the driver and packages installed operationally, however am still getting the "framebuffer" error you mention in your post. I have entered the mem=1500MB line, also trying different figures but it makes no difference. Same error and back to VESA. Any help or thoughts you can provide would be greatly appreciated. As for Ubuntu, I am loving it; it has really made the VAIO-P come alive after being tied down under Vista to a grunting, hard to use piece of kit. Thank you in advance, Gareth
_stalker_ wrote on 2009-07-19 20:16:
hi guys, I finally managed to compile the psb kernel modules against a 2.6.29 kernel. I also copied the firmware to /lib/firmware (looking at the kernel's logs, it seems the psb kernel mod needs it at probe time). anyway, nothing exciting, because as soon as I modprobe the psb kern mod (I actually probe the customized drm, then psb), my console (and my X) display gets screwy. everything is condensed and repeated 3 times... nothing usable. I even tried with the more up-to-date version from the Ubuntu Mobile team (4.41.1). exact same stuff it seems someone posted something similar up in the thread. did anyone fix that issue?
pabr wrote on 2009-07-22 10:08:
For what it's worth, I now have psb running with linux-2.6.30.2 and FC10 on the Vaio P. Earlier attempts with linux-2.6.29 failed with mysterious OOM errors. This time I used sources from psb-kernel-source_4.41.1-0ubuntu1~904um1_all.deb, with straightforward fixes. But Xorg still hangs after a few hours: The display freezes (except the mouse pointer) and Xorg.0.log says "[mi] EQ overflowing. The server is probably stuck in an infinite loop".
stomic wrote on 2009-07-22 20:57:
While trying to load psb.ko on Fedora 11 runing on IB888 Atom SBC I get a following error: [drm:psb_do_init] *ERROR* Gatt must be 256M aligned. This is a bug. Same thing with gentoo and same drivers built from source. If I comment out this check in source code, module loads successfully but board locks-up when starting X. Does anybody know how to solve this issue?
_stalker_ wrote on 2009-07-23 02:20:
thanks pabr I'll upgrade to 2.6.30-r2 and try to stick to what you've done. thx
pabr wrote on 2009-07-30 16:03:
Good news maybe ? With "modprobe psb no_fb=1 ignore_acpi=1", Xorg does not freeze anymore. On the other hand, I occasionally get kernel panics (keyboard leds flashing) while waking up from standby.