Page 1 of 1

[MAQeia] Hybrid graphics

PostPosted: Jan 14th, '12, 16:20
by isadora
This post provides the MAQeia (Most Asked Questions) for Hybrid Graphics.
If you have suggestions or if you find a mistake please post your
suggestions here in the thread.

Following are contributions by blosomax explaining steps to follow configuring
hybrid graphics through bumblebee.

First part of this MAQeia describes a workaround to get hybrid graphics
configured, the second part is dedicated to "powersave"

Part1:
viewtopic.php?f=10&t=241#p9469
Posted by blosomax » 20 Oct 2011 02:54

Granted by blosomax to use for
Maqeia
....for which we are mostly grateful!!!!

I have bumblebee working on my mageia 1 installation.
NB: bumblebee is an nvidia-optimus controller for linux, allowing you to run
apps on your nvidia card, instead of the intell one. see
https://github.com/Bumblebee-Project
NOTE THIS WILL DISABLE YOUR 3D EFFECTS FOR YOUR INTEL CARD.
To re-enable 3d on the intel card, use Mageia Control Center Choose: Hardware ->
Set up the graphical server, which will break the nvidia 3d.

Steps (thanks to bumblebee team, and Jaron Vietor who posted this
http://forum.mandriva.com/en/viewtopic.php?f=35&t=135018#p850742 on
the mandriva forums)
NB: You will need;
- to be able to edit files as root user
- to install git (details below, you may skip this if you know how to install
bumblebee without it)
- to install virtualGL (details below)

Notes on code (below) (Read this only if your not used to using terminal or
konsole)
- All non gui code is bash script used in a linux terminal like konsole.
- To open a terminal: Find "konsole" in your applications launcher
- To run commands as root user type: su [enter], and enter you root password.
(to leave root user mode type: exit [enter].
- Code here can then be simply copied and pasted into your terminal

-0: Backup your working xorg.conf file
- As root:
Code: Select all
cp /etc/X11/xorg.conf /etc/X11/xorg.conf.intel


-1: Install the nvidia drivers using the mageia configuration tool. (You may
need to setup you Mageia repositories)
- Open: Mageia Control Center
- Choose: Hardware -> Set up the graphical server
- Click: Graphic Card and select Nvidia -> GeForce model [GeForce 400 series
and later, or GeForce 6100 to GeForce 360]
- You should get a "There is a proprietary driver availabe... Do you wish to
use it?" Select Yes
- Allow Mageia to install all the drivers, and select ok to the settings
screen.
- DO NOT TEST!
- Select Quit, and Yes to "Keep the changes?"

!!! Do NOT restart your computer !!!
-2: Disable nvidia driver (it will not work at this stage)
- Copy the new xorg.conf file and save as xorg.conf.nvidia
As root:
Code: Select all
mv /etc/X11/xorg.conf /etc/X11/xorg.conf.nvidia

- Copy old conf back as main
As root:
Code: Select all
cp /etc/X11/xorg.conf.old /etc/X11/xorg.conf


RESTART YOUR COMPUTER


-3 Install virtualgl
- Download virtual: http://www.virtualgl.org I used
http://sourceforge.net/projects/virtualgl/files/VirtualGL/2.2.1/ and
chose VirtualGL-2.2.1.x86_64.rpm
- Install. Double-click downloaded rpm

-4: Install git (You may need to setup you Mageia repositories)
(you may skip this if you know how to install bumblebee without it)
- As root:
Code: Select all
urpmi git


-5 Install bumblebee using git
- As root:
Code: Select all
git clone
git://github.com/Bumblebee-Project/Bumblebee.git

This should create a Bumblebee folder in your current directory, before we
install we need to make some modifications to the install file.
- Edit Bumblebee/install, and comment out lines like the following ( As
bumblebee does not know of our distro.)
Code: Select all
   
  #install_step determinedistro    "" "precheck build install postconfig"
  #install_step "$DISTRO/setvars"  "" "precheck build install postconfig"
  #install_step "$DISTRO/checkdependencies" "Checking dependencies" precheck
  #install_step "$DISTRO/configure" "" postconfig

- Install As root:
Code: Select all
cd Bumblebee;./install

- Add users to the bumblebee group.
As root:
Code: Select all
usermod -a -G bumblebee YOURUSERNAME


-6 Modify bumblebee.conf
NB: Replace "lib64" with just "lib" if you are using a 32 bit OS
- As root edit /etc/bumblebee/bumblebee.conf, and add to the bottom
# My args
LD_LIBRARY_PATH="/usr/lib64/nvidia-current"
X_DAEMON="/etc/X11/X"
X_LD_LIBRARY_PATH="/usr/lib64/xorg"

EG As root:
Code: Select all
echo "# My args" >> /etc/bumblebee/bumblebee.conf
echo "LD_LIBRARY_PATH=\"/usr/lib64/nvidia-current\"" >>
/etc/bumblebee/bumblebee.conf
echo "X_DAEMON=\"/etc/X11/X\"" >> /etc/bumblebee/bumblebee.conf
echo "X_LD_LIBRARY_PATH=\"/usr/lib64/xorg\"" >> /etc/bumblebee/bumblebee.conf


-6 Modify the xorg.conf.nvidia in /etc/bumblebee directory
NB: If your unsure of the busid for your nvidia card try
Code: Select all
lspci -d 10de: -n
| grep '030[02]:' | cut -d' ' -f1

NB: The busid will probably be "01:00:0"

- Modify /etc/bumblebee/xorg.conf.nvidia:
Add: BusID "01:00:0", and Option "AddARGBGLXVisuals", to device section.
Remove: The whole files section
So /etc/bumblebee/xorg.conf.nvidia should look like
Code: Select all
Section "ServerLayout"
    Identifier "Layout0"
    Option "AutoAddDevices" "false"
EndSection

Section "Device"
    Identifier "Device1"
    Driver "nvidia"
    VendorName "NVIDIA Corporation"
    BusID "01:00:0"
    Option "NoLogo" "true"
    Option "UseEDID" "false"
    Option "ConnectedMonitor" "DFP"
    Option "AddARGBGLXVisuals"
EndSection


-7 Test:
- Open 2 terminals, 1 as root and 1 as your normal user.
- In the root terminal, start the bumblebee service:
Code: Select all
bumblebee
-d

- In the user terminal test an app:
Code: Select all
optirun kwrite

- The root terminal should show the output of starting the nvidia xorg conf,
and kwrite should launch from the user terminal.
- Press cntrl-c to kill the bumblebee service in the root terminal.
- To start bumblebee in the normal way as a
service:
Code: Select all
/etc/init.d/bumblebee start

- To start at boot use the Mageia drakxservices tool. Mageia Control Center
-> System -> Manage System services by ena ...

-8 To det the intel glx drivers working again (which will break the nvidia 3d
drivers)
- Open: Mageia Control Center
- Choose: Hardware -> Set up the graphical server
- Choose:All the default options Mageia gives
- Select Quit, and Yes to "Keep the changes?", REBOOT

-8 To det the intel nvidia drivers working again (which will break the intel
drivers)
Redo steps 1 & 2

Maybe someone could post how to use Section "path" in the nvidia xorg.conf so
bumblebee can load the nvidia 3d drivers/modules?


Part2:
viewtopic.php?f=10&t=241#p9599
Posted by blosomax » 25 Oct 2011 05:27
Powersave: How to turn off the nvidia card to save power, using acpi_call.
Note: The above bumblebee installation does not turn off the nvidia card when
it's not being used which can use up a lot of power just sitting there doing
nothing, I got switching the card on and off working in the following way.
WARNING: Turning the card off means you will need to restart before bumblebee
optirun can work again.

Steps (see, and thanks to, the team at
http://linux-hybrid-graphics.blogspot.com/)
NB: You will need;
- to be able to edit files as root user
- to install git (details below, you may skip this if you know how to install
acpi_call without it)

Notes on code (Read this only if your not used to using terminal or konsole)
- All non gui code is bash script used in a linux terminal like konsole.
- To open a terminal: Find "konsole" in your applications launcher
- To run commands as root user type: su [enter], and enter you root password.
(to leave root user mode type: exit [enter].
- Code here can then be simply copied and pasted into your terminal

-1 Install git. (If you haven't already)
As Root
Code: Select all
urpmi git


-2 Install acpi_call
As Root
Code: Select all
git clone https://github.com/mkottman/acpi_call.git
cd acpi_call
make
insmod acpi_call.ko


-3 Find your machines parameters
As Root
Code: Select all
chmod +x test_off.sh
./test_off.sh

You should get a list of tries like this
Trying \_SB.PCI0.P0P1.VGA._OFF: failed
Trying \_SB.PCI0.P0P2.VGA._OFF: failed
Trying \_SB_.PCI0.OVGA.ATPX: failed
Trying \_SB_.PCI0.OVGA.XTPX: failed
Trying \_SB.PCI0.P0P3.PEGP._OFF: failed
Trying \_SB.PCI0.P0P2.PEGP._OFF: failed
Trying \_SB.PCI0.P0P1.PEGP._OFF: failed
Trying \_SB.PCI0.MXR0.MXM0._OFF: failed
Trying \_SB.PCI0.PEG1.GFX0._OFF: failed
Trying \_SB.PCI0.PEG0.GFX0.DOF: failed
Trying \_SB.PCI0.PEG1.GFX0.DOF: failed
Trying \_SB.PCI0.PEG0.PEGP._OFF: failed
Trying \_SB.PCI0.XVR0.Z01I.DGOF: failed
Trying \_SB.PCI0.PEGR.GFX0._OFF: works!

The line that ends with "works!" is the one you want.
Using the example above I can now;
-turn the nvidia card off
As root
Code: Select all
echo '\_SB.PCI0.PEGR.GFX0._OFF' > /proc/acpi/call

-turn the nvidia card on
As root
Code: Select all
echo '\_SB.PCI0.PEGR.GFX0._ON' > /proc/acpi/call


-4 testing
Unplug the power and look at your battery power availabe.
Code: Select all
acpi

Repeat turning your nvidia card off and on
As Root
Code: Select all
acpi
echo '\_SB.PCI0.PEGR.GFX0._OFF' > /proc/acpi/call
sleep 3; acpi
echo '\_SB.PCI0.PEGR.GFX0._ON' > /proc/acpi/call
sleep 3;acpi

You should see a difference in battery life of 1-3 hours. The "sleep 3" is to
give the system time to update the battery drain, and useage.

-5 (Optional) Create your own powersaving script
Below is my script example, copy into a file called powersave_custom
Code: Select all
#!/bin/bash

USEAGE="useage: ${0##*/} [stop,start]
help:   Turns off/on custom power saving
requrs: /etc/acpi/call/acpi_call.ko
Note:   Root users only
"

# Check user is root
if [ "$(whoami)" != "root" ]
then
  echo -e "${USEAGE}" > /dev/stderr
  exit 0
fi

# Check acpi_call module is loaded
if ! lsmod | grep -q acpi_call
then
  # Check module exists
  if [ ! -e "/etc/acpi/call/acpi_call.ko" ]
  then
    echo -e "${USEAGE}" > /dev/stderr
    exit 0
  else
    # Install acpi_call module
    insmod /etc/acpi/call/acpi_call.ko
  fi
fi

# Show battery useage before
echo "Before switch `acpi`"

if  echo "${1}" | grep -qEi "start"
then

  ##############################################################
  # HERE you can put whatever code you want to run to save power
  ##############################################################
  /etc/init.d/wine stop > /dev/null 2>&1
  /etc/init.d/bumblebee stop > /dev/null 2>&1
  echo '\_SB.PCI0.PEGR.GFX0._OFF' > /proc/acpi/call

elif echo "${1}" | grep -qEi "stop"
then

  ##############################################################
  # HERE you can put whatever code you want to run for full power
  ##############################################################
  /etc/init.d/wine start > /dev/null 2>&1
  /etc/init.d/bumblebee start > /dev/null 2>&1
  echo '\_SB.PCI0.PEGR.GFX0._ON' > /proc/acpi/call

else
  echo -e "${USEAGE}"
  exit 1
fi

# Wait a few seconds for power usage to update
sleep 3
# Show battery useage before
echo "After switch `acpi`"


As Root
Code: Select all
cd ..
mv acpi_call/ /etc/acpi/call
cp powersave_custom /usr/sbin/powersave_custom
chmod +x /usr/sbin/powersave_custom

To run As Root
Code: Select all
powersave_custom start
powersave_custom stop

NB: You may want to put this script in your "Power Management Profiles"
"Run Script" -> powersave_custom start

Re: [MAQeia] Hybrid graphics

PostPosted: May 21st, '12, 00:22
by lagtw
Bumblebee should simply be added to the repos like it is in Mandriva. It would make the process of installation a ton easier and most laptops come with optimus on them now, so it's not a minor problem and should not be treated as such.

Please, please, please add bumblebee to the repositories in Mageia 2. This is the only thing stopping me from migrating.

Re: [MAQeia] Hybrid graphics

PostPosted: Jun 8th, '12, 07:19
by vulix
Part 1 of these steps no longer seems to work, tried them today

Re: [MAQeia] Hybrid graphics

PostPosted: Dec 26th, '12, 19:27
by c0legota
Hi!

Bumblebee packages are available at (non-official spanish) Blogdrake repositories here
http://blogdrake.net/blog/drakedalfa/bl ... ftp-x86_64

But in my case I'd like to use only Nvidia driver/card. When I configure nvidia driver, both nouveau or propietary, at reboot system stops without finish with this message:

Code: Select all
Failed to start Wait for Plymouth Boot Screen to Quit
See 'systemctl status plymouth-quit-wait. service' for details


I think while xserver get configured for nvidia, system it's starting for Intel card but not sure.

Did open this thread some days ago
viewtopic.php?f=23&t=4073
but no answer. Did search a lot the forum looking for solution but did'nt found nothing.

It's not possible to use just Nvidia card on hybrid systems?

Regards,
Colegota