8

Any ideas whether you can run a Windows VM via IronHide for graphics card acceleration? I'd like to play games / watch bluray etc utilising my video card.

  • 1
    I have successfully run a windows vm with bumblebee, but to no visible effect, are you looking for something more specific? – lofidevops Nov 25 '11 at 13:07
  • 1
    Well, I'd like to know if virtualbox would pass through the video acceleration from the windows VM to play games / watch bluray etc. – mwjackson Nov 25 '11 at 13:12
  • 1
    I'm planning on testing that myself sometime, I'll let you know the results if someone else doesn't answer first - perhaps adjust your question to be more specific? – lofidevops Nov 25 '11 at 13:20
  • I'm a bit confused with what you asked, you want the VM to use the nvidia GPU for it's 3D acceleration? , like direct access to the graphics hardware through the VM?. – Uri Herrera Nov 28 '11 at 15:40
  • Not sure about direct access to hardware, but would optirun make my nvidia card available to virtualbox? – mwjackson Nov 28 '11 at 18:07
  • I apologise if I haven't worded this question well - if someone could explain the situation with regards to host/guest OS's & GPU's I would be greatly appreciated. – mwjackson Nov 28 '11 at 18:12
  • 1
    @jacko you might want to crosspost this on https://forums.virtualbox.org – lofidevops Nov 29 '11 at 06:00

4 Answers4

9

Perhaps an explanation between graphics in a virtual guest and the actual host O/S would help here.

First the basics:

Everything in a virtual guest is an abstraction - what this means is that every device and driver in a virtual guest O/S does not depend upon the actual host device & driver.

To give you a simple example. A mouse is seen as a specific device - the linux kernel sees this device and allows the guest operating system to use that device. This "virtual device" is mapped to the real physical device by the virtualisation tool - VirtualBox, VMWare, Xen etc. Thus the guest operating system never needs to understand what the physical mouse is, it only sees what the virtualisation tool has mapped to it. The value of this approach is that you can move the virtual guest to different Hosts - it will operate in the same way because there is no direct dependency on the Host itself.

To show this in practice you can run lsusb on both the host and guest - on my host O/S I have the following USB devices:

Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0402:9665 ALi Corp. 
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

On my guest oneiric O/S I can see the following USB devices - these are different from the host:

Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet

Any guest O/S whether windows or linux will only see this virtual guest device.

Host graphics vs guest graphics

It is the same for graphics.

My host graphics is:

 sudo lshw -class display
  *-display               
       description: VGA compatible controller
       product: Core Processor Integrated Graphics Controller
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 18
       width: 64 bits
       clock: 33MHz
       capabilities: msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:41 memory:90000000-903fffff memory:80000000-8fffffff ioport:3050(size=8)

On my guest oneiric O/S it can see the following graphics card - you can see it is not the same as the host:

sudo lshw -class display
  *-display UNCLAIMED     
       description: VGA compatible controller
       product: VirtualBox Graphics Adapter
       vendor: InnoTek Systemberatung GmbH
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 00
       width: 32 bits
       clock: 33MHz
       capabilities: vga_controller bus_master
       configuration: latency=64
       resources: memory:e0000000-e7ffffff

Likewise - a Windows Guest O/S will see only a similar virtual guest device.

In the murky world of VirtualBox, the Guest Additions which you can manually install (or in 11.10 - jockey sees and recommends you install it) installs additional kernel modules (or device drivers for Windows Guests) to allow the guest O/S enhanced access to your host O/S graphics. Again its not a direct mapping - but allows 3D accelerated graphics to be seen.

If an application inside your virtual machine uses 3D features through the OpenGL programming interface (or for a Windows guest O/S - its DirectX calls), instead of emulating them in software (which would be slow), VirtualBox will attempt to use your host's 3D hardware.

Again I stress, the guest O/S doesnt see your actual graphics card it just passes the OpenGL (or DirectX) call from the Guest directly to the Host hardware to process.

enter image description here

In VirtualBox settings you should change the video card memory and 3D graphics card setting. Your guest O/S will then see a "3D Accelerated card" with 128Mb RAM. It doesnt matter if your host graphics card is better than this - your guest O/S will only see this "simple" abstracted virtual graphics card.

Since you mentioned you are using a Windows Guest O/S - the 2D checkbox is applicable to you since a similar pass-through of programming interface calls is performed.

Bumblebee/IronHide is an either/or graphics switching mechanism - you are using either integrated graphics or the higher capacity NVidia/ATI graphics but not both at the same time.

Since the OpenGL (or DirectX) capability of the higher switchable graphics is that more greater than the integrated chips set, you will see a relatively enhanced graphics performance with Guest O/S graphics intensive applications. However this improvement is not as dramatic as running the same application natively on the host since it is still working within the constraints of the 128MB virtual guest graphics device.

source

fossfreedom
  • 172,746
  • Addition: we can't do bumblebee (render on nvidia card) in virtual machines right now, since VMware and VirtualBox both require their binaries to be setuid to work. – allquixotic Nov 01 '12 at 00:31
5

An answer above https://askubuntu.com/a/85138/38052 explains how everything that the guest O/S sees is some kind of an abstraction. While this used to be completely true, I believe things are changing and it may not be completely true any more.

Some newer processors also support I/O MMU virtualization. The technologies are called Intel VT-d for the Intel's version and AMD-Vi for AMD's version. To quote the wikipedia article on x86 virtualization:

Intel's I/O MMU virtualization (AMD-Vi and VT-d) Main article: IOMMU

An input/output memory management unit (IOMMU) enables guest virtual machines to directly use peripheral devices, such as Ethernet, accelerated graphics cards, and hard-drive controllers, through DMA and interrupt remapping. This is sometimes called PCI passthrough. Both AMD and Intel have released specifications:

AMD's I/O Virtualization Technology, "AMD-Vi", originally called "IOMMU".
Intel's "Virtualization Technology for Directed I/O" (VT-d).

This sounds pretty interesting, but I can foresee some problems already. For one, in Optimus laptops, the Intel IGP is always rendering the final on-screen output. It is unclear to me how the Guest O/S and the Host O/S are both going to drive the IGP. One thought is that if it is possible to run the Host without any graphics while guests are running, this could be made to work, but it is unclear to me how one would actually go about doing this.

sarang
  • 51
  • 1
1

OK, I was curious, so I tried this.

QEMU, and now VirtualBox, are supporting pass-through of PCI devices to the guest machine. That means if you have a 2nd graphics card, you can pass it to a windows guest on a linux host and get full 3D performance (games) in a virtualized windows environment. That's the case for a desktop rig with two graphics cards. The device manager would show "NVIDIA GTX... whatever" instead of saying "Virualbox Graphics Adapter".

Optimus is always more complicated. I'm testing this on an ASUS UX501. I was able to pass the NVidia chip through to the windows guest and it shows in the device manager as "3D Video Controller." But I was unable to install any windows drivers to support it. Seems the presence of the intel graphics are a prereq.

sarang was right to be suspicious. It looks like the nvidia chip is not a "display adapter" as would drive a monitor, but just an accelerator for the integrated intel chip. They don't seem function as two separate devices independently.

0

https://gist.github.com/Misairu-G/616f7b2756c488148b7309addc940b28

It is possible to pass through the DGPU in some cases ( See Above Link) . i have managed this on my Dell 7710 with Quadro m5000m DGPU passed through from Ubuntu host to Windows10 guest.

However AFIK its is not possible to display the output from this card on the main laptop screen Via hardware. i think looking glass is probably the best option at the moment, followed by steam in home streaming / RDP etc.

I would like to know why it is not possible to to just control the Mux in muxed laptops to switch between the IGPU and DGPU at will. i attempted this via VGA Switcheroo but was unable to control the mux at all even before passing through the DPU to a Guest OS.

I guess Mux-less laptops i guess would be more challenging at least requiring some communication between guest and host to control which GPU is writing to which bit of the frame buffer. way over my head.

Bung
  • 1