• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

Configuring Linux to work with 2 graphics devices

I own a Sony Vaio SZ notebook, which includes both an integrated Intel 945 graphics chipset as well as a GeForce 7400 chipset (which can be switched when the computer is turned off in order to choose between better battery life or better performance).

I have Ubuntu 7.04 installed, which was originally installed when I was using the Intel chipset. When later I switched to the Nvidia chipset, X crashed upon start. I then installed the Nvidia driver manually using the command line, and X started perfectly running at top performance.

The problem is that I am now unable to revert back to Intel when I want battery life. So I want to know if there is a simple way of switching between these devices easily, or, better yet, have Ubuntu automatically detect which graphics device is reconfire X accordingly upon boot? Under Windows Vista (preloaded with the notebook), this works wonderfully.

Thanks.
0
gsaito
Asked:
gsaito
  • 3
  • 3
1 Solution
 
nedvisCommented:
..."So I want to know if there is a simple way of switching between these devices easily..."
There is a way of dong that , but is it easy for you , it all depends on your willingness to issue
couple shell commands.
Scenario:
Backup your current /etc/X11/xorg.config file ---->  sudo mv   /etc/X11/xorg.conf   /etc/X11/xorg.nvidia
Then restart laptop with Intel graphic chipset enabled and let Ubuntu re-detect video card and create new xorg.conf  file with settings pertaining to Intel 945 video chipset. Most likely there is already a good one for
Intel 945 video device if nVIDIA video driver installed made backup of previous xorg.conf. It would then be renamed to xorg.bak ( or eventually xorg.old )
Now backup xorg configuration file for Intel video ---> sudo mv /etc/X11/xorg.conf  /etc/X11/xorg.intel
As you may have realised by now you have now two valid xorg.conf file: one for your nVidia and one for Intel 945  video card.
So, for example if you're running Ubuntu session with Intel945 in charge of your current video/display settings
and you want to restart your laptop with nVIDIA video driver enabled simply issue command:
sudo cp /etc/X11/xorg.nvidia  /etc/X11/xorg.conf
to overwrite Intel 945 video configuration file .
Next time you reboot laptop you'll have nVIDIA video driver taking care of your display.
Same way, if you want to reboot laptop with Intel 945 video chipset enabled type similar command:
sudo cp /etc/X11/xorg.intel  /etc/X11/xorg.conf
reboot and Intel graphic driver will load for that session.
Simple?!?
=====================================================================================
Whole procedure could be simplifed and enhanced with other commands you may wish to include in
bash script made for that purpose but I'm not really very good at bash shell scripting .
For instance you can create bash script to check which video driver kernel module is currently loaded
so you'll know exactly which of two commands I gave you  to run before rebooting laptop in order to load correct
video driver.
=====================================================================================
   
 
0
 
gsaitoAuthor Commented:
Thanks a lot nedvis. This solution worked 99%, but the remaining 1% is what is annoying me... by the way, I am now using Ubuntu 7.10.

I actually had originally installed Ubuntu with the Intel integrated chipset running. So I made the backup of
 the xorg.conf file to xorg.conf.intel.

Then I switched to the NVIDIA chipset and rebooted. X would not start, and Ubuntu would not redetect the hardware, so I was left with a command line screen. I then installed the NVIDIA drivers from NVIDIA's website and then I was able to run X/Gnome perfectly.

The problem happened when I tried to switch back to my integrated Intel chipset. I backed up xorg.conf to xorg.conf.nvidia and copied xorg.conf.intel back to xorg.conf, then I rebooted. X/Gnome would load just fine, *but* compiz refuses to work now, although it would work perfectly before.

So Gnome loads the 'classic' desktop (ie, no desktop effects). When I go to System -> Preferences -> Appearance -> Visual Effects and try to turn it on, I simply receive the message that "Desktop Effects could not be enabled". I'm puzzled because I am using the exact same xorg.conf file I had before installing the NVIDIA drivers, and desktop effects used to work just fine then.

Any ideas?
0
 
gsaitoAuthor Commented:
I just realized this may be trickier than originally thought. Since my Intel configuration was now 'defective', I tried switching back to NVIDIA by copying xorg.conf.nvidia back to xorg.conf and rebooting. Much to my surprise, X would not load and reported several lines of errors. I had to run the NVIDIA driver installation utility (the one we download from NVIDIA's website) to get it running again... Maybe some other files that xorg.conf references are getting modified in the process of installing a new driver, therefore only switching xorg.conf files is apparently not sufficient.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
nedvisCommented:
This is certainly problem related to the way Linux is loading video drivers.
Basically , there are two different ways of how's kernel handling devices
a- via in-line device drivers ( integrated in kernel )
or
b- modular device drivers ( device kernel modules loaded on demand )
================================================================
The Ubuntu typical kernel has some drivers compile as part of kernel ( In case of Intel 945
most likely in-line device driver) .
Only device drivers compiled in-line are available to the kernel during the boot process:
modular drivrs are only available after the system has been booted.
================================================================

My advice would be to go and download Ubuntu 7.10
kernel SOURCES package ( new version you're running right now) and compile NEW kernel patched with nVIDIA modular device driver in separate directory , while leaving olde kernel -that works with Intel945- so you'll have actually
 TWO DIFFERENT KERNELS you can boot your laptop into:
one for Intel 945
one for nVIDIA
GRUB boot loader menu would take care of that at system startup where you would select from GRUB menu what kernel to boot: either Inter945 or nVIDIA patched kernel.
I'm doing same thing with my Debian Etch PC where I have one "generic" kernel and one
which will call nVIDIA kernel module during system boot process.
===============================================================

0
 
gsaitoAuthor Commented:
Thank you nedvis. I have not yet tried it but it looks to be the solution. I will try it later and report back.
0
 
nedvisCommented:
Thank you for the points, gsaito
In meantime you might wish to read those couple links to get an idea on how to install and
handle system with two different kernels :
============================unofficial====================================
http://ubuntuforums.org/showthread.php?t=121816
http://ubuntuforums.org/archive/index.php/t-423254.html
============================ official======================================
https://help.ubuntu.com/6.10/ubuntu/installation-guide/i386/kernel-baking.html
=======================================================================
0
 
xmxspencerCommented:
It may be an old question, but being that a lot of people are still using their vaio sz notebooks (sz370 here) thought I'd post my solution from back in May '07 when I got it running seamlessly. Check my original post on the matter in the Ubuntu forums here to get the full list of links and scripts.

Basically just create 2 xorg.conf files (one for each card) and put a script in /etc/rc2.d to load the necessary xorg.conf based on which card you have selected.

Additionally, assuming you use 3D acceleration, you're going to want to have the script swap out the appropriate libGL files (nvidia and mesa) in /usr/lib as necessary for the selected card. It's easiest to do this by creating symlinks to the required files, so you can just change the symlinks instead of the scripts later on when updating drivers.

It's full auto-detection and has been working great for me the last couple years (including in 8.04 Hardy Heron)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now