Intel
Intel是适用于Intel板载显卡、Intel集成显卡和 Intel Arc独立显卡的开源图形驱动程序,从Intel 810开始支持。
硬件检测
想要选择正确的驱动程序,首先需要检测显卡。为此请用lspci :
root #
lspci | grep -i VGA
输出应该看起来像这样:
root #
lspci | grep -i VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
lspci对于“graphics controller”(“显示控制器”)的输出也许会反应CPU代数,而下文的功能支持表格则反应GPU代数。例如:在lspci输出示例中的“3rd Gen”实际对应下面表格中的“Gen7”。
功能支持
代数 | 芯片 | OpenGL | OpenGL ES | OpenCL | VAAPI | Vulkan | VIDEO_CARDS |
---|---|---|---|---|---|---|---|
Gen 1 | 810, 815 | No | No | No | No | No | 不支持 |
Gen 2 | i830M, 845G, 855GM, 865G | 1.3 | No | No | No | No | intel i915[table 1] |
Gen 3 | 915G/GM, 945G/GM, G31, G/Q33, Q35, Atom D4xx/D5xx/N4xx/N5xx | 1.4 | No | 1.2[table 2] | No | No | intel i915[table 1] |
Gen 4 | 965G/GM/Q, G35, G41, G/Q43, G/GM/Q45 | 2.1 | 2.0 | 1.2[table 2] | G/GM45芯片仅限MPEG2 | No | intel |
Gen 5 | Nehalem (Ironlake) | 2.1 | 2.0 | 1.2[table 2] | Yes | No | intel |
Gen 6 | Sandy Bridge | 3.3 | 3.0 | 2.0[table 2] | Yes | No | intel |
Gen 7 | Ivy Bridge, Valley View[table 3] | 4.2 | 3.0 | 2.0[table 4] | Yes | 1.0 | intel |
Gen 7.5 | Haswell | 4.6 | 3.2 | 2.0[table 4] | Yes | 1.0 | intel |
Gen 8 | Broadwell, Cherryview[table 5] | 4.6 | 3.2 | 3.0[table 6] | Yes | 1.1 | intel |
Gen 9 | Skylake, Broxton[table 7] | 4.6 | 3.2 | 3.0[table 6] | Yes | 1.2 | intel |
Gen 9.5 | Kaby Lake, Coffee Lake | 4.6 | 3.2 | 3.0[table 6] | Yes | 1.2 | intel |
Gen 11 | Ice Lake | 4.6 | 3.2 | 3.0[table 6] | Yes | 1.2 | intel |
Gen 12 | Tiger Lake, Alder Lake, Raptor Lake | 4.6 | 3.2 | 3.0[table 6] | Yes | 1.2 | intel |
DG2 | Alchemist | 4.6 | 3.2 | 3.0[table 6] | Yes | 1.3 | intel[table 8] |
- ↑ 1.0 1.1 Mesa 22.0和更高的版本移除了对i915传统驱动的支持。
- ↑ 2.0 2.1 2.2 2.3 曾经被Beignet项目支持,但现在已被弃用并且不再维护。
- ↑ Valley View是与Silvermont微架构相关的图形核心名称。(用于 Bay Trail 等平台)
- ↑ 4.0 4.1 曾经由专有的Intel传统OpenCL驱动支持,但这些驱动程序现在已不再维护。
- ↑ Cherryview是与Airmont 微架构相关的图形核心名称。(用于 Braswell, Cherry Trail 等平台)
- ↑ 6.0 6.1 6.2 6.3 6.4 6.5 由dev-libs/intel-compute-runtime支持
- ↑ Broxton是与Goldmont 微架构相关的图形核心名称。(用于 Apollo Lake 等平台)
- ↑ 要求内核版本高于6.0.0且Mesa版本高于22.2
完整的Intel CPU的显示核心参数可以在这里被找到。
安装
固件
使用Skylake, Broxton或更新的Intel显卡的系统将会需要sys-kernel/linux-firmware软件包中的额外的固件[1]。
root #
emerge --ask sys-kernel/linux-firmware
否则,dmesg可能会出现以下错误:
kernel: i915 0000:00:02.0: Direct firmware load for i915/skl_dmc_ver1_27.bin failed with error -2 kernel: i915 0000:00:02.0: Failed to load DMC firmware [https://01.org/linuxgraphics/intel-linux-graphics-firmwares], disabling runtime power management.
DMC固件
DMC(“显示微控制器”,Display Microcontroller)固件提供对“高级图形低功耗空闲状态”的支持。[1]
为了将DMC固件构建进内核二进制文件(在这个例子中是i915/skl_dmc_ver1_27.bin):
Device Drivers --->
Generic Driver Options --->
-*- Userspace firmware loading support
[*] Include in-kernel firmware blobs in kernel binary
(i915/skl_dmc_ver1_27.bin) External firmware blobs to build into the kernel binary
(/lib/firmware) Firmware blobs root directory
Device Drivers --->
Generic Driver Options --->
Firmware loader --->
-*- Firmware loading facility
(i915/skl_dmc_ver1_27.bin) Build named firmware blobs into the kernel binary
(/lib/firmware) Firmware blobs root directory
或者将i915驱动程序编译为内核模块,它将自动从文件系统加载固件。
GuC/HuC固件
显示微控制器(Graphics µController)固件从主机驱动程序中卸载功能。HEVC微控制器(HEVC/H.265 µController)固件可以改进媒体硬件加速解码功能。[1]
对于Gen11和更新的GPU,GuC和HuC固件从Linux内核5.4起自动加载(参见这个提交)。
对于Gen9和Gen9.5 GPU,GuC和HuC固件默认不会加载。可以通过内核参数i915.enable_guc_loading=1
(对于比4.16老的Linux内核)或内核参数i915.enable_guc=3
(对于Linux内核4.16或更新)。AVC/HEVC/VP9 低功耗编码比特率控制需要 HuC 固件(以及依赖的 GuC),包括 CBR、VBR 等。启用 GuC/HuC 固件加载会导致某些系统出现问题。如果系统(从休眠恢复时或其他情况)发生死机,请禁用它。
Gen 12+ 的 GuC 固件现在仅使用主要版本号,例如 tgl_guc_70.bin[2] 而 HuC 固件没有版本号,例如 tgl_huc.bin[3]。
要识别固件文件名,请检查/var/log/kern.log
:
kernel: [ 1.294069] [drm] GuC: Failed to fetch firmware i915/kbl_guc_ver9_33.bin (error -2)
kernel: [ 1.294079] [drm] HuC: Failed to fetch firmware i915/kbl_huc_ver01_07_1398.bin (error -2)
或者在内核源代码树中通过 grep 命令搜索 “MODULE_FIRMWARE”:
user $
grep -rB1 'MODULE_FIRMWARE.*SKL' /usr/src/linux/drivers/gpu/drm/i915
/usr/src/linux/drivers/gpu/drm/i915/intel_guc_fw.c-#define I915_SKL_GUC_UCODE GUC_FW_PATH(skl, SKL_FW_MAJOR, SKL_FW_MINOR) /usr/src/linux/drivers/gpu/drm/i915/intel_guc_fw.c:MODULE_FIRMWARE(I915_SKL_GUC_UCODE); -- /usr/src/linux/drivers/gpu/drm/i915/intel_csr.c-#define I915_CSR_SKL "i915/skl_dmc_ver1_27.bin" /usr/src/linux/drivers/gpu/drm/i915/intel_csr.c:MODULE_FIRMWARE(I915_CSR_SKL); -- /usr/src/linux/drivers/gpu/drm/i915/intel_huc_fw.c- SKL_HUC_FW_MINOR, SKL_BLD_NUM) /usr/src/linux/drivers/gpu/drm/i915/intel_huc_fw.c:MODULE_FIRMWARE(I915_SKL_HUC_UCODE);
然后配置以将固件文件构建到内核中,如上所述。
内核
从内核 3.14.14 开始,至少对于 i915 (CONFIG_DRM_I915_FBDEV=y
) 来说,需要传统的 fbdev 支持。[4][5]
对于英特尔 / AMD 混合系统,也请遵循 radeon 驱动程序的步骤。
从内核版本 4.4 开始,驱动程序已移迁移,旧版 fbdev 支持现在改为了 CONFIG_DRM_FBDEV_EMULATION=y
。
Device Drivers --->
Graphics support --->
<*> /dev/agpgart (AGP Support) --->
--- /dev/agpgart (AGP Support)
-*- Intel 440LX/BX/GX, I8xx and E7x05 chipset support
<*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
--- Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
[*] Enable legacy fbdev support for your modesetting driver
<*> Intel 8xx/9xx/G3x/G4x/HD Graphics
[ ] Enable alpha quality support for new Intel hardware by default
() Force probe driver for selected new Intel hardware
[*] Enable capturing GPU state following a hang
[*] Compress GPU error state
[*] Always enable userptr support
[ ] Enable Intel GVT-g graphics virtualization host support
[*] IOMMU Hardware Support --->
[*] Support for Intel IOMMU using DMA Remapping Devices
[*] Enable Intel DMA Remapping Devices by default
建议将内核版本 4.19 或更高版本用于基于Coffee Lake处理器,因为它可以在不启用 Alpha 支持的情况下工作。内核 4.14 需要用 alpha_support=1 加载模块 i915 或在内核配置中启用 CONFIG_DRM_I915_ALPHA_SUPPORT。
对于 DG2 成功加载 HuC固件 需要 Intel PXP 支持和 Intel 管理引擎接口(Intel Management Engine Interface)。[6]
Device Drivers --->
Graphics support --->
[*] Enable Intel PXP support
Misc devices --->
{*} Intel Management Engine Interface
{*} ME Enabled Intel Chipsets
<*> Intel MEI GSC embedded device
<*> Intel PXP services of ME Interface
X11 驱动程序
Portage 使用 VIDEO_CARDS 变量,该变量扩展为 USE_EXPAND 变量,用于支持各种显卡。假设 x11-base/xorg-drivers 包已经安装,在 /etc/portage/make.conf中设置VIDEO_CARDS变量将拉入正确的视频驱动程序:
VIDEO_CARDS="intel i915"
VIDEO_CARDS="intel"
从 x11-base/xorg-drivers-21.1 开始,x11-base/xorg-drivers 软件包更改了 USE flag 设置。默认情况下,这将省略对弃用的 x11-drivers/xf86-video-intel 驱动程序的选择,转而使用 x11-base/xorg-server 中内置的更维护的通用模式设置 DDX 驱动程序。设置了 video_cards_i915 USE 标志的旧系统将继续安装 Intel DDX 驱动程序。
编辑 make.conf 后,通过将 --changed-use --deep
选项传递给 emerge 来更新系统,使更改生效:
root #
emerge --ask --changed-use --deep @world
那些不想接受主存储库中 Intel 图形驱动程序默认值的人可以继续阅读下面的小节。
Intel DDX
在继续使用 Intel DDX driver 之前,请注意该驱动程序已经“慢慢弃用”好几年了。其他主要[7] [8] Linux 发行版已切换到 modesetting DDX driver (详见 the section below)。Intel 已经有很长一段时间没有更新了它[9],这给 Gentoo 的 X11 包维护者带来了负担。
Intel DDX 驱动程序可能比 Gen11 之前芯片组上的通用模式设置驱动程序更快,因为它能够使用 SNA 与这些芯片的硬件加速更紧密地交互。在 Gen11 及更高版本上,不支持 SNA。[10]除非遇到由 modesetting 驱动程序引起的具体问题,否则不建议使用它。
USE标志
检查x11-drivers/xf86-video-intel的USE标志:
USE flags for x11-drivers/xf86-video-intel X.Org driver for Intel cards
+sna
|
Enable SandyBridge's New Acceleration (useful on all chipsets, not just SandyBridge) |
+udev
|
Enable virtual/udev integration (device discovery, power and storage device support, etc) |
debug
|
Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces |
dri
|
Enable direct rendering: used for accelerated 3D and some 2D, like DMA |
tools
|
Build the intel-virtual-output tool |
uxa
|
Enable UMA Acceleration Architecture |
valgrind
|
Enable annotations for accuracy. May slow down runtime slightly. Safe to use even if not currently using dev-debug/valgrind |
xvmc
|
Enables X-Video Motion Compensation support |
Emerge
root #
emerge --ask x11-drivers/xf86-video-intel
xorg.conf
要强制 Xorg 服务器使用带有 SNA 的Intel DDX 驱动程序以实现硬件加速,可以在/etc/X11/xorg.conf.d/路径下创建以下文件:
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "sna"
Option "DRI" "crocus"
EndSection
DRI 选项的值应为第 4 代到第 7.5 代的 crocus
,以及第 8 代及更高版本的 iris
。 第 2 代和第 3 代应省略此行。
Modesetting DDX(模式设置DDX)
如上所述,模式设置 DDX 驱动程序现在是 Gentoo 的较新 Intel 图形芯片组的默认驱动程序。此驱动程序使用 GLAMOR 在 Mesa(开源 OpenGL 实现)上加速 2D 图形。从 x11-base/xorg-drivers-1.19
开始,这已成为 Gentoo 的默认设置。
从 xorg-server/xorg-server-1.20.6
开始,除非启用了 minimal USE 标志,否则将启用 GLAMOR 支持。无需其他步骤或配置。
xorg.conf
如果需要强制 Xorg 加载模式设置驱动程序,可以使用以下配置片段:
Section "Device"
Identifier "Intel Graphics"
Driver "modesetting"
Option "AccelMethod" "glamor"
Option "DRI" "3"
EndSection
如果在 /etc/X11/xorg.conf.d/ 中同时定义了 20-intel.conf 和 20-modesetting.conf 文件,X 服务器将尝试按字母数字顺序加载文件。
屏幕撕裂
默认情况下,TearFree
选项未启用(因为它会增加 GPU 内存消耗等)。如果遇到屏幕撕裂,您可以创建配置文件并手动启用它:
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"
EndSection
其他防止屏幕撕裂的选项:
Enable early KMS
To enable Kernel Mode Setting (KMS) as soon as possible, modesetting either needs to be built into the kernel, or be loaded with initramfs if it is built as a module. Distribution Kernels have the Modesetting DDX built as a module. So, in order to get early KMS, those who use it have to create a .conf file in /etc/dracut.conf.d and do the following:
add_drivers+=" i915 "
然后运行:
root #
dracut
Users of gentoo-kernel can also use savedconfig to change modesetting from module to built-in.
VAAPI
Intel GMA X4500HD / G45 / GM45 (late Gen 4) and newer supports VAAPI hardware video acceleration with package media-libs/libva-intel-driver.
root #
emerge -a media-libs/libva-intel-driver
Newer Intel graphics since Gen 8 (Broadwell) have better support with media-libs/libva-intel-media-driver.
root #
emerge -a media-libs/libva-intel-media-driver
Vulkan
Vulkan is supported in the main ebuild repository for Intel Core processors using the Mesa driver[11].
This will build a working Vulkan driver, but it will not provide a libvulkan.so.1, but a drivers-specific libvulkan_intel.so. The package media-libs/vulkan-loader provides libvulkan.so.1.
If libvulkan_intel.so is missing, then you need to compile media-libs/mesa with the vulkan USE flag.
工具
x11-apps/igt-gpu-tools提供用于调试的实用程序。
例如,GPU 的 最小/最大/当前 频率可通过以下命令来获取:
root #
intel_gpu_frequency
The intel_gpu_top utility displays the current GPU state in a top-like fashion:
root #
intel_gpu_top
intel-gpu-top: Intel Ivybridge (Gen7) @ /dev/dri/card0 437/ 441 MHz; 57% RC6; 0.70/12.20 W; 45 irqs/s IMC reads: 2 MiB/s IMC writes: 618 MiB/s ENGINES BUSY MI_SEMA MI_WAIT Render/3D 8.99% |██ | 0% 0% Blitter 0.00% | | 0% 0% Video 0.00% | | 0% 0%
Video BUSY on 0% means that hardware decoding/encoding is not used.
配置
内核
Fastboot
The i915 kernel driver reduces flickering caused by modesetting operations during boot time. It does so by avoiding unnecessary modesetting operations [12]. Fastboot is enabled by default on Skylake, Valleyview, Cherry Trail, and newer CPUs.
For CPUs older than Skylake, fastboot can be enabled by passing the i915.fastboot=1
parameter to the i915 kernel driver during boot. This can either be set using the built-in kernel command-line or via a bootloader's kernel options. GRUB users can see the /etc/default/grub file.
Permissions
If the acl
USE flag is enabled globally and elogind
is being used (default for desktop profiles) permissions to video cards will be handled automatically. It is possible to check the permissions using getfacl:
user $
getfacl /dev/dri/card0 | grep larry
user:larry:rw-
A broader solution is to add the user(s) needing access the video card to the video group:
root #
gpasswd -a larry video
Note that users will be able to run X without permission to the DRI subsystem, but hardware acceleration will be disabled.
xorg.conf
Choose one of the following configurations.
Classic (Intel DDX) driver x11-drivers/xf86-video-intel:
- The X server is not aware of i915 or i965 they will need to be addressed as Driver
intel
.
Section "Device" Identifier "intel" Driver "intel" EndSection
Gen 4+ driver (Mesa's modesetting):
- 附注
Experiences of this configuration can be found in the Discussion of this page. Add any difficulties there so this section can be improved.
- As of xorg-server-1.17, the modesetting driver was moved into x11-base/xorg-server. This driver has more features than the classic driver, such as the ability to support acceleration via GLAMOR.
- This configuration is the default for
VIDEO_CARDS="intel i965"
beginning with x11-base/xorg-drivers-1.19. If the classic (Intel CCX) driver is desired, then x11-drivers/xf86-video-intel must be installed manually:root #
emerge --ask x11-drivers/xf86-video-intel
- xorg-server is easily configured to prefer
modesetting
over the olderintel
driver.
Section "Device" Identifier "modesetting" Driver "modesetting" EndSection
The X server is designed to work out-of-the-box, with no need to manually edit X.Org's configuration files. It should detect and configure devices such as displays, keyboards, and mice.
In any case, the main configuration file of the X server is the xorg.conf.
故障排除
- Gentoo bugtracker: known bugs
- Freedesktop.org bugtracker: known bugs
- Freedesktop.org bugtracker: known bugs
- The modesetting DDX might cause video out of sync artefacts (when scrolling, or on videos) (see [1]). If the system experiences such artefacts, try the DDX driver.
屏幕闪烁
Panel Self Refresh (PSR), a power saving feature used by Intel iGPUs, causes flickering in some instances. A temporary solution is to disable this feature using the kernel parameter i915.enable_psr=0
KDE Plasma 占用大量 CPU
If /usr/bin/plasmashell is always consuming several percent of CPU, perhaps this is related to a vsync problem. Qt Quick Animation seems to loop too fast when the driver does not manage vsync (Reference).
A way to enable vsync with SNA is to enable the TearFree
option in xorg.conf:
Section "Device"
Identifier "Device0"
Driver "intel"
Option "AccelMethod" "SNA"
Option "TearFree" "true"
EndSection
See also this Linux Mint tutorial.
黑屏
CONFIG_FRAMEBUFFER_CONSOLE must be set to "y" (i.e. built-in to the kernel). Otherwise, it is possible to always have a black screen unless nomodeset
is passed to the kernel, thus disabling kernel mode setting (KMS). acpi_osi="Linux"
can be passed to the kernel command line to try to solve this issue. This is usually done through the bootloader.
Kernel with version 4.2 or newer is needed with some 8th generation chipsets[13].
键盘亮度快捷键无法控制屏幕亮度
First, make sure vendor compatibility is on in the kernel configuration: Toshiba for Toshiba, etc.
If it is, or when the brightness buttons are working, the issue is that the kernel can not detect where the brightness control is.
Luckily, this is easy enough to modify, as long as the kernel version is >= 3.13.x and < 4.2.
Add the following argument to the kernel command-line:
video.use_native_backlight=1
On kernels >= 4.2, the video.use_native_backlight option is no longer available.[14] One of the following should be used instead (experiment to see which works on the system):
acpi_backlight=video
acpi_backlight=native
acpi_backlight=vendor
Do the key bindings map to actions viewable in xev? Can the screen brightness be adjusted using xbacklight? You can always do a work around via a keyboard remapping. For LXDE it can be done via:
<keybind key="XF86MonBrightnessUp">
<action name="Execute">
<command>xbacklight +5</command>
</action>
</keybind>
<keybind key="XF86MonBrightnessDown">
<action name="Execute">
<command>xbacklight -5</command>
</action>
</keybind>
With the Modesetting DDX, the x11-apps/xbacklight package will not work[15]. Use sys-power/acpilight for a compatible interface.
另请参阅
- Xorg/Guide — 解释了什么是Xorg,如何安装它,以及各种配置选项。
- Hprofile — an application that can be used to manage multiple profiles be it hardware or software.
外部资源
- https://www.x.org/wiki/IntelGraphicsDriver/ - Intel at the X.Org wiki.
- https://keyj.emphy.de/files/linuxgraphics_en.pdf - Linux Graphics Demystified.
参照
- ↑ 1.0 1.1 1.2 固件Intel,在2018年10月27日发布。
- ↑ https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/i915?id=067440c18f220ee03121b7e4c3615fe7e1f3f67a
- ↑ https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=51fff4e69b4554dd3fee21e3c55a0f94937293e3
- ↑ Gentoo 论坛,“内核升级后启动时出现黑屏 - grub2”
- ↑ Gentoo 论坛,“内核 3.14.14 黑屏”
- ↑ https://gitlab.freedesktop.org/drm/intel/-/issues/7732#note_1708266
- ↑ https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/AUPYPJMFJZMHPEKN24LBABZKIEOV4NU5/
- ↑ https://tjaalton.wordpress.com/2016/07/23/intel-graphics-gen4-and-newer-now-defaults-to-modesetting-driver-on-x/
- ↑ https://cgit.freedesktop.org/xorg/driver/xf86-video-intel/log/
- ↑ https://gitlab.freedesktop.org/drm/intel/-/issues/1864
- ↑ https://bugs.gentoo.org/show_bug.cgi?id=580148#c25
- ↑ [Intel-gfx] [RFC] fastboot, freedesktop.org. Retrieved on February 9, 2019
- ↑ Gentoo Forums, "N3700 8086:22b1 i915 black screen, works in kernel 4.2.6"
- ↑ RedHat Bug 1272633: "video.use_native_backlight=1 doesn't work" (comment 5)
- ↑ Freedesktop Bug 96572: "xbacklight doesn't work with modesetting on intel"