Build Environment: VS2019 or MinGW-W64
Run build.bat in the usermode directory, it will download the Mesa project, patch it, and build it automatically. After building, you will get MvisorVGPUx64.dll and opengl32.dll in the build directory.
Build Environment: VS2019 + WDK10.0
It's a WDF kernel mode driver, after building, you will get vgpu.sys, vgpu.inf and vgpu.cat in the build directory.
bcdedit.exe /set testsigning on
- class: virtio-vgpu
memory: 1G
staging: Yes
blob: Yes
node: /dev/dri/renderD128
In order to use blob feature, you may need to patch the vrend_state.inferred_gl_caching_type in Virglrenderer to let your guest driver get VIRGL_CAP_ARB_BUFFER_STORAGE.
if (has_feature(feat_arb_buffer_storage) && !vrend_state.use_external_blob) {
const char *vendor = (const char *)glGetString(GL_VENDOR);
bool is_mesa = ((strstr(renderer, "Mesa") != NULL) || (strstr(renderer, "DRM") != NULL) ||
(strstr(renderer, "llvmpipe") != NULL));
/*
* Intel GPUs (aside from Atom, which doesn't expose GL4.5) are cache-coherent.
* Mesa AMDGPUs use write-combine mappings for coherent/persistent memory (see
* RADEON_FLAG_GTT_WC in si_buffer.c/r600_buffer_common.c). For Nvidia, we can guess and
* check. Long term, maybe a GL extension or using VK could replace these heuristics.
*
* Note Intel VMX ignores the caching type returned from virglrenderer, while AMD SVM and
* ARM honor it.
*/
if (is_mesa) {
if (strstr(vendor, "Intel") != NULL)
vrend_state.inferred_gl_caching_type = VIRGL_RENDERER_MAP_CACHE_CACHED;
else if (strstr(vendor, "AMD") != NULL)
vrend_state.inferred_gl_caching_type = VIRGL_RENDERER_MAP_CACHE_WC;
else if (strstr(vendor, "Mesa") != NULL)
vrend_state.inferred_gl_caching_type = VIRGL_RENDERER_MAP_CACHE_CACHED;
} else {
/* This is an educated guess since things don't explode with VMX + Nvidia. */
if (strstr(renderer, "NVIDIA") != NULL)
vrend_state.inferred_gl_caching_type = VIRGL_RENDERER_MAP_CACHE_UNCACHED;
}
if (vrend_state.inferred_gl_caching_type)
caps->v2.capability_bits |= VIRGL_CAP_ARB_BUFFER_STORAGE;
}
## References
- https://github.com/Keenuts/virtio-gpu-win-icd
- https://github.com/kjliew/qemu-3dfx
- https://gitlab.freedesktop.org/mesa/mesa
- https://gitlab.freedesktop.org/virgl/virglrenderer