0


Ubuntu20.04下安装显卡驱动

环境配置

系统: Ubuntu 20.04
CPU: i5
GPU:Geforce 960M

Ubuntu安装显卡驱动

1、查看当前显卡安装情况

使用glxinfo查看

https://dri.freedesktop.org/wiki/glxinfo/

$ glxinfo
Command 'glxinfo' not found, but can be installed with: 
sudoaptinstall mesa-utils

需要安装

mesa-utils
sudoaptinstall mesa-utils

查看gl相关命令

$ glxinfo |grep render
direct rendering: Yes 
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 4600(HSW GT2)
direct rendering

: 返回yes则表示是采用直接渲染,对应no则为非直接渲染(这时渲染指令将发送到X-server中渲染)

OpenGL renderer string

:诉你现在用的是什么driver, 能告诉你系统此时用的是software rendering还是hardware rendering

ps:拓展延伸其他情况

# 非直接+硬件渲染
direct rendering: No (LIBGL_ALWAYS_INDIRECT set)
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 4600(HSW GT2)

这里 OpenGL通过设置环境变量,被强制使用indirect rendering,意味着所有的rendering commands都被发往 X server。但是 X server实际上用的是硬件加速渲染(hardware accelerated rendering

#直接+软件渲染
direct rendering: Yes
OpenGL renderer string: Software Rasterizer

这里OpenGL味着用的是software rendering,但是所有的software rendering是在client application里完成的,而不是发往 X server

查看OpenGL渲染信息

$ glxinfo |grep OpenGL # glxinfo | grep -i opengl #可忽略大小写
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 4600(HSW GT2)
OpenGL core profile version string: 4.5(Core Profile) Mesa 21.2.6
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 21.2.6
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 21.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:

注意第二行

OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)

显然

OpenGL

的渲染采用的核显(也是硬件渲染)

当然,我们可以有更简单的方式,点击桌面的又上角,选择

Settings

打开

About

如下图
在这里插入图片描述

如果没有安装显卡,那么可以正式进入下面步骤了

2、查看所有可用的显卡驱动

ubuntu-drivers devices
$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd0000139Bsv000017AAsd00003978bc03sc02i00
vendor   : NVIDIA Corporation
model    : GM107M [GeForce GTX 960M]
driver   : nvidia-driver-390 - distro non-free
driver   : nvidia-driver-450-server - distro non-free
driver   : nvidia-driver-418-server - distro non-free
driver   : nvidia-driver-525-server - distro non-free
driver   : nvidia-driver-515 - distro non-free
driver   : nvidia-driver-470-server - distro non-free
driver   : nvidia-driver-510 - distro non-free
driver   : nvidia-driver-515-server - distro non-free
driver   : nvidia-driver-525 - distro non-free recommended
driver   : nvidia-driver-470 - distro non-free
driver   : xserver-xorg-video-nouveau - distro freebuiltin

选择后面有recommend 的驱动

# 安装显卡sudoapt-getinstall nvidia-driver-525

或者

Win+A

打开 APP的

Additional Driver

在这里插入图片描述选择第一个推荐的

nvidia-driver-525

,然后点击

Applying Changes

在这里插入图片描述开始安装下载,安装完成后重启电脑

Nvidia官方地址 https://www.nvidia.cn/

使用nvidia-smi命令查看GPU情况

nvida-smi
# 更多 https://blog.csdn.net/youlinhuanyan/article/details/12873409

配置nvidia

# 启动nvida配置窗口
nvidia-settings

在这里插入图片描述可通过

prime-select

命令设置使用nvidia独显

sudo prime-select nvidia # 其他选项 nvidia | no-demand | intel

其他查看

glxinfo
$ glxinfo -B
name of display: :1
display: :1  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel Open Source Technology Center (0x8086)
    Device: Mesa DRI Intel(R) HD Graphics 4600(HSW GT2)(0x416)
    Version: 21.2.6
    Accelerated: yes
    Video memory: 1536MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.5
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 4600(HSW GT2)
OpenGL core profile version string: 4.5(Core Profile) Mesa 21.2.6
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.0 Mesa 21.2.6
OpenGL shading language version string: 1.30
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.1 Mesa 21.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

(待续)

标签: ubuntu nvidia GPU

本文转载自: https://blog.csdn.net/youlinhuanyan/article/details/128736599
版权归原作者 丰色木夕 所有, 如有侵权,请联系我们删除。

“Ubuntu20.04下安装显卡驱动”的评论:

还没有评论