I915 driver has bug for iris xe graphics



# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.kernelPackages = pkgs.linuxPackages_latest;

  networking.hostName = "desktop"; # Define your hostname.
  # Pick only one of the below networking options.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
  networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.

  # Set your time zone.
  time.timeZone = "Asian/Shanghai";

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Select internationalisation properties.
  i18n.inputMethod = {
    enabled = "fcitx";
  };
  i18n.inputMethod.fcitx5.addons = [ pkgs.fcitx5-rime ];
  console = {
    font = "latarcyrheb-sun32";
    useXkbConfig = true; # use xkbOptions in tty.
  };

  # Enable the X11 windowing system.
  services.xserver.enable = true;


  

  # Configure keymap in X11
  services.xserver.layout = "us";
  services.xserver.desktopManager.lxqt.enable = true;
  services.xserver.displayManager.defaultSession = "lxqt";
  # map caps to escape.
  # services.xserver.xkbOptions = {
  #   "caps:escape"
  # };
  #   "eurosign:e";

  services.picom = {
    enable = true;
    fade = true;
    inactiveOpacity = 0.9;
    shadow = true;
    fadeDelta = 4;
  };

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable sound.
  sound.enable = true;
  hardware.pulseaudio.enable = true;

  # Enable touchpad support (enabled default in most desktopManager).
  services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.defaultUserShell = pkgs.zsh;
  users.users.wzy = {
    isNormalUser = true;
    extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
  };

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
    wget
    curl
    aria2
    git
    tmux
    file
    lesspipe
    pciutils
    usbutils
    linux-firmware
    snapper
    firefox
    exa
    fd
    vivid
    delta
    bat
    ripgrep
    fzf
    dos2unix
    android-tools
    scrcpy
    w3m
    elinks
    neomutt
    neofetch
    parallel
    jq
    wezterm
    gh
    wgetpaste
  ];

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  programs.mtr.enable = true;
  programs.zsh.enable = true;
  programs.zsh.enableBashCompletion = true;
  programs.zsh.enableGlobalCompInit = true;
  programs.zsh.autosuggestions.async = true;
  programs.zsh.histSize = 20000;
  programs.gnupg.agent = {
    enable = true;
    enableSSHSupport = true;
  };

  nix.settings.substituters = ["https://mirrors.bfsu.edu.cn/nix-channels/store"];

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  networking.firewall.enable = false;

  # Copy the NixOS configuration file and link it from the resulting system
  # (/run/current-system/configuration.nix). This is useful in case you
  # accidentally delete configuration.nix.
  system.copySystemConfiguration = true;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "22.11"; # Did you read the comment?

}
wzy@desktop 
----------- 
OS: NixOS 22.11.2028.def9e420d27 (Raccoon) x86_64 
Host: HUAWEI MRG-WXX-PCB-B1 
Kernel: 6.1.8 
Uptime: 1 min 
Packages: 880 (nix-system) 
Shell: zsh 5.9 
Resolution: 3120x2080 
Terminal: /dev/tty1 
CPU: 11th Gen Intel i5-1155G7 (8) @ 4.500GHz 
GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics] 
Memory: 644MiB / 15793MiB

I try to change refresh frequency to 90/60/48Hz, however it seems useless.

before I install nixos, it has a preinstalled windows and its screen can work normally, so I think it is unrelated to hardware bug.

TIA!

What is the exact laptop model? You could have a look at GitHub - NixOS/nixos-hardware: A collection of NixOS modules covering hardware quirks. to see if someone else has used this laptop before.

If you boot into bios does it also show this glitch? What about the tty? If not, it might be a driver issue, but it certainly looks like hardware failure.

# dmidecode 3.4
Getting SMBIOS data from sysfs.
SMBIOS 3.3.0 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: HUAWEI
	Product Name: MRG-WXX
	Version: M1010
	Serial Number: DYPBB21C09800596
	UUID: 20211211-f4b3-014f-56c8-f4b3014f56cc
	Wake-up Type: Power Switch
	SKU Number: C233
	Family: MateBook X

This is the model of the laptop and it is not found in https://github.com/NixOS/nixos-hardware. It works normally in BIOS, and crazy in tty and X11 especially when content changes such as less and press backspace. So it is related to driver, isn’t it? How can I solve it?

https://bbs.archlinuxcn.org/viewtopic.php?id=12223

Sorry if what I say has already been mentioned in that thread, my Chinese is limited to a small handful of animal names and google translate doesn’t seem to work on my phone…

Sadly this is already my best guess. The driver is part of the kernel for Intel GPUs, so if this is indeed a driver issue then it’s a kernel bug.

The display is indeed weird with its refresh rate and resolution, though, so maybe you’re not completely out of luck and Huawei do something insane that causes the mode setting to glitch out. Still a kernel bug, but we might be able to work around it.

To test that, comment the xserver things out for now so that X doesn’t mess with the mode:

Then enable boot.vesa. It’s deprecated, but is handy for just setting the most basic monitor mode possible.

If the glitches don’t occur in that mode in the tty, you might be able to find a mode that doesn’t glitch but still looks ok. If not, you will need to find someone who knows more about the kernel, or maybe check for bug reports there.

Can you also share the contents of dmesg?

Also, how do you set those? Is there a BIOS toggle for that, or some kind of button? This makes me really suspect that mode setting is just failing for this display…

Sorry for late, dmesg is here https://dpaste.com/BU5ZMSS2K.

now I have disabled xsever and enabled vesa and now it work normally. this is configuration.nix: https://dpaste.com/2N84YW7DU

I change refresh frequence by lxqt-config-monitor:

Now

$ lspci -nnk|rg VGA -A3
00:02.0 VGA compatible controller [0300]: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] [8086:9a49] (rev 03)
	Subsystem: Device [1e83:3e49]
	Kernel modules: i915

Still a kernel bug, but we might be able to work around it.

So how can I do now?

Could we have the dmesg without boot.vesa? Not really easy to see issues in a boot that’s working :wink:

Well, first off, to get your system running with a reasonable resolution, you probably want to replace boot.vesa with adding nomodeset to your boot.kernelParams:

boot.kernelParams = [
  "nomodeset"
];

Now we know nomodeset works with the tty, you can also turn your X config back on. If it interferes with something at this point that’s just more data. That said, your graphics performance will suck, and battery life will be poor.

With a bit of luck that should work ok for now though. If it does, it’s a good sign that there’s nothing wrong with your hardware, and that this is in fact a bug somewhere in the software stack (if issues do occur, pay attention to whether they happen during boot, or only when X11 has already started - if it happens during boot lowering the resolution might help).

Without a dmesg showing problems I’m not sure where else to go from there. I’ve dug around a bit, seems there were issues with this GPU around 2021, but those should be resolved by now. Also nothing in the kernel mailing list archives.

I think it’s unlikely you’d be the first to find this given the age of the hardware, and because it’s intel, so it’s more likely to be a configuration bug that will be very clearly visible in dmesg, but if we can’t find anything it may need to be a mail to the kernel ML, or at least some forum that deals more with actual kernel issues than I do.

dmseg with this bug is http://dpaste.com/BFWMG9378. after nomodeset , this bug disappear, Thanks!

Now what should I do?

You can try two things if you want to get this fixed:


Firstly, you can try to reproduce the bug with gentoo/arch, and if you do, post on their forums. You’re more likely to find someone who has time/access to the same hardware who can create a bug report upstream.

This will be a lot easier, especially if you don’t have much experience with NixOS, let alone the Linux kernel.

If you’re a bit more comfortable with this kind of work, submitting a bug yourself using those distros will probably be easier too if you’re just starting with NixOS.


Alternatively, you could try to submit a bug to drm / intel · GitLab.

You’ll have to follow their process if you do; this will not be easy, running the very latest kernel/drm-tip branch on NixOS can take some knowledge and effort, especially if you want to reproduce the bug on multiple different kernel versions to see if it’s a regression. This will be especially tricky because it will be difficult to follow their exact instructions, and without some knowledge you might create a bad bug report.

You’ll also need to dig into upstream issues to double check nobody else has reported this before; I don’t see anything from a quick look, but there are a lot of tickets and I only have so much time to look at bugs I can’t reproduce in software I haven’t written.


Finally, you can of course also just ignore the issue and hope a future kernel version fixes it. I think nomodeset means you’re running without hardware acceleration, so this isn’t great for graphics performance, but if you don’t do anything intensive with the laptop that might be fine.

You can try the intel graphics driver, it might get you some performance at least, but I don’t know how well it supports newer GPUs.


This is the only suspicious line in the logs I can see, and it doesn’t point at anything I can help with, so unfortunately, I can’t help you further:

1029  [    4.721566] i915 0000:00:02.0: [drm] Selective fetch area calculation failed in pipe A

Good luck, though, hope I at least helped a little. If you do find a solution (or if the issue just disappears after a kernel update), be sure to come back here and mark this topic as resolved; That will help the next person with this issue.

https://bbs.archlinuxcn.org/viewtopic.php?id=12223 this post said i915.enable_psr=0 can fix this bug. How can I change it in nixOS? Thanks!

I think that’s a different issue, but you can enable that using the kernelParams, too, just set:

boot.kernelParams = [
  "i915.enable_psr=0"
];
2 Likes

Thanks! This solve my problem. And how to edit the title of this issue? I want to add [Solved] to this title of this issue, however I cannot found where is the button to edit …

1 Like

There should be a buttonthat says “solved” under the comments. Click the button under the one you think solved the problem and it’ll automatically add a little tick mark to the title.

This bug has disappeared in latest kernel.

2 Likes