查看“︁Linux/显卡”︁的源代码
来自康健生活
←
Linux/显卡
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
[[Linux|返回上一级]] == 检查 == 检测显卡驱动版本 {{shc_out|<syntaxhighlight lang="bash"> lspci | grep -i VGA</syntaxhighlight>|<syntaxhighlight lang="javascript"> 03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 14 [Radeon RX 5500/5500M / Pro 5500M] (rev c5) </syntaxhighlight>|kangjian@kangjian:~/桌面$}} {{shc_out|<syntaxhighlight lang="bash"> lspci | grep -i VGA</syntaxhighlight>|<syntaxhighlight lang="javascript"> 03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 14 [Radeon RX 5500/5500M / Pro 5500M] (rev c5) </syntaxhighlight>|kangjian@kangjian:~/桌面$}} 获取系统上显卡的信息 {{shc_out|<syntaxhighlight lang="bash"> lspci -vnn | grep VGA -A 12</syntaxhighlight>|<syntaxhighlight lang="javascript"> 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 14 [Radeon RX 5500/5500M / Pro 5500M] [1002:7340] (rev c5) (prog-if 00 [VGA controller]) Subsystem: Gigabyte Technology Co., Ltd Navi 14 [Radeon RX 5500/5500M / Pro 5500M] [1458:2319] Flags: bus master, fast devsel, latency 0, IRQ 165 Memory at e0000000 (64-bit, prefetchable) [size=256M] Memory at f0000000 (64-bit, prefetchable) [size=2M] I/O ports at e000 [size=256] Memory at f7a00000 (32-bit, non-prefetchable) [size=512K] Expansion ROM at 000c0000 [disabled] [size=128K] Capabilities: <access denied> Kernel driver in use: amdgpu Kernel modules: amdgpu 03:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 HDMI Audio [1002:ab38] </syntaxhighlight>|kangjian@kangjian:~/桌面$}} 当前驱动 {{shc_out|<syntaxhighlight lang="bash"> lshw -c video | grep configuration</syntaxhighlight>|<syntaxhighlight lang="javascript"> WARNING: you should run this program as super-user. configuration: driver=amdgpu latency=0 WARNING: output may be incomplete or inaccurate, you should run this program as super-user. </syntaxhighlight>|kangjian@kangjian:~/桌面$}} === nvidia GPU === 查看GPU型号 <syntaxhighlight lang="bash"> lspci | grep -i nvidia</syntaxhighlight> 查看驱动版本 <syntaxhighlight lang="bash"> sudo dpkg --list | grep nvidia-*</syntaxhighlight> <syntaxhighlight lang="bash"> ubuntu-drivers devices</syntaxhighlight> 安装 <syntaxhighlight lang="bash"> sudo ubuntu-drivers autoinstall</syntaxhighlight> === amd GPU === 查看GPU型号 {{shc_out|<syntaxhighlight lang="bash"> lspci | grep -i amd </syntaxhighlight>|<syntaxhighlight lang="javascript"> 01:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Upstream Port of PCI Express Switch (rev c5) 02:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Downstream Port of PCI Express Switch 03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 14 [Radeon RX 5500/5500M / Pro 5500M] (rev c5) 03:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 HDMI Audio </syntaxhighlight>|kangjian@kangjian:~/桌面$}} 查看驱动版本 {{shc_out|<syntaxhighlight lang="bash"> sudo dpkg --list | grep amd-* </syntaxhighlight>|<syntaxhighlight lang="javascript"> ii accountsservice 0.6.55-0ubuntu11 amd64 query and manipulate user account information ... ii amd64-microcode 3.20191218.1ubuntu1 amd64 Processor microcode firmware for AMD CPUs ii amdgpu 20.20-1089974 amd64 Meta package to install amdgpu components. ii amdgpu-core 20.20-1089974 all Core meta package for unified amdgpu driver. ii amdgpu-dkms 1:5.6.0.13-1089974 all amdgpu driver in DKMS format. ... ii zip 3.0-11build1 amd64 Archiver for .zip files ii zlib1g:amd64 1:1.2.11.dfsg-2ubuntu1 amd64 compression library - runtime </syntaxhighlight>|kangjian@kangjian:~/桌面$}} ==== 风扇控制 ==== {{shc|<syntaxhighlight lang="bash"> sudo apt-get install git git clone https://github.com/dominilux/amdgpu-pro-fans cd amdgpu-pro-fans chmod +x amdgpu-pro-fans.sh</syntaxhighlight>|kangjian@kangjian-PC:~/apps$}} 使用方法: {{shc|<syntaxhighlight lang="bash"> cd amdgpu-pro-fans</syntaxhighlight>|kangjian@kangjian-PC:~/apps$}} {{shc|<syntaxhighlight lang="bash"> sudo ./amdgpu-pro-fans.sh -s [speed 0 – 100]</syntaxhighlight>|kangjian@kangjian-PC:~/apps/amdgpu-pro-fans$}} 理论: 进入 <code>/sys/class/drm/card0/device/hwmon/hwmon3</code> * To switch to manual fan control from automatic, run *: {{shc|<syntaxhighlight lang="bash"> echo "1" > pwm1_enable</syntaxhighlight>|$}} * Set up fan speed to e.g. 50% (100% are 255 PWM cycles, thus calculate desired fan speed percentage by multiplying its value by 2.55): *: {{shc|<syntaxhighlight lang="bash"> echo "128" > pwm1</syntaxhighlight>|$}} * To reset to automatic fan control, run *: {{shc|<syntaxhighlight lang="bash"> echo "2" > pwm1_enable</syntaxhighlight>|$}} * Warning: Resetting fan speed to auto may not work due to a driver bug and instead a restart of the driver may be required as a workaround. == AMD == * http://support.amd.com/en-us/download * https://amdgpu-install.readthedocs.io/en/latest/index.html === 驱动 === 安装驱动。 {{shc|<syntaxhighlight lang="bash"> ./amdgpu-pro-install -y</syntaxhighlight>|kangkk@kangkk:~/apps/amddri/amdgpu-pro-20.20-1089974-ubuntu-20.04$}} 安装 radeontop 显示 AMD GPU 使用情况 {{shc|<syntaxhighlight lang="bash"> sudo apt install radeontop</syntaxhighlight>|$}} {| class="wikitable" |- |{{shc|<syntaxhighlight lang="bash"> sudo radeontop</syntaxhighlight>|$}} |[[文件:Linux 显卡 amd GPU radeontop 1.png|500px|左|Linux 显卡 amd GPU radeontop 1]] |} 这里可以看到显卡有些不正常,目前还不知道解决办法。 == Nvidia == == 显卡 == 查看显卡 <syntaxhighlight lang="bash"> lspci -nn | grep VGA </syntaxhighlight> <pre> 00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09) 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF108M [GeForce GT 555M] [10de:0deb] (rev a1) 运行powerstat观察电池的放电功率(安装 powerstat : sudo apt install powerstat)。 </pre> <syntaxhighlight lang="bash"> powerstat -d 0 </syntaxhighlight> <pre> Running for 480.0 seconds (48 samples at 10.0 second intervals). Power measurements will start in 0 seconds time. Time User Nice Sys Idle IO Run Ctxt/s IRQ/s Fork Exec Exit Watts 20:46:23 1.3 0.0 0.2 98.5 0.1 1 182 144 1 0 5 2.26 20:46:33 0.0 0.0 0.0 99.9 0.0 1 78 114 0 0 0 2.20 20:46:43 0.2 0.0 0.1 99.7 0.1 1 136 126 0 0 0 2.19 20:46:53 0.1 0.0 0.0 99.9 0.0 1 75 112 0 0 0 2.18 20:47:03 0.3 0.0 0.1 99.6 0.1 1 137 131 0 0 0 2.18 20:47:13 0.1 0.0 0.0 99.9 0.1 1 86 113 0 0 0 2.18 20:47:23 0.2 0.0 0.1 99.7 0.0 1 128 122 0 0 1 2.18 20:47:33 0.1 0.0 0.0 99.9 0.0 1 73 110 0 0 0 2.18 20:47:43 0.2 0.0 0.1 99.7 0.0 1 130 123 0 0 0 2.18 20:47:53 0.1 0.0 0.0 99.9 0.0 1 75 110 0 0 0 2.18 20:48:03 0.2 0.0 0.1 99.7 0.1 1 127 122 0 0 2 2.19 20:48:13 0.0 0.0 0.0 99.9 0.0 1 83 113 1 0 2 2.18 20:48:23 1.1 0.0 0.3 98.6 0.1 1 933 310 2 0 0 2.22 -------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------ Average 0.3 0.0 0.1 99.6 0.0 1.0 172.6 134.7 0.3 0.0 0.8 2.19 StdDev 0.4 0.0 0.1 0.5 0.0 0.0 222.0 51.4 0.6 0.0 1.4 0.02 -------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------ Minimum 0.0 0.0 0.0 98.5 0.0 1.0 73.2 110.0 0.0 0.0 0.0 2.18 Maximum 1.3 0.0 0.3 99.9 0.1 1.0 933.2 309.8 2.0 0.0 5.0 2.26 -------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------ Summary: System: 2.19 Watts on average with standard deviation 0.02 </pre> 查看操作系统的发行版号 <syntaxhighlight lang="bash"> uname -r </syntaxhighlight> <pre> 4.9.0-3-amd64 </pre> 依然查看显卡收集信息 <syntaxhighlight lang="bash"> sudo lspci -knn </syntaxhighlight> <pre> 00:00.0 Host bridge [0600]: Intel Corporation 2nd Generation Core Processor Family DRAM Controller [8086:0104] (rev 09) Subsystem: Lenovo 2nd Generation Core Processor Family DRAM Controller [17aa:3975] 00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port [8086:0101] (rev 09) Kernel driver in use: pcieport Kernel modules: shpchp 00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09) Subsystem: Lenovo 2nd Generation Core Processor Family Integrated Graphics Controller [17aa:3981] Kernel driver in use: i915 Kernel modules: i915 00:16.0 Communication controller [0780]: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 [8086:1c3a] (rev 04) Subsystem: Lenovo 6 Series/C200 Series Chipset Family MEI Controller [17aa:3975] Kernel driver in use: mei_me Kernel modules: mei_me 00:1a.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 [8086:1c2d] (rev 05) Subsystem: Lenovo 6 Series/C200 Series Chipset Family USB Enhanced Host Controller [17aa:3975] Kernel driver in use: ehci-pci Kernel modules: ehci_pci 00:1b.0 Audio device [0403]: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller [8086:1c20] (rev 05) Subsystem: Lenovo 6 Series/C200 Series Chipset Family High Definition Audio Controller [17aa:3975] Kernel driver in use: snd_hda_intel Kernel modules: snd_hda_intel 00:1c.0 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 [8086:1c10] (rev b5) Kernel driver in use: pcieport Kernel modules: shpchp 00:1c.1 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 [8086:1c12] (rev b5) Kernel driver in use: pcieport Kernel modules: shpchp 00:1c.4 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 [8086:1c18] (rev b5) Kernel driver in use: pcieport Kernel modules: shpchp 00:1d.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 [8086:1c26] (rev 05) Subsystem: Lenovo 6 Series/C200 Series Chipset Family USB Enhanced Host Controller [17aa:3975] Kernel driver in use: ehci-pci Kernel modules: ehci_pci 00:1f.0 ISA bridge [0601]: Intel Corporation HM65 Express Chipset Family LPC Controller [8086:1c49] (rev 05) Subsystem: Lenovo HM65 Express Chipset Family LPC Controller [17aa:3975] Kernel driver in use: lpc_ich Kernel modules: lpc_ich 00:1f.2 SATA controller [0106]: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller [8086:1c03] (rev 05) Subsystem: Lenovo 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller [17aa:3975] Kernel driver in use: ahci Kernel modules: ahci 00:1f.3 SMBus [0c05]: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller [8086:1c22] (rev 05) Subsystem: Lenovo 6 Series/C200 Series Chipset Family SMBus Controller [17aa:3975] Kernel driver in use: i801_smbus Kernel modules: i2c_i801 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF108M [GeForce GT 555M] [10de:0deb] (rev a1) Subsystem: Lenovo GF108M [GeForce GT 555M] [17aa:3981] Kernel driver in use: nouveau Kernel modules: nouveau 07:00.0 Ethernet controller [0200]: Broadcom Limited NetLink BCM57781 Gigabit Ethernet PCIe [14e4:16b1] (rev 10) Subsystem: Lenovo NetLink BCM57781 Gigabit Ethernet PCIe [17aa:3975] Kernel driver in use: tg3 Kernel modules: tg3 08:00.0 Network controller [0280]: Intel Corporation Centrino Wireless-N 1000 [Condor Peak] [8086:0084] Subsystem: Intel Corporation Centrino Wireless-N 1000 BGN [8086:1315] Kernel modules: iwlwifi 09:00.0 System peripheral [0880]: JMicron Technology Corp. SD/MMC Host Controller [197b:2392] (rev 30) Subsystem: Lenovo SD/MMC Host Controller [17aa:3976] Kernel driver in use: sdhci-pci Kernel modules: sdhci_pci 09:00.2 SD Host controller [0805]: JMicron Technology Corp. Standard SD Host Controller [197b:2391] (rev 30) Subsystem: Lenovo Standard SD Host Controller [17aa:3976] Kernel modules: sdhci_pci 09:00.3 System peripheral [0880]: JMicron Technology Corp. MS Host Controller [197b:2393] (rev 30) Subsystem: Lenovo MS Host Controller [17aa:3976] Kernel driver in use: jmb38x_ms Kernel modules: jmb38x_ms 09:00.4 System peripheral [0880]: JMicron Technology Corp. xD Host Controller [197b:2394] (rev 30) Subsystem: Lenovo xD Host Controller [17aa:3976] </pre> 查看硬件信息(sudo apt-get install lshw lshw-gtk)。 <syntaxhighlight lang="bash"> sudo lshw -numeric -class video </syntaxhighlight> <pre> *-display description: VGA compatible controller product: GF108M [GeForce GT 555M] [10DE:DEB] vendor: NVIDIA Corporation [10DE] physical id: 0 bus info: pci@0000:01:00.0 version: a1 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress vga_controller bus_master cap_list rom configuration: driver=nouveau latency=0 resources: irq:27 memory:f0000000-f0ffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:2000(size=128) memory:f1000000-f107ffff *-display description: VGA compatible controller product: 2nd Generation Core Processor Family Integrated Graphics Controller [8086:116] vendor: Intel Corporation [8086] physical id: 2 bus info: pci@0000:00:02.0 version: 09 width: 64 bits clock: 33MHz capabilities: msi pm vga_controller bus_master cap_list rom configuration: driver=i915 latency=0 resources: irq:29 memory:f1400000-f17fffff memory:e0000000-efffffff ioport:3000(size=64) memory:c0000-dffff </pre> 以上仅限信息分析,接下来安装BUNBLEBEE 确定系统架构内核 <syntaxhighlight lang="bash"> sudo dpkg --print-architecture </syntaxhighlight> <pre> amd64 </pre> 确认是否打开了多架构支持功能 <syntaxhighlight lang="bash"> sudo dpkg --print-foreign-architectures </syntaxhighlight> <pre> i386 </pre> 安装32位支持 <syntaxhighlight lang="bash"> sudo dpkg --add-architecture i386 sudo apt -get update </syntaxhighlight> 检查已拥有的库文件是否有更新的版本 <syntaxhighlight lang="bash"> sudo apt-get dist-upgrade </syntaxhighlight> 安装bumblebee <syntaxhighlight lang="bash"> sudo apt-get install bumblebee primus primus-libs:i386 </syntaxhighlight> 如果要运行闭源驱动继续下一步,如果想用nouveau开源驱动跳过下一步 <syntaxhighlight lang="bash"> sudo apt-get install bumblebee-nvidia primus </syntaxhighlight> 添加用户组 <syntaxhighlight lang="bash"> sudo adduser $USER bumblebee </syntaxhighlight> 再次查看显卡(末尾rev ff表示已关闭) <syntaxhighlight lang="bash"> lspci -nn | grep VGA </syntaxhighlight> <pre> 00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09) 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF108M [GeForce GT 555M] [10de:0deb] (rev ff) </pre> 再测耗电功率 <syntaxhighlight lang="bash"> powerstat -d 0 </syntaxhighlight> <pre> Running for 480.0 seconds (48 samples at 10.0 second intervals). Power measurements will start in 0 seconds time. Time User Nice Sys Idle IO Run Ctxt/s IRQ/s Watts 13:41:07 0.3 0.0 0.1 99.6 0.0 1 145 68 1.13 13:41:17 0.1 0.0 0.0 99.8 0.1 1 79 51 1.13 13:41:27 0.2 0.0 0.1 99.7 0.1 1 131 60 1.14 13:41:37 0.1 0.0 0.0 99.9 0.0 1 80 52 1.13 13:41:47 0.2 0.0 0.1 99.7 0.1 1 126 58 1.14 ^C-------- ----- ----- ----- ----- ----- ---- ------ ------ ------ Average 0.2 0.0 0.0 99.8 0.0 1.0 112.1 57.9 1.13 StdDev 0.1 0.0 0.0 0.1 0.0 0.0 27.5 6.1 0.00 -------- ----- ----- ----- ----- ----- ---- ------ ------ ------ Minimum 0.1 0.0 0.0 99.6 0.0 1.0 78.8 51.3 1.13 Maximum 0.3 0.0 0.1 99.9 0.1 1.0 145.2 68.1 1.14 -------- ----- ----- ----- ----- ----- ---- ------ ------ ------ Summary: System: 1.13 Watts on average with standard deviation 0.00 </pre> == 温度和风速 == === lm-sensors === <blockquote> <syntaxhighlight lang="as3"> sudo apt-get install lm-sensors</syntaxhighlight></blockquote> {{shc_out|<syntaxhighlight lang="bash"> sensors</syntaxhighlight>|<syntaxhighlight lang="javascript"> coretemp-isa-0000 Adapter: ISA adapter Package id 0: +32.0°C (high = +82.0°C, crit = +100.0°C) Core 0: +32.0°C (high = +82.0°C, crit = +100.0°C) Core 1: +32.0°C (high = +82.0°C, crit = +100.0°C) Core 2: +31.0°C (high = +82.0°C, crit = +100.0°C) Core 3: +31.0°C (high = +82.0°C, crit = +100.0°C) Core 4: +32.0°C (high = +82.0°C, crit = +100.0°C) Core 5: +31.0°C (high = +82.0°C, crit = +100.0°C) acpitz-acpi-0 Adapter: ACPI interface temp1: +27.8°C (crit = +119.0°C) temp2: +29.8°C (crit = +119.0°C) amdgpu-pci-0300 Adapter: PCI adapter vddgfx: 706.00 mV fan1: 0 RPM (min = 0 RPM, max = 3400 RPM) edge: +49.0°C (crit = +113.0°C, hyst = -273.1°C) (emerg = +99.0°C) junction: +51.0°C (crit = +99.0°C, hyst = -273.1°C) (emerg = +99.0°C) mem: +50.0°C (crit = +99.0°C, hyst = -273.1°C) (emerg = +99.0°C) power1: 16.00 W (cap = 125.00 W) </syntaxhighlight>|kangjian@kangjian:~/桌面$}} ==== watch ==== 配合 watch命令,可以每秒执行一次。 {{shc|<syntaxhighlight lang="bash"> watch -n 1 sensors</syntaxhighlight>|kangjian@kangjian:~/桌面$}} === psensor === 图形化的硬件温度传感器的监控工具,基于 Linux 的 lm-sensors 和 GTK 库。 * 显示主板和CPU温度(利用LM-传感器) * 显示NVIDIA GPU(使用XNVCtrl)显卡温度 * 显示硬盘驱动器(使用hddtemp)温度 * 显示风扇(利用LM-传感器)转速 {{shc|<syntaxhighlight lang="bash"> sudo apt-add-repository ppa:jfi/psensor-unstable sudo apt-get update sudo apt-get install psensor</syntaxhighlight>|kangjian@kangjian:~/桌面$}}
此页面嵌入的页面:
模板:Shc
(
查看源代码
)
模板:Shc/style.css
(
查看源代码
)
模板:Shc out
(
查看源代码
)
模板:Shc out/style.css
(
查看源代码
)
返回
Linux/显卡
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。