Implementation of OpenGL on windows guest virtual machine using Mesa/Virgl protocol.
git clone https://gitlab.freedesktop.org/virgl/virglrenderer
get reset --hard 8df4cba170940dad9350a99900293adbcef39b6c
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
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;
}