Skip to content

Commit 29ac033

Browse files
sivileridvrogozh
authored andcommitted
va_drm_utils: Map d3d12 gallium driver for Windows Subsytem for Linux
In Windows Subsystem for Linux we use VGEM to expose a dri device and load the mesa d3d12 gallium driver. The d3d12 component will then load the actual GPU vendor user mode driver lib from /lib/wsl/lib or /lib/wsl/drivers When libva initializes with DRM, add detection of the VGEM device in the WSL environment, and only then map to WSL/d3d12 driver name so that libva/drm loads d3d12_drv_video.so mesa gallium driver. Signed-off-by: Sil Vilerino <sivileri@microsoft.com>
1 parent 9ac72ef commit 29ac033

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

va/drm/va_drm_utils.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "sysdeps.h"
2828
#include <xf86drm.h>
2929
#include <sys/stat.h>
30+
#include <sys/utsname.h>
3031
#include "va_drm_utils.h"
3132
#include "va_drmcommon.h"
3233

@@ -42,6 +43,7 @@ static const struct driver_name_map g_driver_name_map[] = {
4243
{ "radeon", "r600" }, // Mesa Gallium driver
4344
{ "radeon", "radeonsi" }, // Mesa Gallium driver
4445
{ "amdgpu", "radeonsi" }, // Mesa Gallium driver
46+
{ "WSL", "d3d12" }, // Mesa Gallium driver
4547
{ "nvidia-drm", "nvidia" }, // NVIDIA driver
4648
{ NULL, NULL }
4749
};
@@ -110,6 +112,15 @@ VA_DRM_GetDriverName(VADriverContextP ctx, char **driver_name_ptr, int candidate
110112
return VA_STATUS_ERROR_INVALID_DISPLAY;
111113

112114
*driver_name_ptr = va_DRM_GetDrmDriverName(drm_state->fd);
115+
116+
/* Map vgem to WSL2 for Windows subsystem for linux */
117+
struct utsname sysinfo = {};
118+
if (!strncmp(*driver_name_ptr, "vgem", 4) && uname(&sysinfo) >= 0 &&
119+
strstr(sysinfo.release, "WSL")) {
120+
free(*driver_name_ptr);
121+
*driver_name_ptr = strdup("WSL");
122+
}
123+
113124
if (!*driver_name_ptr)
114125
return VA_STATUS_ERROR_UNKNOWN;
115126

0 commit comments

Comments
 (0)