Intel graphics (简体中文)

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
翻译状态:本文是 Intel_Graphics翻译。上次翻译日期:2016-08-16。如果英文版本有所更改,则您可以帮助同步翻译。

Tango-preferences-desktop-locale-modified.png这篇文章或章节的翻译不反映原文。Tango-preferences-desktop-locale-modified.png

原因:Not updated since 2016(在 Talk:Intel graphics (简体中文)# 中讨论)

由于 Intel 提供和支持 X.Org 开源驱动,Intel 的显卡基本上是即插即用的。

Intel显卡和相应芯片组、cpu的完整型号参考维基百科上的 Intel 显卡处理单元对比

注意:
  • 有些人建议不要安装Intel驱动,而应该使用通用的 modesetting 驱动。 参见 [1][2].
  • 开源驱动不支持基于PowerVR的显卡(GMA 3600 系列)。

安装

安装位于官方软件仓库xf86-video-intel 软件包。它提供了用于2D加速的DDX驱动。并且它依赖于3D加速的DRI驱动 mesa

要启用OpenGL支持, 需要安装 mesa-libgl[损坏的链接:replaced by mesa]。如果你使用的是64位系统并且需要 32 位程序中使用加速功能,还需要安装multilib 仓库中的 lib32-mesa-libglAUR[损坏的链接:replaced by lib32-mesa]

参考 Hardware video acceleration.

Ivy-Bridge以及更新的GPU支持 Vulkan ,要启用这项功能,请安装 vulkan-intel

配置

要运行 Xorg,没有必要做任何形式的配置(不需要xorg.conf,但若有则需要正确配置)。

注意: 一些最新型号的核心显卡(例如Skylake/HD 530)可能需要额外的设置,参见#Skylake 支持[损坏的链接:无效的章节]

然而,为了设定驱动的选项,你可能需要创建一份形式如下的Xorg的配置文件。

/etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
EndSection

其他的一些选项由用户自行添加在Driver下方(每个选项一行)。

注意:
  • 在创建配置文件时,你可能需要指定Option "AccelMethod"(加速方式),哪怕只是将他设定为默认的方式 (现在的默认加速方式为 "sna");否则 X 可能会崩溃。
  • 你可能会需要在配置文件中添加更多的Section "Device"(驱动部分)。在相应的文章中会提示你在何处添加。

查看完整选项列表,在终端中输入intel(4)

加载

英特尔内核模块在系统启动时自动加载. 如果它不启动,请检查:

  • 首先,确认你 没有kernel parameter 中添加 nomodesetvga=选项, 因为Intel显示驱动需要 KMS.
  • 其次,检查你没有把Intel列入 /etc/modprobe.d//usr/lib/modprobe.d/ 中的modprobe的黑名单文件中。

启用 early KMS

Kernel mode setting (KMS)被使用的i915 DRM驱动程序英特尔芯片组所支持,并且默认情况下被强制启用。

要在启动过程的早期启动 KMS,请参考 Kernel mode setting#Early KMS start

基于模块的省电选项

可以通过内核模块选项 配置 i915 内核模块,其中一些选项会对影响省电功能。

通过下面命令可以获得所有支持选项及其简介和默认值

$ modinfo -p i915

要检查目前启用了那些选项:

# systool -m i915 -av

You will note that the i915.powersave option which "enable[s] powersavings, fbc, downclocking, etc." is enabled by default, resulting in per-chip powersaving defaults. It is however possible to configure more aggressive powersaving by using module options.

警告: Diverting from the defaults will mark the kernel as tainted from Linux 3.18 onwards. This basically implies using other options than the per-chip defaults is considered experimental and not supported by the developers.

The following set of options should be generally safe to enable:

/etc/modprobe.d/i915.conf
options i915 enable_rc6=1 enable_fbc=1 lvds_downclock=1 semaphores=1

RC6 sleep modes (enable_rc6)

You can experiment with higher values for enable_rc6, but your GPU may not support them or the activation of the other options [3].

The available enable_rc6 values are a bitmask with bit values RC6=1, RC6p=2, RC6pp=3[4] - where "RC6p" and "RC6pp" are lower power states.

To confirm the current running RC6 level, you can look in sysfs:

# cat /sys/class/drm/card0/power/rc6_enable

... if the value read is a lower number than expected, the other RC6 level are probably not supported. Passing drm.debug=0xe will add DRM debugging information to the kernel log - possibly including a line like this:

[drm:sanitize_rc6_option] Adjusting RC6 mask to 1 (requested 7, valid 1)

帧缓冲压缩 (enable_fbc)

在 Sandy Bridge之前世代的 Intel GPU (第六代)上使用帧缓冲压缩可能会导致 GPU 的不稳定,甚至不可用。这时系统日志里可能会出现类似于下面的消息:

kernel: drm: not enough stolen space for compressed buffer, disabling.

技巧

避免播放视频时屏幕撕裂

若使用 SNA,将下列内容添加到 /etc/X11/xorg.conf.d/20-intel.confDevice 部分可杜绝屏幕撕裂问题。

Option "TearFree" "true"

参见 original bug report 以获取更多信息.

注意:
  • 如果 SwapbuffersWait 被设定为 false,这个选项可能不会生效。
  • 这个选项对一些非常挑剔垂直同步时间的程序会产生很多问题,例如 Super Meat Boy
  • 这个选项对 UXA 的加速方式不起作用,它仅仅作用于 SNA 的加速方式。
  • 当 DRI3 被启用时,这个选项应该是不需要的。

禁用垂直同步 (VSYNC)

/etc/X11/xorg.conf.d/20-intel.confSection "Device" 段添加 Option "SwapbuffersWait" "false" 可禁用 VSYNC.

~/.drirc 中将 vblank_mode 设为 0 并且将 driver 设为 dri2 也可达到上述效果:

~/.drirc
<device screen="0" driver="dri2">
   <application name="Default">
   <option name="vblank_mode" value="0"/>
   </application>
</device>

设置自动缩放模式

在一些全屏应用中此方法适用:

$ xrandr --output LVDS1 --set PANEL_FITTING param

param 可以是:

  • center: 使用自定义分辨率,不缩放;
  • full: 使用全屏;
  • full_aspect: 在长宽比不变的情况下使用最大可用分辨率。

若无效,可尝试:

$ xrandr --output LVDS1 --set "scaling mode" param

param可以是"Full""Center""Full aspect".

KMS 问题: 终端面积很小

在启动阶段,启用了低分辨率的接口会导致终端面积很小。通过i915模块设置可解决此问题,具体在加载器的内核参数添加 video=SVIDEO-1:d。内核参数的更多信息参考 Kernel parameters .

若无效,可试着禁用 TV1 或 VGA1 接口。

在 GMA 4500 硬解 H.264

GMA 4500 平台上,libva-intel-driver 只能硬解 MPEG-2。 H.264 的硬解为另一分支——g45-h264, 在 Arch User Repository 中安装 libva-driver-intel-g45-h264AUR[损坏的链接:package not found] 就OK。 但注意 g45-h264 目前仍处于试验阶段,且开发不活跃。通过 VA-API 会减轻cpu的负载但不如使用非加速方式流畅。 mplayer的测试表明 使用vaapi 播放H.264 编码的 1080p 视频会让cpu的负载减半 (与XV相比) ,但播放很不稳定, 而 720p 则很到位 [5]。其他一些用户也提到这点[6][失效链接 2021-11-11 ⓘ]

设置伽马和亮度

See Backlight.

疑难解答

SNA 问题

xf86-video-intel 现在默认的加速方式为SNA,如果出现图形问题,可以尝试使用使用旧的 UXA 加速方式, 创建包含下列内容的/etc/X11/xorg.conf.d/20-intel.conf 就可使用UXA:

/etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
   Option      "AccelMethod"  "uxa"
EndSection

DRI3 问题

DRI3xf86-video-intel 默认的 DRI 版本,在有些系统上可能出现 问题。要退回到 DRI2,在配置文件中加入:

Option "DRI" "2"

Font and screen corruption in GTK+ applications (missing glyphs after suspend/resume)

Should you experience missing font glyphs in GTK+ applications, the following workaround might help. Edit /etc/environment to add the following line:

/etc/environment
COGL_ATLAS_DEFAULT_BLIT_MODE=framebuffer

See also FreeDesktop bug 88584.

在启动阶段,当 "Loading modules" 时黑屏

若使用 "late start" KMS ,当 "Loading modules" 时黑屏, 在 initramfs 中添加 i915intel_agp 可能有帮助. 查看 the above[损坏的链接:无效的章节] 的 KMS 节.

在尾部添加下面 kernel parameter 可能也会有效果:

video=SVIDEO-1:d

如果是输出到 VGA:

video=VGA-1:1280x800

X 冻结/崩溃

使用 NoAccel 选项可能对 X 冻结/崩溃或显卡停止工作有效。

/etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
   Identifier "Intel Graphics"
   Driver "intel"
   Option "NoAccel" "True"
EndSection

此外, 也可尝试 DRI 选项来禁用 3D 加速:

/etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
   Identifier "Intel Graphics"
   Driver "intel"
   Option "DRI" "False"
EndSection

If you experience crashes and have

Option "TearFree" "true"
Option "AccelMethod" "sna"

in your configuration file, in most cases these can be fixed by adding

i915.semaphores=1

to your boot parameters.

If you are using kernel 4.0.X or above on Baytrail architecture and frequently encounter complete system freezes (especially when watching video or using GFX intensivelly), you should try adding the following kernel option as a workaround, until this bug will be fixed permanently.

 intel_idle.max_cstate=1

添加未识别分辨率

Xrandr page 讲到了此问题。

Weathered colors (color range problem)

注意: This problem is related to the changes in the kernel 3.9. This problem still remains in kernel 4.1.

Kernel 3.9 contains a new default "Automatic" mode for the "Broadcast RGB" property in the Intel driver. It is almost equivalent to "Limited 16:235" (instead of the old default "Full") whenever an HDMI/DP output is in a CEA mode. If a monitor does not support signal in limited color range, it will cause weathered colors.

注意: Some monitors/TVs support both color range. In that case an option often known as Black Level may need to be adjusted to make them handle the signal correctly. Some TVs can handle signal in limited range only. Setting Broadcast RGB to "Full" will cause color clipping. You may need to set it to "Limited 16:235" manually to avoid the clipping.

One can force mode e.g. xrandr --output <HDMI> --set "Broadcast RGB" "Full" (replace <HDMI> with the appropriate output device, verify by running xrandr).

Unfortunately, the Intel driver does not support setting the color range through an xorg.conf.d configuration file.

A bug report is filed and a patch can be found in the attachment.

Also there are other related problems which can be fixed editing GPU registers. More information can be found [7] and [8].

Backlight is not adjustable

If after resuming from suspend, the hotkeys for changing the screen brightness do not take effect, check your configuration against the Backlight article.

If the problem persists, try one of the following kernel parameters:

acpi_osi=Linux
acpi_osi="!Windows 2012"
acpi_osi=

Disabling frame buffer compression

Enabling frame buffer compression on pre-Sandy Bridge CPUs results in endless error messages:

# dmesg |tail 
[ 2360.475430] [drm] not enough stolen space for compressed buffer (need 4325376 bytes), disabling
[ 2360.475437] [drm] hint: you may be able to increase stolen memory size in the BIOS to avoid this

The solution is to disable frame buffer compression which will slightly increase power consumption. In order to disable it add i915.enable_fbc=0 to the kernel line parameters. More information on the results of disabled compression can be found here.

Corruption/Unresponsiveness in Chromium and Firefox

If you experience corruption or unresponsiveness in Chromium and/or Firefox set the AccelMethod to "uxa"[损坏的链接:无效的章节].

Kernel crashing w/kernels 4.0+ on Broadwell/Core-M chips

A few seconds after X/Wayland loads the machine will freeze and journalctl will log a kernel crash referencing the Intel graphics as below:

Jun 16 17:54:03 hostname kernel: BUG: unable to handle kernel NULL pointer dereference at           (null)
Jun 16 17:54:03 hostname kernel: IP: [<          (null)>]           (null)
...
Jun 16 17:54:03 hostname kernel: CPU: 0 PID: 733 Comm: gnome-shell Tainted: G     U     O    4.0.5-1-ARCH #1
...
Jun 16 17:54:03 hostname kernel: Call Trace:
Jun 16 17:54:03 hostname kernel:  [<ffffffffa055cc27>] ? i915_gem_object_sync+0xe7/0x190 [i915]
Jun 16 17:54:03 hostname kernel:  [<ffffffffa0579634>] intel_execlists_submission+0x294/0x4c0 [i915]
Jun 16 17:54:03 hostname kernel:  [<ffffffffa05539fc>] i915_gem_do_execbuffer.isra.12+0xabc/0x1230 [i915]
Jun 16 17:54:03 hostname kernel:  [<ffffffffa055d349>] ? i915_gem_object_set_to_cpu_domain+0xa9/0x1f0 [i915]
Jun 16 17:54:03 hostname kernel:  [<ffffffff811ba2ae>] ? __kmalloc+0x2e/0x2a0
Jun 16 17:54:03 hostname kernel:  [<ffffffffa0555471>] i915_gem_execbuffer2+0x141/0x2b0 [i915]
Jun 16 17:54:03 hostname kernel:  [<ffffffffa042fcab>] drm_ioctl+0x1db/0x640 [drm]
Jun 16 17:54:03 hostname kernel:  [<ffffffffa0555330>] ? i915_gem_execbuffer+0x450/0x450 [i915]
Jun 16 17:54:03 hostname kernel:  [<ffffffff8122339b>] ? eventfd_ctx_read+0x16b/0x200
Jun 16 17:54:03 hostname kernel:  [<ffffffff811ebc36>] do_vfs_ioctl+0x2c6/0x4d0
Jun 16 17:54:03 hostname kernel:  [<ffffffff811f6452>] ? __fget+0x72/0xb0
Jun 16 17:54:03 hostname kernel:  [<ffffffff811ebec1>] SyS_ioctl+0x81/0xa0
Jun 16 17:54:03 hostname kernel:  [<ffffffff8157a589>] system_call_fastpath+0x12/0x17
Jun 16 17:54:03 hostname kernel: Code:  Bad RIP value.
Jun 16 17:54:03 hostname kernel: RIP  [<          (null)>]           (null)

This can be fixed by disabling execlist support which was changed to default on with kernel 4.0. Add the following kernel parameter:

i915.enable_execlists=0

This is known to be broken to at least kernel 4.0.5.

Skylake support

For linux kernels older than 4.3.x, i915.preliminary_hw_support=1 must be added to your boot parameters for the driver to work on the new Intel Skylake (6th gen.) GPUs. On a fully updated system running kernel 4.3.x and up, this step is unneccesary.

注意: Fixes for the GPU/DRM bugs are pending in kernel 4.6. The following steps are unneccesary if you have testing repo enabled, or once 4.6 lands in core.

The i915 DRM driver is known to cause various GPU hangs, crashes and even full system freezes. It might be neccesary to disable hardware acceleration to workaround these issues. One solution is to use the following Xorg configuration.

/etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
	Identifier  "Intel Graphics"
	Driver      "intel"
	Option	    "DRI"	"false"
EndSection

Otherwise, specific applications such as Chromium and Firefox browsers can be instructed to disable hardware rendering directly.

Another option that seems to work for some users is to add the i915.enable_rc6=0 kernel boot parameter, which will cause the CPU/GPU to remain in high-power modes, but seems to resolve most cases of GPU hangs and system freezes.

注意: If the system appears to hang after "Loading Initial Ramdisk", make sure that the IGD aperture size in BIOS is less than 4GB.

Lag in Windows guests

The video output of a Windows guests in VirtualBox sometimes hangs until the host forces a screen update (e.g. by moving the mouse cursor). Removing the enable_fbc=1 option fixes this issue.

更多信息