Nixpkgs: Screen tearing with DRI3 enabled on Intel

Created on 4 Oct 2016  路  29Comments  路  Source: NixOS/nixpkgs

Issue description

There's screen tearing on Macbook Air 6,2 after PR (https://github.com/NixOS/nixpkgs/pull/18717) which enables DRI3 by default.

Problem seems to go away after explicitly enabling DRI2 in services.xserver.deviceSection:

      videoDrivers = [ "intel" ];
      deviceSection = ''
        Option "DRI" "2"
      '';
      useGlamor = true;

Is there a widespread improvement with tearing problems after enabling DRI3 by default?
Would it be better to default DRI2 or add a note somewhere instead (or ask upstream guys)?

If anyone feels like it -- please test if you see how things change if you use DRI2 and DRI3 and comment here.

Steps to reproduce

  1. Update to the current nixos-unstable on MBA mid 2013.
  2. Open https://en.wikipedia.org/wiki/October_4 in firefox or qutebrowser and try scrolling.
  3. Observe gruesome tearing.

    Technical details

  • System: 17.03.git.adfcc2d (Gorilla)
  • Nix version: 1.11.4
  • Nixpkgs version: 17.03.git.adfcc2d
bug community feedback

Most helpful comment

If any xmonad users are experiencing these issues, know that compton is not mutually exclusive with xmonad, and that, at least in my case, adding services.compton.enable = true; to my configuration.nix completely solved this issue.

All 29 comments

do you also have the problem using modsettings?

xserver = {
  videoDrivers = ["modsetting"];
}

@Mic92 I've tried different combinations (on/off; dri2/3, etc) of:

      videoDrivers = [ "modesetting" ];
      deviceSection = ''
        Option "DRI" "2"
        Option "TearFree" "true"
      '';
      useGlamor = true;

and tearing is present with all of them.

Thanks. This behavior is consistent, with what I heard of from T440s user.

I think there is not much we could do here then reconsidering DRI3.
This is clearly an upstream issue: https://wiki.archlinux.org/index.php/intel_graphics#DRI3_issues

I have never been able get rid of the tearing with DRI3. An option, which is what I'm currently using, is to run compton with the vsync option.

Agreed that this is an upstream issue, and should probably be raised there. Odd that you're experiencing it with both intel and modesetting. Is there good reason to believe that DRI2 is more stable in general? DRI3 certainly works fine for some users, is required for some features, is the default in other distros, and is easy enough to turn off, so considering the general shabby state of the intel driver the current state might be the best we can do.

@Mic92's fix worked on my machine! Yay! Thanks @Mic92!

(triage) Any updates?

It seems like there are already some related upstream issues (Upstream bug HowTo):

Would be great if someone could help out over there :smile:

I personally wouldn't switch back to DRI2 but it would probably be worth adding a short comment to the NixOS documentation (like in the Arch Wiki).

If any xmonad users are experiencing these issues, know that compton is not mutually exclusive with xmonad, and that, at least in my case, adding services.compton.enable = true; to my configuration.nix completely solved this issue.

If any xmonad users are experiencing these issues, know that compton is not mutually exclusive with xmonad, and that, at least in my case, adding services.compton.enable = true; to my configuration.nix completely solved this issue.

Weird. I'm running on xmonad, and have compton enabled, and I'm still getting screen tearing. Did you enable compton's vsync?

@IvanMalison I'm also having screen tearing lately. Not sure why; I'll try enabling compton vsync though.

The following worked for me too (thanks to https://wiki.archlinux.org/index.php/intel_graphics#DRI3_issues and @Mic92's suggestion):

  videoDrivers = [ "intel" ];                                                                                                                                                                        
  deviceSection = ''                                                                            
    Option "DRI" "2"                                                                            
    Option "TearFree" "true"                                                                    
  '';

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

Are you still having tearing issues? I haven't used the intel igpu in a long while.

If tearing is still an issue we could mention enabling tearfree and ~compton~ picom in the NixOS manual, but forcing DRI2 in 2020 doesn't look like a good idea.

@rnhmjoj tearing was driving me mad when using XMonad. Picom did not solve the issue. I just applied all the workarounds suggested here, only enabling DRI 2 + TearFree worked (regardless of Picom being enabled). Interestingly, there seems to be no tearing on Wayland though. Sadly I'm too attached to my XMonad to give up XOrg just yet...

Oh... I was wrong, tearing was also fixed with:

  deviceSection = ''                                                                            
    Option "DRI" "3"                                                                            
    Option "TearFree" "true"                                                                    
  '';

It does not work if I remove the DRI explicit line... weird?

Oops... no. I was wrong, tearing is back, had to revert to DRI 2.

Does DRI2 alone (without tearfree) have tearing?

Just removed TearFree and tearing seems gone still, only with DRI2.

Last thing before updating the manual, can you check this settings?

  deviceSection = ''                                                                            
    Option "DRI" "3"
    Option "AccelMethod" "sna"                                                   
  '';

No tearing when using smplayer, but there is tearing and stutter when using Youtube on Firefox.

I also have extreme tearing with iGPU and none+xmonad setup. It happens with two different laptops. Tearing does not occur with the old xf86-video-intel driver, but it somehow breaks everything multi-monitor related.

~Other device also suffers from some kind of "retention" issue when background goes black. For example, it happens after logging in from SDDM or closing a window in XMonad. It may be this problem.~

@arximboldi, I realized you may have been trying to use AccelMethod and TearFree with modesetting, while this option are specific to xf86-video-intel. Can you check if you have videoDrivers = [ "intel" ]?

@rnhmjoj I have not explicitly put in the snippets, but I had videoDrivers = [ "intel" ] on all time through my experiments :)

I was just reding your snippet, maybe I should try to use modesetting driver instead which is more modern?

xf86-video-intel is considered legacy. It is still updated, but it does not have proper versioning. We only have bleeding edge git snapshots.

I actually just tried the modesetting driver and I get tearing with it, so I'll stick to intel + DRI 2 for now :)

Thanks @rnhmjoj for helping me investicate and documenting the results!

@arximboldi No problem, thank you for the collaboration.
It's quite sad that modesetting does still have tearing issues but at least we have found a working solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ttuegel picture ttuegel  路  98Comments

danykey picture danykey  路  64Comments

joepie91 picture joepie91  路  102Comments

grahamc picture grahamc  路  88Comments

peti picture peti  路  75Comments