Difference between revisions of "En/virtualbox 3d acceleration"

From Studiosg
Jump to navigationJump to search
(Added SEO tags and templates and updated links)
Line 1: Line 1:
Welcome to Simone Giustetti's wiki pages.
+
{{header_en|title=StudioSG - Virtualbox 3-D graphic acceleration| keyword={{Template:Keyword_en_virtualbox}}| description=How-to enable 3-D graphic acceleration for a Virtualbox virtual machine running Slackware Linux | link_page=virtualbox_3d_acceleration}}
 
 
 
 
Languages: '''English''' - [http://www.giustetti.net/wiki/index.php?title=Virtualbox_3d_acceleration Italiano]
 
 
 
----
 
 
 
  
 
== Virtualbox 3-D Acceleration ==
 
== Virtualbox 3-D Acceleration ==
 
  
 
In this article I will show how to enable 3-D graphic acceleration for a virtual machine running a Slackware Linux system.
 
In this article I will show how to enable 3-D graphic acceleration for a virtual machine running a Slackware Linux system.
  
  

Virtualbox is a virtualization product: a software which can "emulate" machines and run Operating Systems and programs on them with near native performances. 3-D acceleration is one among the many features offered by Virtualbox; a feature included with release 2.x of the software.
+
Virtualbox is a virtualization product: a software which can "emulate" machines and run Operating Systems and programs on them with near native performances. 3-D acceleration is one among the many features offered by Virtualbox; a feature included with release 2.x of the software.
 
Given a Host system with '''3-D capable hardware''', a correctly configured virtual guest system can use 3-D graphic acceleration.
 
Given a Host system with '''3-D capable hardware''', a correctly configured virtual guest system can use 3-D graphic acceleration.
  
Line 19: Line 12:
 
   http://www.virtualbox.org/wiki/Downloads
 
   http://www.virtualbox.org/wiki/Downloads
  

Let's suppose Virtualbox was correctly installed on the host system, that a virtual Linux machine was configured and that later a release 13.1 Slackware Linux operating system was installed on that guest virtual machine. Three operations have to be executed in order to enable 3-D acceleration:
 
  
 +
Let's suppose Virtualbox was correctly installed on the host system, that a virtual Linux machine was configured and that later a release 13.1 Slackware Linux operating system was installed on that guest virtual machine. Three operations have to be executed in order to enable 3-D acceleration:
  
== Enable 3-D acceleration functionality for the guest system ==
+
 
 +
== Enable 3-D Acceleration Functionality for the Guest System ==
  
 
Open the Virtualbox console and select the desired machine. Open the option window by right clicking the mouse on the Settings button. A new mask will open. Select the Display tab then check option "Enable 3D Acceleration".
 
Open the Virtualbox console and select the desired machine. Open the option window by right clicking the mouse on the Settings button. A new mask will open. Select the Display tab then check option "Enable 3D Acceleration".
Line 29: Line 23:
 
== Guest Addin Installation ==
 
== Guest Addin Installation ==
  
Start the virtual machine. Open men<nowiki>&ugrave;</nowiki> Devices and select option Devices->CD/DVD Devices->VboxGuestAdditions.iso.
+
Start the virtual machine. Open men&ugrave; Devices and select option Devices->CD/DVD Devices->VboxGuestAdditions.iso.
 
Login as root to the guest system and mount the cdrom by running the command:
 
Login as root to the guest system and mount the cdrom by running the command:
   root@darkstar04:~# mount /mnt/cdrom
+
   '''mount''' /mnt/cdrom
  
 
Move to the /mnt/cdrom directory. The command ls -la should return a list of binary files:
 
Move to the /mnt/cdrom directory. The command ls -la should return a list of binary files:
   root@darkstar04:~# ls -la /mnt/cdrom/
+
   '''ls''' ''-la'' /mnt/cdrom/
 
   total 30226
 
   total 30226
 
   dr-xr-xr-x  4 root root    2048 2010-06-08 13:19 .
 
   dr-xr-xr-x  4 root root    2048 2010-06-08 13:19 .
Line 50: Line 44:
  
 
Run the package designed for the architecture of your virtual machine. VBoxLinuxAdditions-x86.run for 32 bit virtual machines and VBoxLinuxAdditions-x86.run for 64 bit ones.
 
Run the package designed for the architecture of your virtual machine. VBoxLinuxAdditions-x86.run for 32 bit virtual machines and VBoxLinuxAdditions-x86.run for 64 bit ones.
   root@darkstar04:~# bash ./VBoxLinuxAdditions-x86.run
+
   '''bash''' ./VBoxLinuxAdditions-x86.run
  
The installer program will automatically compile and install the needed kernel modules. Each step will produce a verbose output on your console. At installation conclusion, try to run a graphical session. The X server distributed with Slackware 13.1 should start without a /etc/X11/xorg.conf configuration file. If problems arise, create the configuration file by running command xorgsetup and answering some questions concerning your hardware and preferences. The xorgsetup command will scan your hardware and save a proper xorg.conf file in directory /etc/X11.
+
The installer program will automatically compile and install the needed kernel modules. Each step will produce a verbose output on your console. At installation conclusion, try to run a graphical session. The X server distributed with Slackware 13.1 should start without a ''/etc/X11/xorg.conf'' configuration file. If problems arise, create the configuration file by running command xorgsetup and answering some questions concerning your hardware and preferences. The '''xorgsetup''' command will scan your hardware and save a proper xorg.conf file in directory ''/etc/X11''.
  
  
== Guest system configuration ==
+
== Guest System Configuration ==
 
 
  
 
Some Linux distributions require no additional step. Slackware on the other hand, due to some discrepancies in the driver and libraries installation paths, needs some tweaking to enable the graphic 3-D acceleration.
 
Some Linux distributions require no additional step. Slackware on the other hand, due to some discrepancies in the driver and libraries installation paths, needs some tweaking to enable the graphic 3-D acceleration.
Line 63: Line 56:
 
1 – Low framerate. When running the ''glxgears'' program, the returned frame rate never exceeds 300 frames per second. 300 fps is a real low value and a direct consequence of software 3-D rendering.
 
1 – Low framerate. When running the ''glxgears'' program, the returned frame rate never exceeds 300 frames per second. 300 fps is a real low value and a direct consequence of software 3-D rendering.
  
2 – Your X session log file, /var/log/X.log.x where x is a number between 0 and 9 that identifies the open session, contains some error messages:
+
2 – Your X session log file, ''/var/log/X.log.''x where x is a number between 0 and 9 that identifies the open session, contains some error messages:
   (EE) AIGLX error: dlopen of /usr/lib/xorg/modules/dri/vboxvideo_dri.so failed (/usr/lib/xorg/modules/dri/vboxvideo_dri.so: cannot open shared
+
   (EE) AIGLX error: dlopen of /usr/lib/xorg/modules/dri/vboxvideo_dri.so failed (/usr/lib/xorg/modules/dri/vboxvideo_dri.so:
  object file: No such file or directory)
+
  cannot open shared object file: No such file or directory)
 
   (EE) AIGLX: reverting to software rendering
 
   (EE) AIGLX: reverting to software rendering
 
The message is a self explainatory one. It states that since no proper driver was found the system reverts to software rendering.
 
The message is a self explainatory one. It states that since no proper driver was found the system reverts to software rendering.
+
 
 +
 
 
To solve the issue you need to create two links in order for Virtualbox to find the needed drivers. From a shell prompt run:
 
To solve the issue you need to create two links in order for Virtualbox to find the needed drivers. From a shell prompt run:
   ln -s /usr/lib/xorg/modules/dri /usr/lib/dri
+
   '''ln''' ''-s'' /usr/lib/xorg/modules/dri /usr/lib/dri
   ln -s /usr/lib/VBoxOGL.so /usr/lib/xorg/modules/dri/vboxvideo_dri.so
+
   '''ln''' ''-s'' /usr/lib/VBoxOGL.so /usr/lib/xorg/modules/dri/vboxvideo_dri.so
  
 
Then restart the X server.
 
Then restart the X server.
Line 84: Line 78:
 
Add the user to the ''video'' group
 
Add the user to the ''video'' group
  
Impose permission 0666 for the dri X module by updating the configuration file /etc/X11/xorg.conf
+
Impose permission 0666 for the dri X module by updating the configuration file ''/etc/X11/xorg.conf''
  
Last but not least verify that creation rules for the Virtualbox device drivers are not root centered. Check for file 60-vboxadd.rules in directory /etc/udev/rules.d. The file should exist and contain two lines:
+
Last but not least verify that creation rules for the Virtualbox device drivers are not root centered. Check for file 60-vboxadd.rules in directory ''/etc/udev/rules.d''. The file should exist and contain two lines:
 
   KERNEL=="vboxguest", NAME="vboxguest", OWNER="root", MODE="0660"
 
   KERNEL=="vboxguest", NAME="vboxguest", OWNER="root", MODE="0660"
 
   KERNEL=="vboxuser", NAME="vboxuser", OWNER="root", MODE="0666"
 
   KERNEL=="vboxuser", NAME="vboxuser", OWNER="root", MODE="0666"
Line 92: Line 86:
  
  
For any feedback, questions, errors and such, please e-mail me at studiosg [at] giustetti [dot] net
+
For any feedback, questions, errors and such, please e-mail me at ''studiosg [at] giustetti [dot] net''.
  
  
 
External links
 
External links
 +
 
----
 
----
 +
 
* [http://www.virtualbox.org/ Virtualbox project home page]
 
* [http://www.virtualbox.org/ Virtualbox project home page]
 
* [http://en.wikipedia.org/wiki/Virtualbox Virtualbox wikipedia related page]
 
* [http://en.wikipedia.org/wiki/Virtualbox Virtualbox wikipedia related page]
 
  
 
----
 
----
  
Languages: '''English''' - [http://www.giustetti.net/wiki/index.php?title=Virtualbox_3d_acceleration Italiano]
+
{{footer_en | link_page=virtualbox_3d_acceleration}}

Revision as of 09:56, 29 December 2016

Welcome to Simone Giustetti's wiki pages.


Languages: English - Italiano


Virtualbox 3-D Acceleration

In this article I will show how to enable 3-D graphic acceleration for a virtual machine running a Slackware Linux system.


Virtualbox is a virtualization product: a software which can "emulate" machines and run Operating Systems and programs on them with near native performances. 3-D acceleration is one among the many features offered by Virtualbox; a feature included with release 2.x of the software. Given a Host system with 3-D capable hardware, a correctly configured virtual guest system can use 3-D graphic acceleration.

We'll use the official Virtualbox package that can be downloaded from:

  http://www.virtualbox.org/wiki/Downloads


Let's suppose Virtualbox was correctly installed on the host system, that a virtual Linux machine was configured and that later a release 13.1 Slackware Linux operating system was installed on that guest virtual machine. Three operations have to be executed in order to enable 3-D acceleration:


Enable 3-D Acceleration Functionality for the Guest System

Open the Virtualbox console and select the desired machine. Open the option window by right clicking the mouse on the Settings button. A new mask will open. Select the Display tab then check option "Enable 3D Acceleration".


Guest Addin Installation

Start the virtual machine. Open menù Devices and select option Devices->CD/DVD Devices->VboxGuestAdditions.iso. Login as root to the guest system and mount the cdrom by running the command:

  mount /mnt/cdrom

Move to the /mnt/cdrom directory. The command ls -la should return a list of binary files:

  ls -la /mnt/cdrom/
  total 30226
  dr-xr-xr-x  4 root root     2048 2010-06-08 13:19 .
  drwxr-xr-x 10 root root     4096 2006-09-26 05:09 ..
  dr-xr-xr-x  3 root root     2048 2010-06-08 13:19 32Bit
  dr-xr-xr-x  2 root root     2048 2010-06-08 13:19 64Bit
  -r-xr-xr-x  1 root root      222 2010-06-02 18:33 AUTORUN.INF
  -r-xr-xr-x  1 root root  3276240 2010-06-08 13:10 VBoxLinuxAdditions-amd64.run
  -r-xr-xr-x  1 root root  2825676 2010-06-08 13:18 VBoxLinuxAdditions-x86.run
  -r-xr-xr-x  1 root root 11205632 2010-06-08 13:09 VBoxSolarisAdditions.pkg
  -r-xr-xr-x  1 root root  7657512 2010-06-08 13:04 VBoxWindowsAdditions-amd64.exe
  -r-xr-xr-x  1 root root  5691768 2010-06-08 13:01 VBoxWindowsAdditions-x86.exe
  -r-xr-xr-x  1 root root   277008 2010-06-08 13:00 VBoxWindowsAdditions.exe
  -r-xr-xr-x  1 root root     4890 2010-06-08 13:14 autorun.sh

Run the package designed for the architecture of your virtual machine. VBoxLinuxAdditions-x86.run for 32 bit virtual machines and VBoxLinuxAdditions-x86.run for 64 bit ones.

  bash ./VBoxLinuxAdditions-x86.run

The installer program will automatically compile and install the needed kernel modules. Each step will produce a verbose output on your console. At installation conclusion, try to run a graphical session. The X server distributed with Slackware 13.1 should start without a /etc/X11/xorg.conf configuration file. If problems arise, create the configuration file by running command xorgsetup and answering some questions concerning your hardware and preferences. The xorgsetup command will scan your hardware and save a proper xorg.conf file in directory /etc/X11.


Guest System Configuration

Some Linux distributions require no additional step. Slackware on the other hand, due to some discrepancies in the driver and libraries installation paths, needs some tweaking to enable the graphic 3-D acceleration. Some symptoms are:

1 – Low framerate. When running the glxgears program, the returned frame rate never exceeds 300 frames per second. 300 fps is a real low value and a direct consequence of software 3-D rendering.

2 – Your X session log file, /var/log/X.log.x where x is a number between 0 and 9 that identifies the open session, contains some error messages:

  (EE) AIGLX error: dlopen of /usr/lib/xorg/modules/dri/vboxvideo_dri.so failed (/usr/lib/xorg/modules/dri/vboxvideo_dri.so:
  cannot open shared object file: No such file or directory)
  (EE) AIGLX: reverting to software rendering

The message is a self explainatory one. It states that since no proper driver was found the system reverts to software rendering.


To solve the issue you need to create two links in order for Virtualbox to find the needed drivers. From a shell prompt run:

  ln -s /usr/lib/xorg/modules/dri /usr/lib/dri
  ln -s /usr/lib/VBoxOGL.so /usr/lib/xorg/modules/dri/vboxvideo_dri.so

Then restart the X server. An increase in frame rate should be noted soon after. Frames per second should now top 1500 fps. The X session log file will now contain the message:

  (EE) AIGLX error: vboxvideo does not export required DRI extension
  (EE) AIGLX: reverting to software rendering

I could not find a way to eliminate that error message, but i does not seem to affect the rendering process.

All operations described so far require root privileges. If you want to enable 3-D acceleration for users with lower permissions please:

Add the user to the video group

Impose permission 0666 for the dri X module by updating the configuration file /etc/X11/xorg.conf

Last but not least verify that creation rules for the Virtualbox device drivers are not root centered. Check for file 60-vboxadd.rules in directory /etc/udev/rules.d. The file should exist and contain two lines:

  KERNEL=="vboxguest", NAME="vboxguest", OWNER="root", MODE="0660"
  KERNEL=="vboxuser", NAME="vboxuser", OWNER="root", MODE="0666"

otherwise create the file and populate it with the two rows above.


For any feedback, questions, errors and such, please e-mail me at studiosg [at] giustetti [dot] net.


External links





Languages: English - Italiano