Note: The details below have only been tested on the VGN-Z series, and may not apply to the newer VPC-Z hardware
A Brief History Lesson
There have been many issues getting Linux to work with the hybrid graphics being embedded in a number of modern laptops containing nVidia GPUs. The primary issue is being able to switch between the low- and high-power display adapters. Previously, it was possible to achieve ‘cold-switching’ in Linux (allowing a switch of display adapters by changing the position of the hardware switch, and rebooting) by disabling the Vista compatibility reported via ACPI using the kernel boot flag:
acpi_osi="!Windows 2006"
This exploited the BIOS behaviour designed to work with Windows XP, which does not support hot-switching of display adapters. The details have been extensively documented elsewhere, so I won’t go into too much detail here – there is a moderately thorough capture of the data at the Sony VAIO Z-series Launchpad group, with more discussion in the mailing lists of ongoing progress.
With the availability of Windows 7, however, a BIOS update was required to modify the DSDT tables to support the new calls that Windows 7 would use to manage the hot switching of display adapters in these hybrid systems. An unfortunate side-effect of these updates was that Windows XP was no longer supported, and the methods required to retrieve EDID data from the internal LVDS display were moved from the GPU to the BIOS for the high-power nVidia card.
The result is that booting Linux with the high-powered nVidia card enabled results in pretty vertical lines, or multiplied fragments of the intended output during boot, as the LVDS display is fed junk. Once X starts, and the nVidia drivers kick in, the LVDS display goes completely blank, as no EDID negotiation can occur. An external display will work fine, but obviously this is not ideal in a laptop.
The State of Play (nVidia support)
The binary driver blob from nVidia has always been a source of contention in the open source community, due to their persistence in keeping the driver entirely closed-source, and the kernel-taint resulting from this, despite the fact that all other major display adapter manufacturers have now released specs, and open-sourced their drivers. That said, nVidia have been the go-to chipset for accelerated 3D graphics on Linux for quite some time now, but with many current nVidia-powered laptops being all but unusable with the current state of support from the binary blob, the decision is far less clear-cut, with unsupported parts being entirely useless.
The behaviour displayed by Windows 7 compatible BIOSes in (at least nVidia-based) hybrid GPU laptops is also present for some of nVidia’s standard parts, at least the G210m, and I believe a couple of other similar parts. The nouveau project have apparently made some progress in allowing the EDID data to be retrieved, however this requires kernel modification, since there is no mechanism currently for communicating this information from the BIOS… and of course the nouveau project currently doesn’t support any 3D acceleration, which is really the point here. There has been some significant lag in supporting these parts from nVidia, with drivers purporting to support them, then having support stripped in subsequent releases as the problems were identified, though it appears that support is on the way in a near-future driver release UPDATE1/UPDATE2.
Making Things Work Now
Whilst it looks like we may get real support in the moderately near future, we want things to work in the mean time. Some enterprising fellows in the nVidia forums have discerned the method for retrieving and providing the missing EDID data to the X driver, by way of Windows. Obviously this is not ideal, and may not be an option for some, but for the rest, here’s the how. This information is based solely on the Sony VAIO Z series laptops, since that’s what I have access to, but it may be relevant to laptops from other manufacturers that employ similar graphics setups.
First, you’ll want to modify your kernel boot string by removing the acpi_osi flag if you’ve been using it, and if you want to be able to see anything whilst booting, you’ll also need to remove the splash parameter, and add the following (See UPDATE for details on recent drivers):
nomodeset
This will stop the VESA driver from trying to switch to a mode that we can’t support until the nVidia driver kicks in. Also note that once the nVidia driver is initialized, you’ll lose the ability to display VTs – they’ll just show a blank screen, same for the shutdown sequence.
If you’re using the sony-laptop module modified by Eva and Norbert, and as installed by the sony-VGN-Zseries-janitor script, you’ll need to make sure the kernel is loaded with speed_stamina=3, which can be done by placing the following in a file in /etc/modprobe.d/
options sony-laptop speed_stamina=3
Next, the BIOS will need to be updated to a recent revision that contains Windows 7 support. The BIOSes of the various Z-series revisions are interchangeable, so I used the R5031M3 release, which you can download from your local Sony Support site. To make this work as we want it to, however, the BIOS needs to be modified to enable the Advanced section, allowing us to change the mode of the hardware graphics switch. Whilst the os_acpi option will likely still work, this results in garbled graphics following a reboot, making it impossible to access the BIOS, or view boot menus.
To modify the BIOS, a specially crafted EFI boot disk is required, however in all BIOS releases supporting Windows 7, EFI booting from external devices has been disabled. The only method for booting from external EFI media is to disconnect both the HDD and optical drive, however most people are probably reluctant to go to these lengths, particularly considering how difficult and convoluted it is to remove the keyboard to gain access these components. If this is you, some googling will yield pre-patched BIOSes for download. For those who like a challenge, the process for patching the BIOS is described here.
Once you’ve got your Windows 7 BIOS installed, reboot and enter the BIOS configuration by pressing F2 when the VAIO logo is displayed. You’ll notice a slew of new options under the Advanced section, so feel free to tweak a few things (enabling the VT-d option, for example), but be aware that you may seriously impair the functionality of your system by messing too much in here. The option we’re looking for is VGA Switching Policy. Set this to Static, noting that this will disable hot-switching in Windows, whilst enabling cold-switching for all OS’s
Now, flick the graphics hardware switch over to Speed and boot back into Windows. You’ll need to dump the EDID data from the LVDS display, for this I used a free program called softMCSS, available for download here. Export the data for your monitor, and put this somewhere you can access it easily from your linux install, then flip the hardware switch back over to Stamina, and reboot into Linux. Place the EDID dump somewhere sensible (I placed mine in /etc/X11/), and then edit your xorg.conf to look similar to this (if you’re using the sony-VGN-Zseries-janitor scripts, make sure you edit the config relating to the nVidia card):
Section "Module" Load "glx" EndSection Section "ServerFlags" Option "Xinerama" "0" EndSection Section "Monitor" # HorizSync source: edid, VertRefresh source: edid Identifier "Monitor0" VendorName "Unknown" ModelName "Nvidia Default Flat Panel" HorizSync 29.0 - 55.0 VertRefresh 0.0 - 61.0 Option "DPMS" EndSection Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce 9300M GS" Option "ConnectedMonitor" "DFP-0" Option "CustomEDID" "DFP-0:/etc/X11/SNY06FA.bin" Option "NoLogo" "True" Option "OnDemandVBlankInterrupts" "True" EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Depth 24 EndSubSection EndSection
The highlighted lines are the key, with ConnectedMonitor telling the driver to expect a display on the internal connection, and CustomEDID providing the data it needs to communicate with it successfully (See UPDATE for details on recent drivers).
Success!! Sort of…
At this point, you can flick the hardware switch back to Speed, reboot and enjoy the nVidia goodness, however there are some caveats. Multiple monitor setups will not function properly at all, and when they do, they’re a pain. Because we’ve had to use ConnectedMonitor to force the internal display to be attached, X won’t see any additional displays unless it’s explicitly told about them, so if you want multiple monitors to work, you’ll need to use an Xorg config similar to the following, assuming it’s connected via HDMI (See UPDATE for details on recent drivers):
Section "Module" Load "glx" EndSection Section "ServerFlags" Option "Xinerama" "0" EndSection Section "Monitor" # HorizSync source: edid, VertRefresh source: edid Identifier "Monitor0" VendorName "Unknown" ModelName "Nvidia Default Flat Panel" HorizSync 29.0 - 55.0 VertRefresh 0.0 - 61.0 Option "DPMS" EndSection Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce 9300M GS" Option "ConnectedMonitor" "DFP-0, DFP-2" Option "CustomEDID" "DFP-0:/etc/X11/SNY06FA.bin" Option "NoLogo" "True" Option "OnDemandVBlankInterrupts" "True" EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 Option "TwinView" "1" Option "TwinViewXineramaInfoOrder" "DFP-2" Option "metamodes" "DFP-0: nvidia-auto-select +0+0, DFP-2: nvidia-auto-select +1600+0" SubSection "Display" Depth 24 EndSubSection EndSection
The problem here is that we’ve told the driver that we have two monitors connected all the time, when this is likely not to be the case. This means that you’ll have a phantom 640×480 monitor when you don’t have an external display connected. You can work around this using Disper, and executing `disper -s` to disable the external display when it’s not connected, possibly you’d want to run this as a login task if you don’t mind the flicker. To extend your desktop onto the external display when it’s attached, just use `disper -e`, and see the Disper documentation for more options.
And that’s pretty much that, until we get some love from nVidia. The configs and the EDID dump from my VGN-Z17GN/B are available in the downloads.
Thx u very mch for your guide.
Now i can appiled your guide to force 1600×900 with intel GMAX4500 Snow Leopard on VaioZ
That’s excellent, I hadn’t thought of using the hard switch to help with the Hackintosh issues, cheers!
did you get leopard working on vaio z? can you please tell me how?
This was very helpful indeed. I have a VAIO Z93FS,
running fine with the Intel driver, but so far could not get
the NVidia driver to drive the screen.
However, I could not find a patched R5031M3 BIOS — that’s
the version I have on the machine. Any chance you would be
willing to share yours?
Thanks in any case!
Bernard
I didn’t want to link to it, since Sony are probably not happy with people redistributing a modified BIOS, but try http://forum.notebookreview.com/showpost.php?p=5653933&postcount=69
Thanks! As it turned out, it was not needed. I kept the R5031M3 orig. BIOS, but edited the xorg.conf as you showed, using the SNY06FA.bin (same as yours).
Now Intel, X11 NV, and proprietary Nvidia drivers all work, switch is smooth. (I did not use “nomodeset”, but did remove “splash” from the grub default.) boot and initial login consoles are fine under any of these, and remain so under X with Intel driver, but are blank (although responsive) with Nvidia driver. BTW, glxgears score for nv and intel drivers is ~2400fps, but with nvidia driver it is ~24000fps, 10x larger!
I run Lucid Lynx server distro, 2.6.32.9 kernel, sony-laptop-zseries-0.9np5 module, your xorg modifs, my acpi command modifs (for brightness), nvidia 195.36.08 driver.
Machine has T9900 cpu, 1066MHz bus, 8GB mem, 512GB SATA drive.
Everything works (I got it w/o fingerprint reader), except of course the memory stick; battery life with WiFi on is 4.5hrs with small battery, 6.5-7hrs with large one, using Intel graphics; about 0.6 of that with Nvidia.
Now if I could only figure out how to switch intel/nvidia on the fly, I’d connect that to the S1/S2 buttons and would have the perfect laptop
Are you saying you can dual-boot Win7 and Linux without the BIOS hard mode switch, or do I assume that you’re only running Linux in this configuration?
Thanks – I got a lot of info out of this.
But I am stuck at the point when to install the nvidia driver.
To install nvidia drivers i need to switch off xserver – ok.
However, then I am left without display and I have no clue how to install the driver blind like “sudo sh …. .run”
I am a new to linux but I want to give my Z540 a try – so any help is appreciated.
You don’t need to switch off the X server to install the drivers… you should be able to do everything from the GUI – to execute the commands, simply open Applications -> Accessories -> Terminal
Would be pretty awesome if you could drive two external monitors… once using Nvidia and one using Intel.
Unfortunately they’re both hardwired to the same outputs, so I don’t see this being possible, but since you can run multiple displays per card, what would be the advantage?
I thought that the HDMI output was wired directly to the Nvidia chip, but the VGA output was on a switch – so it might be possible to use Intel for the internal LCD and VGA out, and Nvidia for HDMI.
Simon
I think it’s a little more complicated than that, and I still don’t see any advantage, since the nVidia card can drive enough res on both outputs.
I am slightly confused… does this entire post apply to the new vpc-z11 ’s as well? I think that’s one of the most confusing things about all of the help currently online about getting the sony z’s to boot linux, is they all seem to apply to the old models and I have no idea what needs to be done differently for my z11…
Unfortunately I only have access to the VGN series – the information currently available is pretty much all based on that series, and took quite a lot of effort to compile. Some of it will still apply to the VPC, but they’re too new at this stage for much knowledge to have accumulated.
You can avoid Windows and softMCSS by using this Linux program:
read-edid – hardware information-gathering tool for VESA PnP monitors
The problem is that the EDID data is not retrievable for the nVidia card, otherwise specifying it would be moot. Have you attempted this on one of the affected machines?
I have Sony Vaio Z (VPCZ11C5E) and here (http://goo.gl/UZQ8) I explain how I resolved (thanks to another people too) this problem
)
Yeah, Nouveau can work, but has no 3D (not counting LLVM/Gallium3D, since that’s not hardware). I’d be interested to hear if the nVidia binary blob works with that kernel and without a patched BIOS, if you give it a CustomEDID? If you try, make sure it’s with < 260.19.x, as detailed here