Intel graphics

From ArchWiki
Revision as of 20:59, 29 August 2015 by CounterPillow (talk | contribs) (→‎Backlight is not adjustable: Was required for ASUS UX32L(N).)
Jump to navigation Jump to search

zh-cn:Intel graphics zh-tw:Intel

Since Intel provides and supports open source drivers, Intel graphics are now essentially plug-and-play.

For a comprehensive list of Intel GPU models and corresponding chipsets and CPUs, see this comparison on Wikipedia.

Note: PowerVR-based graphics (GMA 500 and GMA 3600 series) are not supported by open source drivers.

Installation

Prerequisite: Xorg.

Install the xf86-video-intel package. It provides the DDX driver for 2D acceleration and it pulls in mesa as a dependency, providing the DRI driver for 3D acceleration.

To enable OpenGL support, also install mesa-libgl. If you are on x86_64 and need 32-bit support, also install lib32-mesa-libgl from the multilib repository.

Install the VA-API driver and library provided by the libva-intel-driver and libva packages respectively. On older GPUs, this is provided instead by the XvMC driver, which is included with the DDX driver.

Configuration

There is no need for any configuration to run X.

For the full list of options, see the man page for intel.

Loading

The Intel kernel module should load fine automatically on system boot.

If it does not happen, then:

  • Make sure you do not have nomodeset or vga= as a kernel parameter, since Intel requires kernel mode-setting.
  • Also, check that you have not disabled Intel by using any modprobe blacklisting within /etc/modprobe.d/ or /usr/lib/modprobe.d/.

Enable early KMS

Tip: If you have problems with the resolution, you can check whether enforcing the mode helps.

Kernel mode setting (KMS) is supported by Intel chipsets that use the i915 DRM driver and is mandatory and enabled by default.

KMS is typically initialized after the initramfs stage. It is possible, however, to enable KMS during the initramfs stage. To do this, add the i915 module to the MODULES line in /etc/mkinitcpio.conf:

MODULES="... i915 ..."
Tip: Users might need to add intel_agp before i915 to suppress the ACPI errors. The order matters because the modules are activated in sequence.

If you are using a custom EDID file, you should embed it into initramfs as well:

/etc/mkinitcpio.conf
FILES="/lib/firmware/edid/your_edid.bin"

Now, regenerate the initramfs:

# mkinitcpio -p linux

The change takes effect at the next reboot.

Module-based Powersaving Options

The i915 kernel module allows for configuration via module options. Some of the module options impact power saving.

A list of all options along with short descriptions and default values can be generated with the following command:

$ modinfo -p i915

To check which options are currently enabled, run

# 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.

Warning: 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

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

Framebuffer compression, for example, may be unreliable or unavailable on Intel GPU generations before Sandy Bridge (generation 6). This results in messages logged to the system journal similar to this one:

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

Tips and tricks

Disable Vertical Synchronization (VSYNC)

The intel-driver uses Triple Buffering for vertical synchronization, this allows for full performance and avoids tearing. To turn vertical synchronization off (e.g. for benchmarking) use this .drirc in your home directory:

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

Do not use driconf to create this file, it is buggy and will set the wrong driver.

Setting scaling mode

This can be useful for some full screen applications:

$ xrandr --output LVDS1 --set PANEL_FITTING param

where param can be:

  • center: resolution will be kept exactly as defined, no scaling will be made,
  • full: scale the resolution so it uses the entire screen or
  • full_aspect: scale the resolution to the maximum possible but keep the aspect ratio.

If it does not work, try:

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

where param is one of "Full", "Center" or "Full aspect".

KMS Issue: console is limited to small area

One of the low-resolution video ports may be enabled on boot which is causing the terminal to utilize a small area of the screen. To fix, explicitly disable the port with an i915 module setting with video=SVIDEO-1:d in the kernel command line parameter in the bootloader. See Kernel parameters for more info.

If that does not work, try disabling TV1 or VGA1 instead of SVIDEO-1.

H.264 decoding on GMA 4500

The libva-intel-driver package provides MPEG-2 decoding only for GMA 4500 series GPUs. The H.264 decoding support is maintained in a separated g45-h264 branch, which can be used by installing libva-intel-driver-g45-h264AUR package, available in the Arch User Repository. Note however that this support is experimental and not currently in active development. Using the VA-API with this driver on a GMA 4500 series GPU will offload the CPU but may not result in as smooth a playback as non-accelerated playback. Tests using mplayer showed that using vaapi to play back an H.264 encoded 1080p video halved the CPU load (compared to the XV overlay) but resulted in very choppy playback, while 720p worked reasonably well [2]. This is echoed by other experiences [3].

Setting brightness and gamma

The following example demonstrates using using the /sys virtual file system to set brightness at the driver level. The maximum brightness is indicated in the file /sys/class/backlight/intel_backlight/max_brightness. Note that its value may differ across different hardware configurations.

# cd /sys/class/backlight/intel_backlight
# cat max_brightness
4437
# echo 2200 > brightness

Brightness can alternatively be set using the xorg-xbacklight package.

$ xbacklight -set 50  # sets brightness to 50% of maximum

Increments can be used instead of absolute values, for example:

$ xbacklight -inc 10  # increase brightness by 10%
$ xbacklight -dec 10  # decrease brightness by 10%

Gamma can be set using either the xorg-xrandr or xorg-xgamma package. The following commands create the same effect.

$ xrandr --output LVDS1 --gamma 1.0:1.0:1.0
$ xgamma -rgamma 1 -ggamma 1 -bgamma 1

Troubleshooting

SNA issues

From man 4 intel:

There are a couple of backends available for accelerating the DDX. "UXA" (Unified Acceleration Architecture) is the mature backend that was introduced to support the GEM driver model. It is in the process of being superseded by "SNA" (Sandybridge's New Acceleration). Until that process is complete, the ability to choose which backend to use remains for backwards compatibility.

SNA is the default acceleration method in xf86-video-intel. If you are experience issues with SNA (e.g. pixelated graphics, corrupt text, etc.), try using UXA instead, which can be done by creating an X configuration file containing the following:

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

Blank screen during boot, when "Loading modules"

If using "late start" KMS and the screen goes blank when "Loading modules", it may help to add i915 and intel_agp to the initramfs. See Kernel mode setting#Early KMS start section.

Alternatively, appending the following kernel parameter seems to work as well:

video=SVIDEO-1:d

If you need to output to VGA then try this:

video=VGA-1:1280x800

Tear-free video

The SNA acceleration method causes tearing for some people. To fix this, enable the "TearFree" option in the driver:

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

See the original bug report for more info.

Note:
  • This option may not work when SwapbuffersWait is false.
  • This option is problematic for applications that are very picky about vsync timing, like Super Meat Boy.
  • This option does not work with UXA acceleration method, only with SNA.

X freeze/crash with intel driver

Some issues with X crashing, GPU hanging, or problems with X freezing, can be fixed by disabling the GPU usage with the NoAccel option:

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

Alternatively, try to disable the 3D acceleration only with the DRI option:

/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 config file, in most cases these can be fixed by adding

i915.semaphores=1

to your boot parameters.

Adding undetected resolutions

This issue is covered on the Xrandr page.

Weathered colors (color range problem)

Note: This problem is related to the changes in the kernel 3.9. This problem still remains in kernel 3.18

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.

Note: 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.

One can force mode e.g. xrandr --output <HDMI> --set "Broadcast RGB" "Full" (replace <HDMI> with the appropriate output device, verify by running xrandr). You can add it into your .xprofile, make it executable to run the command before it will start the graphical mode.

Note: 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.

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

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.

Backlight is not adjustable

After resuming from suspend, the hotkeys for changing the screen brightness do not take effect. Using the following kernel parameters can potentially solve the problem.

acpi_backlight=vendor

Either in addition to the above mentioned parameter, or on its own, add one of the following three parameters:

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

Another parameter available:

video.use_native_backlight=1

If neither of those solve the problem, edit or create /etc/X11/xorg.conf.d/20-intel.conf with the following content:

/etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
        Identifier  "card0"
        Driver      "intel"
    Option      "Backlight"  "intel_backlight"
        BusID       "PCI:0:2:0"

EndSection

If using the UXA acceleration as mentioned above, create the file as follows:

/etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
        Identifier  "card0"
        Driver      "intel"
        Option      "AccelMethod"  "uxa"
        Option      "Backlight"    "intel_backlight"
        BusID       "PCI:0:2:0"

EndSection

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".

Loss of horizontal sync when switching TTYs

A regression is present in kernels 3.19.3+ (and possibly older kernels as well) that results in horizontal sync loss on Broadwell machines when switching TTYs. [6] To fix it, you can add i915.enable_ips=0 to your kernel command-line as a workaround, or if you're running 4.1, you can rebuild your kernel with the patch available here. The fix was merged into the mainline kernel in 4.2-rc1.

Pink & green artifacts in video or webcam output

On Broadwell machines with applications that use xv output, or Intel Textured Video (notably, Skype and VLC), the video stream exhibits pink and green artifacts. This is a general Broadwell video issue that was fixed upstream on 2015-04-16. [7] Update xf86-video-intel to fix it.

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.

See also