The following is a quick guide based on my experience of optimizing Void Linux for Intel Skylake HD Graphics 520 on a laptop, hopefully it is of help to someone.
One of the things about running a more minimalist OS is that you sometimes need to take responsibility for tweaking certain things to get the most out of it; Intel Graphics is one such thing. After a fairly standard install of Void Linux, plus Xorg, I discovered that I wasn't happy with video playback and browser scrolling. The video playback looked kind of sloppy, with a good amount of tearing (visible redrawing) and Firefox was laggy when scrolling.
So here's what I did about it.
Prerequisites
In addition Xorg, and perhaps a window manager, there's a bunch of packages you probably need installed.
sudo xbps-install -S mesa-intel-dri libva-intel-driver sysfsutils
Installing Xorg and configuring a window manager is a whole other topic I'm not going to touch.
Configuring Xorg
Assuming you already have Xorg and a window manager installed, you'll need to ensure that Xorg is configured to use the "modesetting" display driver. Kernel Mode Setting (KMS), is part of the Linux kernel that enables it to manage the video card. Under Void, this is the default so NO further configuration is needed.
However, if you have already created an Xorg.conf file then simply either remove it, remove the display device section or update it to include something like the following:
Section "Device"
Identifier "Intel Graphics"
Driver "modesetting"
EndSection
This also means you won't be using the xf86-video-intel package anymore, which is the Xorg supplied driver. On a simple system with on onboard Intel graphics, this should generally be enough to get your Xorg display working properly. Now for the fun stuff.
Tweaking Your Intel Graphics driver
A word of warning here, the things I'm about to suggest could possibly break on your machine, proceed with all necessary caution.
The Intel Graphics driver on Linux exists primarily in the form of a kernel module called 'i915'. This kernel module comes with a bunch of configurable parameters to help you get the most out of your display.
First, you should probably confirm exactly what model of Intel Graphics the system has:
sudo lspci -v
00:02.0 VGA compatible controller: Intel Corporation Skylake GT2 [HD Graphics 520] (rev 07) (prog-if 00 [VGA controller])
DeviceName: Onboard IGD
Flags: bus master, fast devsel, latency 0, IRQ 127
Memory at e0000000 (64-bit, non-prefetchable) [size=16M]
Memory at d0000000 (64-bit, prefetchable) [size=256M]
I/O ports at f000 [size=64]
[virtual] Expansion ROM at 000c0000 [disabled] [size=128K]
Capabilities: [40] Vendor Specific Information: Len=0c <?>
Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
Capabilities: [ac] MSI: Enable+ Count=1/1 Maskable- 64bit-
Capabilities: [d0] Power Management version 2
Capabilities: [100] Process Address Space ID (PASID)
Capabilities: [200] Address Translation Service (ATS)
Capabilities: [300] Page Request Interface (PRI)
Kernel driver in use: i915
Kernel modules: i915
If you see something like this, most crucially the line that say "Kernel modules: i915", then you're probably right to carry on. The next step is to see what features the kernel module offers for this device:
sudo modinfo i915
filename: /lib/modules/5.3.15_1/kernel/drivers/gpu/drm/i915/i915.ko.gz
license: GPL and additional rights
description: Intel Graphics
author: Intel Corporation
author: Tungsten Graphics, Inc.
firmware: i915/bxt_dmc_ver1_07.bin
...
parm: modeset:Use kernel modesetting [KMS] (0=disable, 1=on, -1=force vga console preference [default]) (int)
parm: enable_dc:Enable power-saving display C-states. (-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6) (int)
parm: enable_fbc:Enable frame buffer compression for power savings (default: -1 (use per-chip default)) (int)
...
The lines beginning with "parm:" are the configurable parameters for the i915 kernel module. It's important to understand what these parameters really mean before changing them, as getting them wrong might result in all manner of undesirable results. So, the first step is to carefully read and inquire as to what the parameters actually represent.
There are generally two or three important details on each line:
Where ...
int - integers (0,1,2,3,4... etc)
bool - boolean values are either "Y" or "N"
charp - strings (eg "/some/path")
It's important to pay attention this information, if get this wrong you may see errors during boot time and things may not work as expected.
Next, take a look and compare the available parameter options with what is currently set on the running i915 kernel module:
sudo systool -m i915 -av
Module = "i915"
Attributes:
coresize = "2232320"
initsize = "0"
initstate = "live"
refcnt = "22"
taint = ""
uevent = <store method only>
Parameters:
alpha_support = "N"
disable_display = "N"
disable_power_well = "1"
dmc_firmware_path = "(null)"
edp_vswing = "0"
enable_dc = "0"
enable_dp_mst = "Y"
enable_dpcd_backlight= "N"
enable_fbc = "0"
enable_guc = "0"
enable_gvt = "N"
enable_hangcheck = "Y"
enable_ips = "1"
enable_psr = "-1"
error_capture = "Y"
fastboot = "0"
force_probe = ""
force_reset_modeset_test= "N"
guc_firmware_path = "(null)"
guc_log_level = "1"
huc_firmware_path = "(null)"
invert_brightness = "0"
load_detect_test = "N"
lvds_channel_mode = "0"
mmio_debug = "0"
modeset = "-1"
nuclear_pageflip = "N"
panel_use_ssc = "-1"
prefault_disable = "N"
reset = "2"
vbt_firmware = "(null)"
vbt_sdvo_panel_type = "-1"
verbose_state_checks= "Y"
...
These will probably be set to the defaults previously seen with the modinfo command.
To find out more information about what the various parameter actually mean, try looking through the documentation on the i915 kernel module (https://www.kernel.org/doc/html/v5.3/gpu/i915.html). Make sure you the documentation you're reading is for the version of kernel you're running ('uname -a' to check). Also, the hardware specifications from Intel (https://01.org/linuxgraphics/documentation/hardware-specification-prms) can be useful for defining terms.
To change these parameters, create a conf like the following: /etc/modprobe.d/intel-graphics.conf
Add a line to the file that starts with "options i915" and then append parameters to it as necessary. For example:
options i915 enable_dc=2 enable_fbc=1 fastboot=1
In this example, advanced power saving states, frame buffer compression and fast boot optimisations are enabled. Notably, I find frame buffer compression results in smooth video playback on my system.
The next step is to make sure these settings apply when your computer boots. To do this, the initial memory-based filesystem (initramfs), which is used while the kernel is loading, needs to be updated with these changes.
sudo xbps-reconfigure -f linux5.3
Make sure the 'linux5.3' part is changed to match the kernel version you'll be booting with.
Once this steps completes successfully, reboot your system, keeping an eye for any errors and use systool as before to ensure that the parameters you set have actually been applied as expected.
If you're interested in optimising your Intel Graphics card for power saving, you might find 'powertop' or 'intel_gpu_top' useful utilities.
Testing
Finally, it's good to do a test and make sure that everything is running smoothly. I prefer to use mpv and youtube-dl for that job (sudo xbps-install -S mpv youtube-dl), so here's how that would work:
mpv --hwdec=auto "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
Provided the test video is in h264 format, and not some crusty old music video from the 80s, you should see the following terminal output in addition to silky smooth video playback:
(+) Video --vid=1 (*) (h264 1920x1080 25.000fps)
(+) Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
Using hardware decoding (vaapi).
VO: [gpu] 1920x1080 vaapi[nv12]
AV: 00:00:07 / 00:03:32 (3%) A-V: 0.000 Cache: 27s/13MB
Video player software, like mpv, that supports the Intel VA (Video Acceleration) API should use the video decoder built into your Intel Graphics device, providing smooth video playback with no tearing. Sometimes the video player needs to be instructed to use this video acceleration, hence the "--hwdec=auto" in mpv. According to the man page for mpv, "hwdec=auto" will attempt to give you the best hardware decoder, on my system with only Intel Graphics, that option results in the equivalent of calling "mpv --vo=gpu --hwdec=vaapi". To ensure it's always the default option, create ~/.config/mpv/mpv.conf and simply add "hwdec=auto", or whatever default you've chosen.
Finally, give Firefox a little GPU love also. Browse to "about:config" and set "layers.acceleration.force-enabled" to "true", then restart your browser. On my system this results in smoother scrolling and browser-based video playback.
Hopefully this was helpful.