【发布时间】:2019-07-31 11:00:35
【问题描述】:
我有两张视频卡:
Intel(R) HD Graphics 630,驱动程序版本:25.20.100.6472
NVIDIA Quadro M1200,驱动程序版本:26.21.14.3102
在 Windows 10 上,这两种卡都可以很好地与 OpenGL/OpenGl ES 应用程序配合使用。
我尝试使用Xming 6.9.0.31 X Server 在适用于 Linux 的 Windows 子系统上运行 OpenGL ES 应用程序(基于 Java/LibGDX/LWJGL3),但出现以下错误:
“需要GLX 1.3版”
我已经安装了mesa-utils 包。
当我尝试运行glmark2 基准时,我收到以下错误:
错误:需要 GLX 版本 >= 1.3
错误:错误:无法获取 GL 视觉配置!
错误:主要:无法初始化画布
当我尝试运行glxgears -info 基准测试时,应用程序启动,显示齿轮但不旋转。似乎应用程序只呈现第一帧。在终端上,我们有一些有趣的信息:
GL_RENDERER = Quadro M1200/PCIe/SSE2
GL_VERSION = 1.2 (4.6.0 NVIDIA 431.02)
GL_VENDOR = NVIDIA 公司
GL_EXTENSIONS = GL_ARB_depth_texture GL_ARB_imaging GL_ARB_multitexture GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_shadow GL_ARB_texture_border_clamp GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_transpose_matrix GL_ARB_window_pos GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_multi_draw_arrays GL_EXT_packed_pixels GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture3D GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_object GL_EXT_vertex_array GL_ATI_texture_mirror_once GL_IBM_texture_mirrored_repeat GL_NV_blend_square GL_NV_point_sprite GL_NV_texgen_reflection GL_NV_texture_rectangle GL_SGIS_generate_mipmap GL_SGIS_texture_lod GL_SGIX_depth_texture GL_SGIX_shadow VisualID 54, 0x36
35.0 秒内 5493 帧 = 156.996 FPS
34.7 秒内 2085 帧 = 60.154 FPS
34.7 秒内 2085 帧 = 60.146 FPS
35.0 秒内 2085 帧 = 59.567 FPS
34.7 秒内 2085 帧 = 60.089 FPS
日志表明帧已渲染,但应用程序窗口中没有任何反应。
glxinfo | grep -i "version" -A 2 -B 2的结果:
直接渲染:否(如果您想找出原因,请尝试设置 LIBGL_DEBUG=详细)
服务器 glx 供应商字符串:SGI
服务器 glx 版本字符串:1.2
(...)
客户端 glx 供应商字符串:NVIDIA Corporation
客户端 glx 版本字符串:1.4
(...)
GLX 版本:1.2
(...)
OpenGL 供应商字符串:NVIDIA Corporation
OpenGL 渲染器字符串:Quadro M1200/PCIe/SSE2
OpenGL 版本字符串:1.2 (4.6.0 NVIDIA 431.02)
(...)
看了上面的清单我不明白为什么没有直接渲染,为什么服务器GLX版本是1.2(不是1.4),供应商是SGI,为什么OpenGL版本字符串是1.2(不是更高)?
我应该怎么做才能在 WSL 中正确运行 OpenGL 应用程序?
编辑:
nvidia-setting 命令显示以下输出:
ERROR: NVIDIA driver is not loaded
ERROR: Unable to load info from any available system
为什么?前面的命令显示我已经为 WSL 安装了 Nvidia 驱动程序。
编辑 2:
从存储库安装 Nvidia 驱动程序后:
sudo apt install nvidia-driver-390
我有以下nvidia-setting的错误:
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
ERROR: NVIDIA driver is not loaded
ERROR: Error querying enabled displays on GPU 0 (Missing Extension).
ERROR: Error querying connected displays on GPU 0 (Missing Extension).
** Message: 11:40:41.535: PRIME: No offloading required. Abort
** Message: 11:40:41.537: PRIME: is it supported? no
ERROR: nvidia-settings could not find the registry key file. This file should have been installed along with this driver at /usr/share/nvidia/nvidia-application-profiles-key-documentation. The application profiles will continue to work,
but values cannot be prepopulated or validated, and will not be listed in the help text. Please see the README for possible values and descriptions.
更新:
Xming 6好像支持很老的OpenGL版本,所以我决定用Cygwin/X作为X Server。
我使用以下命令启动它:
startx -- -listen tcp
基于 Cygwin 和 WSL 的终端输出,使用Mesa3D 驱动程序。在 WSL 上,glxgears 和 glmark2 可以正常工作。他们表明使用了以下渲染器(来自Mesa3d):
OpenGL Information
GL_VENDOR: VMware, Inc.
GL_RENDERER: llvmpipe (LLVM 8.0, 256 bits)
GL_VERSION: 3.1 Mesa 19.0.2
但是我的 Java 应用程序崩溃了:
shared memfd open() failed: Function not implemented
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 42 (X_SetInputFocus)
Serial number of failed request: 159
Current serial number in output stream: 176
另一方面,当我使用以下命令启动 Cygwin/X 时:
startxwin -- -listen tcp
似乎是从加速渲染开始的,因为屏幕上有以下信息:
GL_VERSION: 4.6.0 NVIDIA 431.70
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: Quadro M1200/PCIe/SSE2
(II) GLX: enabled GLX_SGI_make_current_read
(II) GLX: enabled GLX_SGI_swap_control
(II) GLX: enabled GLX_MESA_swap_control
(II) GLX: enabled GLX_SGIX_pbuffer
(II) GLX: enabled GLX_ARB_multisample
(II) GLX: enabled GLX_SGIS_multisample
(II) GLX: enabled GLX_ARB_fbconfig_float
(II) GLX: enabled GLX_EXT_fbconfig_packed_float
(II) GLX: enabled GLX_ARB_create_context
(II) GLX: enabled GLX_ARB_create_context_profile
(II) GLX: enabled GLX_ARB_create_context_robustness
(II) GLX: enabled GLX_EXT_create_context_es2_profile
(II) AIGLX: enabled GLX_MESA_copy_sub_buffer
(II) 894 pixel formats reported by wglGetPixelFormatAttribivARB
(II) 858 fbConfigs
(II) ignored pixel formats: 0 not OpenGL, 0 unknown pixel type, 36 unaccelerated
(II) GLX: Initialized Win32 native WGL GL provider for screen 0
但是 OpenGL 应用程序(glxgears、glmark2 和我自己的)无法在 WSL 上运行,产生类似于以下的错误:
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 148 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 32
Current serial number in output stream: 31
当我尝试为我的卡安装最新的 Nvidia 驱动程序时:NVIDIA-Linux-x86_64-430.40.run,出现以下错误:
警告:文件“/proc/sys/kernel/modprobe”不可用; X 服务器将使用
/sbin/modprobe作为modprobe的路径 效用。这条路径不同于由nvidia-installer,/bin/kmod。请确认/sbin/modprobe工作正常或挂载 /proc 文件系统并验证 '/proc/sys/kernel/modprobe' 报告正确的路径。 -> 使用 CC="/usr/bin/cc" 执行 CC 完整性检查。错误:无法找到当前运行的内核源代码树 核心。请确保您已安装内核源文件 对于您的内核并且它们已正确配置;在红帽上 例如,Linux 系统,请确保您拥有“内核源”或 'kernel-devel' RPM 已安装。如果您知道正确的内核源 文件已安装,您可以使用 '--kernel-source-path' 命令行选项。
总结:
如何在 WSL 上成功运行 OpenGL 硬件加速应用程序?如何在 WSL 上安装最新/可用的 NVidia 驱动程序?
【问题讨论】:
标签: opengl windows-10 nvidia windows-subsystem-for-linux