Discussion:
[vbox-dev] vbox 3D implementation
DONG HE
2014-04-11 03:06:58 UTC
Permalink
Hi Mikhail & Klaus,

Thanks a lot for your information. It is very helpful.
I had wrong impression that VBox 3D implementation is on top SVGA, which
leaded me to the wrong place in the repository where has an uncompleted
SVGA.
Now I kinda have a big picture how VBox D3D&OpenGL driver works.
src\VBox\Additions\WINNT\Graphics\Video\mp\wddm contains the wddm miniport
driver which talks to dxgkrnl.sys
src\VBox\Additions\WINNT\Graphics\Video\disp\wddm has the wddm d3d user
mode driver known as VBoxDispD3D.dll. D3D states will convert to OGL states
with the help of Wine, and eventually goes to the OpenGL drivers,
VBoxOGL.dll(src/VBox/Additions/common/crOpenGL).
However, a few things are still unclear to me, such as how those modules
interact exactly.
And the OGL driver appears to be a Windows OpenGL ICD driver. I wonder if I
need a Microsoft ICD SDK to build the OpenGL driver successfully. Did
anyone manage to build the WDDM driver and OpenGL driver separately before?


Regards,
DONG
Guest-side code is located in
src/VBox/Additions/common/crOpenGL
src/VBox/Additions/WINNT/Graphics/Video (WDDM stuff)
src/VBox/Additions/WINNT/Graphics/Wine_new
Host-side code is in
src/VBox/HostServices/SharedOpenGL
Gues-Host shared code is
src/VBox/GuestHost/OpenGL
Hope this helps.
Mikhail
Hi Dong,
Hello VBox developers,
Recently I have great interest in figuring out how VBox implement 3D
support for D3D and OpenGL. The learning work finally can not proceed as
a few files are missing from the SVN trunk check-out, which
are DevVGA-SVGA3d-shared.cpp, DevVGA-SVGA3d-win.cpp
and DevVGA-SVGA3d-ogl.cpp.
I wonder why those files are truncated from the repository or if they
exist in some experimental branches? Please give me some ideas. Thanks!
You're looking at totally the wrong stuff. These files are totally
unrelated to the existing 3D support.
Check the contents of src/VBox/HostServices/SharedOpenGL for a lot of
the code (there are bits and pieces elsewhere).
Note that I'm not knowing any details how the whole thing works, so
asking me personally won't get you much further.
Klaus
Regards,
DONG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20140410/90f46c50/attachment.html
Mikhail Sennikovsky
2014-04-11 09:25:56 UTC
Permalink
Hi Dong,

We do not use ICD SDK atm, so it should be possible to build all asutt using standard WDK/SDK headers/libs & tools.
We use XPDM-complient ICD interface to implement OpenGL support on windows.
As for D3D, VBox WineD3D version is using VBoxOGL directly rather than via Opengl32 + ICD.
WDDM incarnation of VBox D3D in particular is actually using VBoxOGL as a layer for packing chromium commands which are then submitted via standard 3D/WDDM DDI.

Mikhail
Post by DONG HE
Hi Mikhail & Klaus,
Thanks a lot for your information. It is very helpful.
I had wrong impression that VBox 3D implementation is on top SVGA, which leaded me to the wrong place in the repository where has an uncompleted SVGA.
Now I kinda have a big picture how VBox D3D&OpenGL driver works.
src\VBox\Additions\WINNT\Graphics\Video\mp\wddm contains the wddm miniport driver which talks to dxgkrnl.sys
src\VBox\Additions\WINNT\Graphics\Video\disp\wddm has the wddm d3d user mode driver known as VBoxDispD3D.dll. D3D states will convert to OGL states with the help of Wine, and eventually goes to the OpenGL drivers, VBoxOGL.dll(src/VBox/Additions/common/crOpenGL).
However, a few things are still unclear to me, such as how those modules interact exactly.
And the OGL driver appears to be a Windows OpenGL ICD driver. I wonder if I need a Microsoft ICD SDK to build the OpenGL driver successfully. Did anyone manage to build the WDDM driver and OpenGL driver separately before?
Regards,
DONG
Guest-side code is located in
src/VBox/Additions/common/crOpenGL
src/VBox/Additions/WINNT/Graphics/Video (WDDM stuff)
src/VBox/Additions/WINNT/Graphics/Wine_new
Host-side code is in
src/VBox/HostServices/SharedOpenGL
Gues-Host shared code is
src/VBox/GuestHost/OpenGL
Hope this helps.
Mikhail
Hi Dong,
Hello VBox developers,
Recently I have great interest in figuring out how VBox implement 3D
support for D3D and OpenGL. The learning work finally can not proceed as
a few files are missing from the SVN trunk check-out, which
are DevVGA-SVGA3d-shared.cpp, DevVGA-SVGA3d-win.cpp
and DevVGA-SVGA3d-ogl.cpp.
I wonder why those files are truncated from the repository or if they
exist in some experimental branches? Please give me some ideas. Thanks!
You're looking at totally the wrong stuff. These files are totally
unrelated to the existing 3D support.
Check the contents of src/VBox/HostServices/SharedOpenGL for a lot of
the code (there are bits and pieces elsewhere).
Note that I'm not knowing any details how the whole thing works, so
asking me personally won't get you much further.
Klaus
Regards,
DONG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20140411/62e24c36/attachment-0001.html
DONG HE
2014-04-15 03:45:18 UTC
Permalink
Hi Mikhail,

You are right. I managed to build the WDDM drivers and OpenGL driver
without any problem.
Currently my understanding is that chromium commands is a command packet
wrapper in which OpenGL state values are packed. The packer
(GuestHost\OpenGL\packer) is built as VBoxOGLpackspu.dll that VBoxOGL.dll
will use, meanwhile, there is a VBox HOST process interprets and execute
the OpenGL commands (HostServices\SharedOpenGL\unpacker).
At this point I am still unclear on some details. Can you please enlighten
me on a few questions? Really appreciate!
1) The 3D application running on guest OS creates render target (surfaces)
where the render result goes in, I wonder how the render target are handled
across the guest OS and the Host OpenGL servie that is doing the real
rendering.

2) Suppose we have a very simple D3D application which just draws a
triangle, essentially, this app goes through D3D runtime and asks the user
mode driver to create context, allocate at least two buffers - vertex
buffer, and render surface, I feel that only the render surface buffer
creation request will go to WDDM kernel mode driver ddi function DDI
function CreateAllocation, the context and vertex buffer will convert to
OpenGL context and vertex buffer. If I am right, the kernel mode driver
allocate the render surface and pass back the address to user mode driver,
then host service gets the render target and performs rendering on it, when
the user mode driver knows the rendering is completed it informs the kernel
mode driver and DDI function render or present copies the render target to
framebuffer to finally present the result. This is my understanding to the
whole process. If I have any misunderstanding or even not close, can you
please walk me through the process how the simplest d3d app manages to draw
a triangle and finally presents on the screen?

Best regards,
Dong

On Fri, Apr 11, 2014 at 5:25 AM, Mikhail Sennikovsky <
Hi Dong,
We do not use ICD SDK atm, so it should be possible to build all asutt
using standard WDK/SDK headers/libs & tools.
We use XPDM-complient ICD interface to implement OpenGL support on windows.
As for D3D, VBox WineD3D version is using VBoxOGL directly rather than via Opengl32 + ICD.
WDDM incarnation of VBox D3D in particular is actually using VBoxOGL as a
layer for packing chromium commands which are then submitted via standard
3D/WDDM DDI.
Mikhail
Hi Mikhail & Klaus,
Thanks a lot for your information. It is very helpful.
I had wrong impression that VBox 3D implementation is on top SVGA, which
leaded me to the wrong place in the repository where has an uncompleted
SVGA.
Now I kinda have a big picture how VBox D3D&OpenGL driver works.
src\VBox\Additions\WINNT\Graphics\Video\mp\wddm contains the wddm miniport
driver which talks to dxgkrnl.sys
src\VBox\Additions\WINNT\Graphics\Video\disp\wddm has the wddm d3d user
mode driver known as VBoxDispD3D.dll. D3D states will convert to OGL states
with the help of Wine, and eventually goes to the OpenGL drivers,
VBoxOGL.dll(src/VBox/Additions/common/crOpenGL).
However, a few things are still unclear to me, such as how those modules interact exactly.
And the OGL driver appears to be a Windows OpenGL ICD driver. I wonder if
I need a Microsoft ICD SDK to build the OpenGL driver successfully. Did
anyone manage to build the WDDM driver and OpenGL driver separately before?
Regards,
DONG
Just to get a bit more precise info on the current 3D source code
Guest-side code is located in
src/VBox/Additions/common/crOpenGL
src/VBox/Additions/WINNT/Graphics/Video (WDDM stuff)
src/VBox/Additions/WINNT/Graphics/Wine_new
Host-side code is in
src/VBox/HostServices/SharedOpenGL
Gues-Host shared code is
src/VBox/GuestHost/OpenGL
Hope this helps.
Mikhail
Hi Dong,
Hello VBox developers,
Recently I have great interest in figuring out how VBox implement 3D
support for D3D and OpenGL. The learning work finally can not proceed
as
a few files are missing from the SVN trunk check-out, which
are DevVGA-SVGA3d-shared.cpp, DevVGA-SVGA3d-win.cpp
and DevVGA-SVGA3d-ogl.cpp.
I wonder why those files are truncated from the repository or if they
exist in some experimental branches? Please give me some ideas. Thanks!
You're looking at totally the wrong stuff. These files are totally
unrelated to the existing 3D support.
Check the contents of src/VBox/HostServices/SharedOpenGL for a lot of
the code (there are bits and pieces elsewhere).
Note that I'm not knowing any details how the whole thing works, so
asking me personally won't get you much further.
Klaus
Regards,
DONG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20140414/a618843a/attachment.html
Loading...