VirtualBox

Opened 17 years ago

Closed 15 years ago

Last modified 14 years ago

#475 closed defect (fixed)

3D acceleration support for VBox guests

Reported by: Sander van Leeuwen Owned by:
Component: 3D support Version: VirtualBox 1.4.0
Keywords: Cc:
Guest type: other Host type: other

Description (last modified by Sander van Leeuwen)

This ticket is used to track development of 3d acceleration support.

I have committed my initial OpenGL guest support to the public SVN tree:

Current status:

  • communication framework between guest and host is present
  • simple OpenGL samples are functional; they display their rendered output in an external window on the host for testing purposes)
  • supported are only Windows guests combined with a Windows host
  • not all OpenGL commands are implemented; most simple ones are

Plans:

  • Linux host and guest OpenGL support
  • Add OpenGL extensions as reported by the host OS
  • Direct3D emulation using OpenGL

We are looking for external developers with an interest to help us out to complete this work.

Installation instructions:

To enable it you must add the following registry keys:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL]
"Version"=dword:00000002
"DriverVersion"=dword:00000001
"Flags"=dword:00000001
"Dll"="VBoxOGL.dll" 

You need to build the latest additions from SVN as the OpenGL ICD mechanism needs a change in the display driver.

VBoxOGL.dll needs to be present in \Windows\System32.

TEMPORARY requirement: to enable OpenGL you must change src\VBox\Main\VMMDevInterface.cpp at line 606.

You can also directly link the OpenGL test cases with VBoxOGL.lib to test them directly.

  • replace $(PATH_SDK_W2K3DDKX86_LIB)/opengl32.lib with $(PATH_LIB)/VBoxOGL.lib in the makefile of the test cases
  • add VBOX_WITH_WGL_EXPORTS to VBoxOGL_DEFS in the VBoxOGL makefile

Enabling logging can be of invaluable help while debugging problems.

  • export the VBOX_LOG variable and set it to -all+shared_opengl+dev_vmm_backdoor
  • build the debug version of VBox

The full debug version of VBox adds quite a bit of overhead and might assert from time to time. For OpenGL debugging you only need to use the debug binaries of the hardware Devices (VBoxDD*.*). You can simply copy them into the directory with the full release version. (both must be at the same SVN level of course)

Change History (36)

comment:1 by Sander van Leeuwen, 17 years ago

Description: modified (diff)

comment:2 by Sander van Leeuwen, 17 years ago

Description: modified (diff)

comment:3 by Sander van Leeuwen, 17 years ago

Description: modified (diff)

comment:4 by Sander van Leeuwen, 17 years ago

Description: modified (diff)

comment:5 by Sander van Leeuwen, 17 years ago

Description: modified (diff)

comment:6 by Sander van Leeuwen, 17 years ago

Even Rouault wrote in http://forums.virtualbox.org/viewtopic.php?p=2588#2588:

Looks like we're working on complementary things... I've updated tonight my QEMU (Linux) OpenGL patch : http://qemu-forum.ipi.fi/viewtopic.php?t=2984

I guess it could be possible to reuse my client and server stubs even if you use a different guest/host data transmission protocol. I think I'm done with most of the core OpenGL API and the vendor extensions.

comment:7 by Sander van Leeuwen, 17 years ago

Description: modified (diff)

comment:8 by Sander van Leeuwen, 17 years ago

Description: modified (diff)

comment:9 by Sander van Leeuwen, 17 years ago

Description: modified (diff)

comment:10 by aeichner, 17 years ago

Porting the OpenGL to Linux host is in work.
It doesn't work at the moment but the important functions are implemented.
This includes:
vboxglDrvCreateContext
vboxglDrvDeleteContext
vboxglDrvSetContext
vboxglDrvCopyContext
vboxglDrvReleaseContext
vboxglDrvSetPixelFormat
vboxglDrvDescribePixelFormat
vboxDrvIsExtensionAvailable

The newest patch is available at http://aleichner.homepage.t-online.de/gllin.patch

comment:11 by aeichner, 17 years ago

tstShOpenGL.exe runs without crashing and showing extensions available on the host. Updated patch at the above mentioned URL. The biggest problem now is that we don't have a global variable Display and we can only have one per application. libX11 is also not threadsafe.

comment:12 by Even Rouault, 17 years ago

At http://qemu-forum.ipi.fi/viewtopic.php?t=2984, you'll find an updated version of the OpenGL patch that adds Win32 guest TCP/IP support.

See GL_README.txt for use and compilation details. Extract :

NEWS :

  • 2007/07/09 :
  • Add support of TCP/IP for Win32 guest (see 'How to use it ?' and 'Debugging infrastructure' below for compilation and configuration details)
  • Add support for missing calls : glEnableVariantClientStateEXT,glDisableVariantClientStateEXT, glVariantPointerEXT, glGetVariantPointerEXT
  • Improve a bit XGL support.It runs now smoothly but with the HACK_XGL environment variable defined (still need to figure out why this hack is necessary)
  • Add command-line documentation for opengl_server and opengl_player. Among them : an added option to opengl_server, namely -parent-xid=XXXXX, enables you to attach the created OpenGL window as a child of XXXXX (can be obtained thanks by xwininfo by a click on the emulator window), which gives a satisfactory visual integration. Except the fact that Windows cursor (which is emulated) will be invisible, because behind the OpenGL window... The Windows trick equivalent to XFixesGetCursorImage is still to be found to display a soft cursor upon the OpenGL window.
  • In the head of opengl_client.c, a summary list of useful environment variables

in reply to:  description comment:13 by Technologov, 17 years ago

I want to add myself as CC to this bug. I hope it will do so automatically with this message.

comment:14 by Sander van Leeuwen, 17 years ago

I have turned off OpenGL acceleration by default. I'll make it configurable in the future, but for now you'll have to change src\VBox\Main\VMMDevInterface.cpp at line 606.

comment:15 by Sander van Leeuwen, 17 years ago

I'll merge the Linux changes next week. Work is also currently underway to provide VRAM heap allocation, so we can remove the test code to display OpenGL output in a seperate window.

With VRAM we will have a simple method of maintaining a single display buffer in the guest and host. There will be no more need for copying.

comment:16 by Sander van Leeuwen, 17 years ago

When the VRAM heap allocation code is finished, I'll update the Windows host backend to make use of it, so it can be easily ported to Linux.

Then the basics will be ready and we'll need to decide which parts of the QEmu OpenGL part we can reuse. In its current form that code is not very portable nor cleanly separated. Yet doing everything from scratch is a rather big (and annoying) task. Especially taking all the OpenGL extensions into account.

comment:17 by Sander van Leeuwen, 17 years ago

Description: modified (diff)

comment:18 by aeichner, 17 years ago

I Think I found a way to avoid the global display variable and to prevent nvidia drivrs to crash (tstShOpenGL.exe works). But it is not really finished. Can you wait with merging my code until i send a new patch to the development list?

comment:19 by aeichner, 17 years ago

The new code works without a global display variable now and it doesn't crash with nvidia drivers but i want to test it with the mesa library. Unfortunately I have not enough time today to test it but i hope to send the new patch to the mailinglist tomorrow (maybe tonight).

comment:20 by Technologov, 17 years ago

This needs to be changed from "defect" to "enhancement".

Is there any progress here planned for next version ? I don't see commits since July.

in reply to:  19 comment:21 by Peter, 16 years ago

Is all the work still focusing just on Windows 3D as a guest? I am very keen just to have 3D desktop effects for Linux guests on a Windows XP host. I assume that is easier than trying to support games on a XP guest.. any feedback update on support for OpenGL on a Linux guest?

Thanks Replying to aeichner:

The new code works without a global display variable now and it doesn't crash with nvidia drivers but i want to test it with the mesa library. Unfortunately I have not enough time today to test it but i hope to send the new patch to the mailinglist tomorrow (maybe tonight).

comment:22 by Romashka, 16 years ago

Just FYI there's a new entry on KVM TODO list now:

  • Add vmgl support to qemu. Port to virtio. Write a Windows driver.

It's in the "For the adventurous" section though.

comment:23 by Technologov, 16 years ago

Romashka: Ohh, please, let's continue discussing those rumors on the forum. This thread should be kept for development.

-Technologov, 06.01.2008.

comment:24 by Jörn Dreyer, 16 years ago

I want to add myself as CC to this bug. I hope it will do so automatically with this message.

comment:25 by Kristoffer Lundén, 16 years ago

I want to add myself as CC to this bug. I hope it will do so automatically with this message.

comment:26 by Stefan Scheler, 16 years ago

I want to add myself as CC to this bug. I hope it will do so automatically with this message.

comment:28 by rhY, 16 years ago

I'm excited about this feature. Very excited. Hopefully just posting this comment will CC me to this bug and updates!

comment:29 by Romke van der Meulen, 16 years ago

I want to add myself as CC to this bug. I hope it will do so automatically with this message.

comment:30 by Giel van Schijndel, 15 years ago

I want to add myself as CC to this bug. I hope it will do so automatically with this message.

in reply to:  30 comment:31 by Rickard Holmberg, 15 years ago

I want to add myself as CC to this bug. I hope it will do so automatically with this message.

comment:32 by halton, 15 years ago

I want to add myself as CC to this bug. I hope it will do so automatically with this message.

comment:33 by BobRobertson, 15 years ago

I want to add myself as CC to this bug. I hope it will do so automatically with this message.

comment:34 by Andreas Setterlind, 15 years ago

May I suggest that you guys look into VMGL library and/or code for Linux, BSD and UNIX support: http://vmgl.sourceforge.net/ http://sourceforge.net/projects/vmgl

OpenGL apps running inside a Virtual Machine (VM) use VMGL to obtain graphics hardware acceleration. VMGL supports VMware, Xen PV and HVM, QEmu, and KVM virtual machines; X11-based OS such as Linux, FreeBSD and OpenSolaris; and ATI, Nvidia and Intel GPUs (GPU-independent). You can also use VMGL with X forwarding, regardless of the type of guest. Xen HVM domains (depending on hardware virtualization extensions) and Xen paravirtual domains, using XVnc or the virtual framebuffer.

VMGL is open source under the GPL and written using C programming language.

comment:35 by Frank Mehnert, 15 years ago

Component: other3D support

comment:36 by Sander van Leeuwen, 15 years ago

Resolution: fixed
Status: newclosed

We use Chromium (VMGL is based on the same code) for our OpenGL acceleration. All the code is in the public SVN tree.

I will close this defect for now as it's not really relevant anymore. Direct3D support will be added later as well as OpenGL for Linux and Solaris guests.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use