Intel

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Intel and the translation is 60% complete.
Other languages:

Intel は、Intel 810 により始まった Intel GMA オンボードグラフィックスカードおよび Intel Arc ディスクリートグラッフィクスカードのための、オープンソースのグラフィックスドライバです。

ハードウェアの検出

正しいドライバを選択するために、まずグラフィックスカードを検出してください。この目的のために 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 の出力は 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 only 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 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. 1.0 1.1 Mesa 22.0 以降ではクラシックな i915 ドライバへの対応が削除されています
  2. 2.0 2.1 2.2 2.3 かつて Beignet プロジェクトによってサポートされていました が、今は非推奨でもう保守されていません。
  3. Valley View は Silvermont マイクロアーキテクチャ (特に Bay Trail プラットフォーム) に関連するグラフィックスコアの名前です
  4. 4.0 4.1 かつて Intel によるプロプライエタリの Legacy OpenCL ドライバによってサポートされていましたが、もう保守されていません。
  5. Cherryview は Airmont マイクロアーキテクチャ (特に Braswell、Cherry Trail プラットフォーム) に関連するグラフィックスコアの名前です
  6. 6.0 6.1 6.2 6.3 6.4 6.5 dev-libs/intel-compute-runtime によってサポートされています
  7. Broxton は Goldmont マイクロアーキテクチャ (特に Apollo Lake プラットフォーム) に関連するグラフィックスコアの名前です
  8. 最低でもカーネルバージョン 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 ファームウェア

Display Microcontroller ファームウェアは、高度なグラフィックス低電力アイドル状態へのサポートを提供します。[1]

DMC ファームウェア (この例では i915/skl_dmc_ver1_27.bin です) をカーネルバイナリに組み込むには:

カーネル (Linux 4.18 より前) ファームウェアブロブをカーネルバイナリに組み込む
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
カーネル (Linux 4.18 以降) ファームウェアブロブをカーネルバイナリに組み込む
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
警告
ファームウェアをカーネルに組み込むことで suspend to RAM が失敗することがあります。これが懸念になる場合は、ブロブをカーネルに組み込まずに、initramfs にファームウェアブロブを追加してください。

または、i915 ドライバをカーネルモジュールとしてコンパイルしてください。そうすることでファームウェアはファイルシステムから自動的にロードされるでしょう。

GuC/HuC ファームウェア

Graphics µController ファームウェアはホストドライバから機能をオフロードします。HEVC/H.265 µController ファームウェアはメディアデコード処理のハードウェアアクセラレーションを改善します。[1]

Gen11 以降の GPU に対しては、GuC/HuC ファームウェアは Linux 5.4 以降デフォルトでロードされます (コミットを参照)。

For Gen9 and Gen9.5 GPUs, GuC/HuC firmware won't load by default. It is possible to enable loading of the firmware using kernel parameter i915.enable_guc_loading=1 (before kernel 4.16) or i915.enable_guc=3 (since kernel 4.16). HuC firmware (and GuC as a dependent) is needed for AVC/HEVC/VP9 low power encoding bitrate control, including CBR, VBR, etc.. Enabling GuC/HuC firmware loading causes issues in some systems. Disable it if the system experiences freezing (for example, after resuming from hibernation).

GuC firmware for Gen 12+ now only uses major version numbers e.g. tgl_guc_70.bin[2] and HuC firmware does not have a version number e.g. tgl_huc.bin[3].

ファームウェアファイル名を特定するには、/var/log/kern.log を確認するか:

ファイル /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)

またはカーネルソースツリーで MODULE_FIRMWARE を grep してください:

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);

そして上と同様に、ファームウェアファイルをカーネルに組み込むように設定してください。

カーネル

少なくとも i915 のためには、カーネル 3.14.14 以降 legacy fbdev サポートは必要です (CONFIG_DRM_I915_FBDEV=y)。[4][5]

Intel/AMD ハイブリッドシステムに関しては、radeon ドライバの手順にも従ってください。

カーネルバージョン 4.4 以降はドライバが移動しており、legacy fbdev サポートは今は CONFIG_DRM_FBDEV_EMULATION=y です。

カーネル Linux 5.4
        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
メモ
Coffee Lake に対しては、カーネルバージョン 4.19 以降が推奨されます。アルファサポートを有効化せずに機能するでしょう。カーネル 4.14 ではモジュール i915 を alpha_support=1 付きでロードするか、カーネルコンフィグで CONFIG_DRM_I915_ALPHA_SUPPORT を有効化する必要があります。

DG2 では、HuC ファームウェアを正しくロードするには Intel PXP サポートと Intel Management Engine Interface が必要です。[6]

カーネル DG2 HuC 認証
        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

X ドライバ

Portage はさまざまなグラフィックスカードをサポートするために、USE_EXPAND 変数へと展開される VIDEO_CARDS 変数を使用します。x11-base/xorg-drivers パッケージがすでにインストールされているとすると、/etc/portage/make.confVIDEO_CARDS 変数を設定することで正しいドライバが取り込まれるでしょう:

ファイル /etc/portage/make.confGen 2 および Gen 3
VIDEO_CARDS="intel i915"
ファイル /etc/portage/make.confGen 4 以降
VIDEO_CARDS="intel"
重要
Beginning with x11-base/xorg-drivers-21.1, the x11-base/xorg-drivers package changes USE flag settings. This will omit selection of the deprecating x11-drivers/xf86-video-intel driver by default in favor of the more maintained, generic modesetting DDX driver built into x11-base/xorg-server. Older systems with the USE=video_cards_i915 USE flag set will continue to have the Intel DDX driver installed.

make.conf を編集したら、変更が反映されるように、--changed-use --deep オプションを emerge に渡してシステムを更新してください:

root #emerge --ask --changed-use --deep @world

Those wishing to not accept the Intel graphic driver defaults in the main repository can read on into the sub-sections below.

Intel DDX

Intel DDX ドライバについて進める前に、このドライバは数年間をかけて徐々に非推奨化されていることに注意してください。他の有名な[7][8] Linux ディストリビューションには、modesetting DDX ドライバ (下の節で解説します) に乗り換えたものもあります。Intel はこのドライバをかなり長い間更新しておらず[9]、Gentoo の X11 パッケージメンテナの負担になっています。

The Intel DDX driver is faster than the generic modesetting driver as it is able to more closely interact with hardware acceleration of chips using SNA and DRI3.

USE フラグ

x11-drivers/xf86-video-intel の USE フラグを確認してください:

USE flags for x11-drivers/xf86-video-intel X.Org driver for Intel cards

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
sna Enable SandyBridge's New Acceleration (useful on all chipsets, not just SandyBridge)
tools Build the intel-virtual-output tool
udev Enable virtual/udev integration (device discovery, power and storage device support, etc)
uxa Enable UMA Acceleration Architecture
valgrind Enable annotations for accuracy. May slow down runtime slightly. Safe to use even if not currently using dev-util/valgrind
xvmc Enables X-Video Motion Compensation support

Emerge
root #emerge --ask x11-drivers/xf86-video-intel
xorg.conf

To force Xorg server to use the Intel DDX driver with SNA for hardware acceleration, the following file can be created in /etc/X11/xorg.conf.d/:

ファイル /etc/X11/xorg.conf.d/20-intel.confForce Intel DDX
Section "Device"
        Identifier  "Intel Graphics"
        Driver      "intel"
        Option      "AccelMethod"    "sna"
        Option      "DRI"         "crocus"
EndSection

The value for the DRI option should be crocus for Gen 4 through Gen 7.5 and iris for Gen 8 and higher. This line should be omitted for Gen 2 and Gen 3.

Modesetting DDX

As mentioned above, the modesetting DDX driver is now the default driver on newer Intel graphics chipsets for Gentoo. This driver uses GLAMOR to accelerate 2D graphical over Mesa (the open source OpenGL implementation). As of x11-base/xorg-drivers-1.19 this has become the default for Gentoo.

As of xorg-server/xorg-server-1.20.6 GLAMOR support is enabled unless the USE=minimal USE flag is enabled. No additional steps or configuration are necessary.

xorg.conf

If it's necessary to force Xorg to load the modesetting driver the following config snippet can be used:

ファイル /etc/X11/xorg.conf.d/20-modesetting.confForce modesetting DDX
Section "Device"
        Identifier  "Intel Graphics"
        Driver      "modesetting"
        Option      "AccelMethod"    "glamor"
        Option      "DRI"            "3"
EndSection
メモ
If both 20-intel.conf and 20-modesetting.conf files are defined in /etc/X11/xorg.conf.d/, the X server will attempt to load the files in alpha-numeric order.
Screen tearing

x11-drivers/xf86-video-intel may be necessary because, as of January 2022, the fix for screen tearing still is not implemented into the X server.[10]

Create the following file:

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

Other options against screen tearing:

  1. Use Sway instead of Xorg (implementation of Wayland protocol, that is tear free by design).
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:

ファイル /etc/dracut.conf.d/......conf
add_drivers+="... i915 ..."

Then run:

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 USE=vulkan flag.

ツール

x11-apps/igt-gpu-tools provides utilities for debugging.

For example, GPU min/max/current frequency can be displayed by:

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.
ファイル /etc/X11/xorg.conf.d/intel.confExplicit intel driver section
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 older intel driver.
ファイル /etc/X11/xorg.conf.d/modesetting.confExplicit modesetting driver section
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.

トラブルシューティング

Screen flickering

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

ファイル /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
        Identifier "Device0"
        Driver "intel"
        Option      "AccelMethod" "SNA"
        Option      "TearFree"    "true"
EndSection

See also this Linux Mint tutorial.

Black screen

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

Brightness does not change with keyboard shortcuts

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:

ファイル ~/.config/openbox/lxde-rc.xml
<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 とは何か、Xorg のインストール方法、各種設定について説明します。
  • Hprofile — an application that can be used to manage multiple profiles be it hardware or software.

外部資料

参照