配置显卡

This page is a translated version of the page Configure Graphics Cards and the translation is 28% complete.
Other languages:
English • ‎русский • ‎中文(中国大陆)‎

简介

Template:注意

在安装Manjaro完整版的时候(比如包含一个预安装的桌面环境、编解码器和软件应用),系统的GUI和CLI安装程序会自动调用mhwd来检测你的显卡并安装最合适的驱动。至于是安装开源版本的驱动还是非开源版本,取决于你在安装程序启动时选择的是开源显卡还是非开源悬卡启动。 否则,如果安装的是极简NET-Edition版的Manjaro,就有必要在安装后手动运行mhwd命令。

对于新手,推荐使用Manjaro 设置管理器中的 "硬件检测" 来更换或安装新的显卡驱动。
对于中等或高级用户,任何时候都可以使用mhwd命令来安装、重装或删除已安装的显卡驱动,如下文所述。

自动识别与安装

这是推荐的方式来进行显卡驱动的检测与安装。自动安装命令的语法如下:

user $ sudo mhwd -a [pci or usb connection] [free or nonfree drivers] 0300 COPY TO CLIPBOARD

上述命令中,各参数含义为:

  • -a: 自动检测并安装合适的驱动
  • [pci 或 usb]: 安装通过pci或usb方式连接的显卡驱动,通常pci连接的显卡在设备内部,而usb连接的属于外接显卡(再次提醒, mhwd目前仅支持pci连接的显卡)
  • [free 或 nonfree]: 安装开源驱动 (比如由Linux社区提供的版本), or 闭源驱动 (比如由硬件制造商提供的版本)
  • 0300: 表示要安装的是显卡的驱动 (0300 是显卡的ID. 随着mhwd命令工具的发展,其他新的ID将会用于表示其他硬件设备).


例如,下面的命令将会为通过pci方式连接的显卡自动检测并安装最合适的闭源驱动

user $ sudo mhwd -a pci nonfree 0300 COPY TO CLIPBOARD


或者,下面的命令将会为通过pci方式连接的显卡自动检测而并安装最合适的开源驱动

user $ sudo mhwd -a pci free 0300 COPY TO CLIPBOARD

手动识别并安装

手动安装需要相对简单、直接地操作mhwd命令。分为两个阶段:

1. 找到合适的驱动进行安装,然后

2. 安装该驱动

Template:提示


查找可用驱动

在手动安装显卡驱动之前,需要确认目前有哪些驱动可选。通过如下命令可列出当前可用的驱动:

user $ mhwd -l [optional: detailed view] [optional: --pci or --usb connection] COPY TO CLIPBOARD

不加额外选项运行这个命令,将会列出适用于你系统的所有驱动的基本信息。所有显卡驱动的名称都有共同的前缀 (video-) 。列出的驱动基本信息格式如下:

  • 名称
  • 版本
  • 开源还是闭源
  • 连接方式为PCI 还是 USB


通过如下命令可获取已安装驱动的详细信息:

user $ mhwd -l -d COPY TO CLIPBOARD

信息格式如下:

  • 名称
  • 版本
  • PCI 或 USB 连接
  • 描述
  • Priority
  • 开源或闭源
  • 依赖
  • 冲突
  • 类别ID (比如 '0300' 是显卡设备的ID)
  • Vendor ID


此外,添加 --pci 选项将会仅列出通过内部PCI方式连接的设备驱动(比如显卡)的详细信息:

user $ mhwd -l -d --pci COPY TO CLIPBOARD

安装驱动

安装显卡驱动的命令语法如下:

user $ sudo mhwd -i pci [name of driver] COPY TO CLIPBOARD


命令参数:

  • -i: 安装驱动
  • [pci]: 安装通过内部pci方式连接的设备驱动 (比如显卡)
  • [name of driver]: 要安装的驱动名称

例如,要安装nvidia显卡的闭源驱动,可使用如下命令:

user $ sudo mhwd -i pci video-nvidia COPY TO CLIPBOARD

强制重新安装驱动

Warning
use this command with care!

不先删除,直接强制重新安装驱动:

user $ sudo mhwd -f -i pci [name of driver] COPY TO CLIPBOARD

例如,如下命令可强制重新安装nvidia显卡驱动:

user $ sudo mhwd -f -i pci video-nvidia COPY TO CLIPBOARD

删除已安装的驱动

有时可能会需要删除已安装的显卡驱动。类似于手动安装驱动,删除也需要两步:

1. 找到安装的驱动

2. 删除它

毕竟如果你不知道要删除哪个驱动,想删除还是有点困难的!


找到安装的驱动

要查找并列出Manjaro已安装的驱动 - 包括你要删除的那个,语法如下:

user $ mhwd -li [optional: detailed view] [optional: pci or usb devices only] COPY TO CLIPBOARD

不添加额外选项,此i命令将会列出你的系统之欧冠所有已安装驱动的基本信息。再次提醒,所有显卡驱动名称中都会有前缀(video-)。通过-d选项可以列出驱动的详细信息:

user $ mhwd -li -d COPY TO CLIPBOARD

This information may prove useful to determine any otherwise unforeseen consequences or problems upon removing a driver. And again, it is also possible to filter your list of installed drivers by whether they are used on hardware connected via pci or usb. In this instance, a detailed list will be generated only for installed drivers used on hardware with a PCI connection:

user $ mhwd -li -d --pci COPY TO CLIPBOARD

One other way of reporting drivers installed andin use is using the inxi tool.

user $ inxi -G COPY TO CLIPBOARD

Note
The mhwd profile 'video-linux' corresponds to the latest opensource driver availablefor your hardware.
Note
The mhwd profile 'video-vesa' is a generic fallback driver which should not be used in the vast majority of cases.

Removing Installed Drivers

Warning
use this command with care!

To remove an installed driver, the syntax is:

user $ sudo mhwd -r [pci or usb] [name of driver] COPY TO CLIPBOARD

For example, to remove the installed driver for a nvidia graphics card (connected internally via pci), the following command would be used:

user $ sudo mhwd -r pci video-nvidia COPY TO CLIPBOARD

Checking configuration

You can check configuration with:

user $ sudo mhwd-gpu --check COPY TO CLIPBOARD

user $ mhwd-gpu --status COPY TO CLIPBOARD


And if needed fix issues with:

user $ sudo mhwd-gpu --setmod COPY TO CLIPBOARD

user $ sudo mhwd-gpu --setxorg [PATH] COPY TO CLIPBOARD


Make sure the path to xorg config file is valid.

Note about ati, xorg file and login artifacts or kicad: if you get artifacts upon logging in or if kicad rendering and zooming is slow, try adding [Option "EXAPixmaps" "off"] in the "Device" section of xorg config file. See here.

Dual GPU

PRIME GPU offloading

If your hardware includes more than one GPU card you can make use of PRIME offloading. PRIME is a technology used to manage hybrid graphics found on recent desktops and laptops (Optimus for NVIDIA, AMD Dynamic Switchable Graphics for Radeon). PRIME detects both cards and automatically selects Intel card by default; using the more powerful discrete graphics card, when called, for more demanding applications.

In Manjaro this will automatically be available for hybrid graphics systems using intel/modesetting for the integrated card and free drivers (AMDGPU or Nouveau) for the dGPU.

You may choose to run a program with a specific GPU, prepending the application's command with DRI_PRIME=x, where x is the card priority number.

For example, to run an application using the second card prepend the application command with DRI_PRIME=1

user $ DRI_PRIME=1 glxspheres64 COPY TO CLIPBOARD

To use the 1st card (usually when the CPU has an embedded GPU, this is used)

user $ DRI_PRIME=0 glxspheres64 COPY TO CLIPBOARD

If you want to always run some application with the discrete gpu, you may copy that application's .desktop file to ~/.local/share/applications/ and edit the "Exec" property

user $ Exec=DRI_PRIME=1 inkscape COPY TO CLIPBOARD

Some applications (usually games like steam) may have an embedded option to specify the command line, where it is preferred to use this way.

For example, in Steam, select a game - that you want to run using your discrete Nvidia card - from the Library page of the Steam client, right-click, and select Properties. Click the SET LAUNCH OPTIONS... button and specify for the command line options followed by the default launch hook %command%.

DRI_PRIME=1 %command%

To use the dGPU by default see Reverse Prime

NVIDIA Proprietary (non-free) drivers

If you have a Nvidia card, you have the option to use the proprietary (closed source = non-free) drivers instead of the open source (free) nouveau driver.

For Legacy/older nvidia cards, Manjaro maintains older drivers for compatibility. In these cases the driver name is different, instead of nvidia it is nvidia-390xx or nvidia340xx, whether in nvidia-only or bumblebee mhwd driver configuration.

When you install the non-free driver, mhwd includes a Nvidia utility "Nvidia Settings Utility" that can help you configure several settings. You can find this utility in your GUI Applications Menu or start it from a terminal

user $ sudo nvidia-settings COPY TO CLIPBOARD

If you are using bumblebee, the nvidia utility needs a special command

user $ sudo optirun -b none nvidia-settings -c :8 COPY TO CLIPBOARD

Nvidia Optimus

For Optimus laptops or dual GPU hardware with intel and nvidia GPUs, you have three options to utilize the card driver usage at your preference or your hardware capabilities.

PRIME (mhwd default)

When you install Manjaro with the non-free option selected from Grub menu, or when you use automatic driver installation, PRIME or bumblebee is installed by default, depending on support for your GPU, PRIME being preferred. In these cases, the mhwd driver is named "video-hybrid-intel-nvidia-***xx-prime" or "video-hybrid-intel-nvidia-***xx-bumblebee".

Configure The Resolution/Refresh Rate

Warning
The method provided does not currently work for the Cinnamon Edition. As soon as a solution is found, then this article will be updated.


1. Start nvidia-settings utility

2. Change resolution and refresh rate in 'X Server Display Configuration' tab.

3. Hit the 'Save to X Configuration File' button and save to /etc/X11/mhwd.d/nvidia.conf

4. Now start your terminal and enter the following command to complete the process:

user $ sudo mhwd-gpu --setmod nvidia --setxorg /etc/X11/mhwd.d/nvidia.conf COPY TO CLIPBOARD

Configure X Screen settings (OpenGL Settings, Antialiasing, X Server XVideo)


1. Start nvidia-settings utility

2. Change settings in X Server XVideo Settings, OpenGL and Antialiasing, in the 'X Screen' tab.

3. Click on 'nvidia-settings configuration' tab and click on the 'Save Current Configuration' button.

4. Save the .nvidia-settings-rc to the default location specified (/home/[your account name])

5. Edit the .xinitrc file with your preferred text editor. For example, if you use gedit, run this in your terminal:

user $ gedit ~/.xinitrc COPY TO CLIPBOARD

6. Once opened, add the following line into the configuration file:

user $ exec nvidia-settings --load-config-only COPY TO CLIPBOARD

7. Save and exit.

Nvidia settings for special cases

In case your monitor is not entering powersave mode (DPMS), try adding `Option "HardDPMS" "true"` in your Xorg monitor section. For example:

Section "Monitor"

    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "BenQ ZOWIE XL LCD"
    HorizSync       30.0 - 160.0
    VertRefresh     56.0 - 144.0
    Option         "DPMS"
    Option         "HardDPMS" "true"
  EndSection


After forum issue


nvidia-prime

Manjaro also offers an easy way to use PRIME with proprietary Nvidia drivers.
Simply select and install an 'nvidia-prime' profile through MSM or mhwd (such as video-hybrid-intel-nvidia-440xx-prime) and ensure the package nvidia-prime is installed.

Then to use the discrete Nvidia card it works the same as PRIME offloading above but uses a different command. Prepend the application command with prime-run. For example:

user $ prime-run glxspheres64 COPY TO CLIPBOARD

Bumblebee

Bumblebee configuration is mainly developed to help minimize laptop battery consumption, since Nvidia usually consumes significant power, while Intel cards are more power efficient. So, bumblebee detects both cards and automatically selects Intel card by default and can use the Nvidia for more demanding applications. For an application to use the Nvidia card, prepend the application command with optirun or primusrun. For example:

user $ optirun glxspheres64 COPY TO CLIPBOARD

user $ primusrun inkscape COPY TO CLIPBOARD


If you want to specifically run some application with the nvidia driver, you may edit that application's .desktop file "Exec" property, or run it in terminal like this

Exec=primusrun chromium

Some applications (usually games like steam) may have an embedded option to specify the command line, where it is preferred to use this way.

For example, in Steam, select a game - that you want to run using your discrete Nvidia card - from the Library page of the Steam client, right-click, and select Properties. Click the SET LAUNCH OPTIONS... button and specify for the command line options followed by the default launch hook %command%.

primusrun %command%


See also


Easier way

You may use a GUI version of mhwd in Manjaro Settings Manager#Hardware Detection

With this tool you can:
- install graphic driver
- switch graphic driver


How to check the driver

user $ glxinfo | grep OpenGL COPY TO CLIPBOARD

Example output command:

Nvidia driver ( proprietary driver )


$ glxinfo | grep OpenGL

OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 660/PCIe/SSE2
OpenGL core profile version string: 4.3.0 NVIDIA 331.49
OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.4.0 NVIDIA 331.49
OpenGL shading language version string: 4.40 NVIDIA via Cg compiler
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:

Nouveau , Gallium from Mesa ( open source driver )


$ glxinfo | grep OpenGL

OpenGL vendor string: nouveau
OpenGL renderer string: Gallium 0.4 on NVE6
OpenGL core profile version string: 3.1 (Core Profile) Mesa 9.2.5
OpenGL core profile shading language version string: 1.40
OpenGL core profile context flags: (none)
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 9.2.5
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:

Intel driver from Mesa ( open driver )


$ glxinfo | grep OpenGL

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Desktop
OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.0.6
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 11.0.6
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.0.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:

Checking vulkan support

OpenGL is a graphics API specification and it has been superseded by the Vulkan api. To check support for Vulkan applications, you can install vulkan-tools and run


$ vkcube

Selected GPU 0: NVIDIA GeForce RTX 3050 Laptop GPU, type: DiscreteGpu

With integrated GPU you can select the GPU:


$ vkcube --gpu_number 0

Selected GPU 0: NVIDIA GeForce RTX 3050 Laptop GPU, type: DiscreteGpu


$ vkcube --gpu_number 1

Selected GPU 1: AMD Radeon Graphics (RADV RENOIR), type: IntegratedGpu

$