- According to the Windows Display Driver Model (WDDM) and DirectX specifications, a GPU driver consists of two components: KMD (Kernel Mode Driver) and UMD (User Mode Driver).
- In this project, KMD corresponds to
viogpu3d, and UMD corresponds tod3d10umd. - The whole architecture is like the following:
- Terminology used in this document:
- Host machine: The Windows system used to build the driver and run WinDBG.
- Target machine: The Windows system where the driver is installed and APP are executed.
- On the host machine, install the following tools:
- Visual Studio with C++ development workload.
- Windows Driver Kit (WDK) for Windows 10 or later.
- After installation, the following tools will be available:
-
- Visual Studio IDE
-
- WinDBG (for kernel-mode debug)
-
- msvsmon.exe (for remote user-mode debug)
- This is KMD under windows WDDM architecture.
- On the host machine, open the Visual Studio solution
build/virtio-gpu-win.sln. - Select the appropriate build configuration (e.g.,
Release / x64). - Build the
viogpu3dproject, it will generateviogpu3d.sysas KMD, andviogpu3d.infas driver installation file.
- This is the UMD under windows WDDM/DirectX architecture.
- Cause several .c & .h files are generated by python script in mesa project, so we need run the bat script
build/d3d10umd/gen-mesa-file.batfirstly. - On the host machine, open the Visual Studio solution
build/virtio-gpu-win.sln. - Select the appropriate build configuration (e.g.,
Release / x64). - Build the
d3d10umdproject, it will generated3d10umd.dllas UMD.
- Cause the driver without signature could not be installed on Windows, we need to disable the signature check on target machine.
- There are several ways to disable the signature check:
-
- Input the following cmd as Administrator in cmd, and restart the target machine:
bcdedit /set {current} testsigning on-
- Run WinDBG on host machine, connect to target machine via kernel debug mode.
- Then the target machine will be in debug mode, and the signature check will be disabled automatically.
- Method (2) will be described in detail in the following section 4.1.
- TODO
- On target machine, install the Graphic Tools in Settings / Optional Features.
-
Adjust GPU driver registry settings if necessary (debug purposes):
-
Build a Debug version
d3d10umd.dll, and place it in the same directory as the APP executable. -
DirectX will load the UMD in the following order: 1) APP folder, 2) System32 folder.
-
This allows: 1) the current APP to use the Debug UMD; 2) other APP to continue using the release UMD from System32.
- On the host machine, there is
msvsmon.exein Visual Studio package, copy it to target machine and run it as Administrator. - On the host machine, use Visual Studio to remote launch the APP on the target machine.
- Debug the UMD directly from Visual Studio.
