Перейти к содержимому

Использовать NVidia GPU от VirtualBox?

16

Как заставить гостя VirtualBox использовать графику NVidia?

Настройка хоста:

  • Windows 7 x64

  • NVidia Optimus

  • В Панели управления NVIDIA я явно выбрал высокопроизводительный процессор NVIDIA для:

     C:\Program Files\oracle\VirtualBox\VirtualBox.exe C:\Program Files\Oracle\VirtualBox\VBoxSVC.exe 
  • Когда VirtualBox работает, программное обеспечение NVidia не отображает его как приложение, использующее графический процессор NVidia. Поэтому я предполагаю, что VirtualBox действительно не использует графический процессор Nvidia.

Гость:

  • Windows 7 x64 (то же самое, что и хост)

  • Гостевые дополнения установлены

  • 3D-ускорение включено в настройках VirtualBox: Дисплей / Видео / Включить 3D-ускорение

  • Что Rhinoceros, приложение с поддержкой OpenGL, сообщает как видеоадаптер:

    Humper Chromium OpenGL version: 2.1 Chromium 1.9 Render version: 2.0 Shading Language: 1.40 - Intel Build 9.17.10.3517 Driver Date: NA Driver Version: NA Maximum Texture size: 8192 x 8192 Z-Buffer depth: 32bits Maximum Viewport size: 8192 x 8192 Total Video Memory: 64 MB 

    Мне кажется, что виртуальная машина использует аппаратное ускорение 3D хоста, но, к сожалению, Intel.

96 650 просмотров
feklee спросил 12 лет назад
F 655

1 ответ

13

Giving the guest full GPU access is probably not possible. If a virtual machine had direct access to your GPU while your host was using it, Bad ThingsTM would happen because sharing memory between two effectively different computers is not a thing; pointers and addresses and whatnot would be very different between them. (No consumer-available card supports servicing two computers at once.)

There are, however, some things you can try. First, set your preferred graphics processor to the good one in the NVidia Control Panel (3D SettingsManage 3D settingsPreferred graphics processor). That might make VirtualBox go with the NVidia card for OpenGL.

If that doesn't help, try installing Guest Additions in Safe Mode on the guest.

Finally, you can try to pass the GPU through to the virtual machine, but this will only work for PCI cards and I wasn't able to find whether yours is PCI, and even so, you stand a good chance of ripping the GPU away from the host or causing other problems. Using Device Manager, find the PCI address (bus, device, and function) for the good card. Set your VM's chipset to ICH9; this didn't cause any death or destruction when I tried it. Open an administrative command prompt and navigate to the VirtualBox folder (\Program Files\Oracle\VirtualBox\) and do this:

vboxmanage modifyvm "Your VM Name" --pciattach BB:DD.F@bb:dd.f 

Replace Your VM Name as appropriate. BB is the bus number of your GPU on the host; DD is the device; F is the function. After the @, enter the PCI slot that it will be on the guest. For example:

vboxmanage modifyvm "Windows 7 x64" --pciattach 01:00.0@03.01.0 

I hear that GPU passthrough is more likely to be possible on a Linux host. See How to setup a gaming machine with GPU passthrough.

Предположение о том, что присоединение графического процессора к виртуальной машине является «плохой вещью», неверно; Существует большое сообщество людей, которые хотят сделать это, чтобы создавать игровые виртуальные машины на гипервизорах «голый металл». Если бы кто-то хотел сделать это в Linux, это потребовало бы внесения в черный список графического процессора PCIe, чтобы ядро ​​обращалось только к графике чипсета; это предотвращает проблемы «разделяемой памяти». Предотвращение захвата карты Windows, вероятно, является самой трудной проблемой для решения этого вопроса, и, вероятно, для этого потребуется отключить устройство или удалить optimus и драйвер nvidia.

Tim G · 9 лет назад · 2

@TimG Хорошо, я немного прояснил свой пост. Спасибо!

Ben N · 9 лет назад · 0
Ben N ответил 10 лет назад
B 28 901