FS#66029 - [mesa] screen tearing issues with firefox

Attached to Project: Arch Linux
Opened by singe infini (singeinfini) - Monday, 30 March 2020, 16:01 GMT
Last edited by Laurent Carlier (lordheavy) - Monday, 04 May 2020, 08:10 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan de Groot (JGC)
Laurent Carlier (lordheavy)
Felix Yan (felixonmars)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 14
Private No

Details

Description:
i encounter screen tearing issues when scrolling a page in Firefox with the last version of mesa.
The bug disappears when reverting to version 19.3.4-2

Additional info:
* firefox 74.0-2
* mesa 20.0.2-1

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (Whiskey Lake) (rev 02)

$ modinfo i915
filename: /lib/modules/5.4.28-1-lts/kernel/drivers/gpu/drm/i915/i915.ko.xz
license: GPL and additional rights
description: Intel Graphics
author: Intel Corporation
author: Tungsten Graphics, Inc.
firmware: i915/bxt_dmc_ver1_07.bin
firmware: i915/skl_dmc_ver1_27.bin
firmware: i915/kbl_dmc_ver1_04.bin
firmware: i915/glk_dmc_ver1_04.bin
firmware: i915/cnl_dmc_ver1_07.bin
firmware: i915/icl_dmc_ver1_07.bin
firmware: i915/tgl_dmc_ver2_04.bin
firmware: i915/skl_huc_ver01_07_1398.bin
firmware: i915/skl_guc_33.0.0.bin
firmware: i915/bxt_huc_ver01_8_2893.bin
firmware: i915/bxt_guc_33.0.0.bin
firmware: i915/kbl_huc_ver02_00_1810.bin
firmware: i915/kbl_guc_33.0.0.bin
firmware: i915/glk_huc_ver03_01_2893.bin
firmware: i915/glk_guc_33.0.0.bin
firmware: i915/kbl_huc_ver02_00_1810.bin
firmware: i915/kbl_guc_33.0.0.bin
firmware: i915/icl_huc_ver8_4_3238.bin
firmware: i915/icl_guc_33.0.0.bin
srcversion: B8247AAF27DB3848029CB3A
(...)

From journalctl:
(...)
Mar 30 17:24:29 mycomputer kernel: [drm] Initialized i915 1.6.0 20190822 for 0000:00:02.0 on minor 0
(no error messages shown)
This task depends upon

Closed by  Laurent Carlier (lordheavy)
Monday, 04 May 2020, 08:10 GMT
Reason for closing:  Fixed
Additional comments about closing:  mesa-20.0.5-1
Comment by Sebastian Vandekerckhove (sebvdk) - Tuesday, 31 March 2020, 08:21 GMT
Same issue when upgraded mesa from 19.3.4-2 to 20.0.2-1.

All of my KDE Plasma environment is impacted by screen tearing.

Downgrade to previous mesa version resolving the issue.
Comment by vixfwis (vixfwis) - Tuesday, 31 March 2020, 15:01 GMT
Most of my environment wasn't impacted - (XFCE/LXDM mix on openbox). Other than firefox it was chromium without hardware acceleration (works fine with HWA on Intel card) and https://aur.archlinux.org/packages/vk-messenger/
It looked like that https://imgur.com/FvdE4P2
Downgrade fixed everything
Comment by singe infini (singeinfini) - Tuesday, 31 March 2020, 21:42 GMT
After a little investigation, the tearing bug seems to be related to the new Iris OpenGL driver. So according to the wiki you can also set the MESA_LOADER_DRIVER_OVERRIDE=i965 environment variable to revert to the old driver.
Comment by Quido Meijer (Aapzak) - Tuesday, 31 March 2020, 23:07 GMT
Can confirm, 20.x give me tearing issues.

Easy to reproduce by hovering over the packages on https://www.archlinux.org/packages/ , watch the yellow bar.
Scrolling through chats in telegram desktop was another very obvious one. Easy to spot.

For workarounds I've tested both suggested solutions:

works: rolling mesa back to 19.3.4-2
works: adding MESA_LOADER_DRIVER_OVERRIDE=i965 to /etc/environment
Comment by jason ryan (jasonwryan) - Wednesday, 01 April 2020, 04:43 GMT
Thanks singeinfini, the env var works perfectly with 20.0.2-1.
Comment by Andreas Radke (AndyRTR) - Wednesday, 01 April 2020, 06:31 GMT
Someone affected please report this upstream.
Comment by Andrei Pavel (andreip) - Wednesday, 01 April 2020, 07:29 GMT
Added `export MESA_LOADER_DRIVER_OVERRIDE=i965` to `~/.profile` and after a restart I still experience screen tearing in all applications. Also tried launching`MESA_LOADER_DRIVER_OVERRIDE=i965 firefox` just to be sure the env variable is received by the process, doesn't work. Where do you set it?
Comment by Bento B. Schirmer (porcelain1) - Wednesday, 01 April 2020, 20:00 GMT
I also experience the bug with integrated graphics Intel UDH Graphics 620 (Intel i5-8250U 8th generation Kaby Lake R).
Indeed disabling hardware acceleration in Firefox removes the garble.

Works using mesa 20.0.2-1 and setting MESA_LOADER_DRIVER_OVERRIDE=i965 in /etc/environment
Doesn't work using mesa 20.0.2-1 and adding export MESA_LOADER_DRIVER_OVERRIDE=i965 in ~/.xinitrc
Works using mesa 19.3.4-2

singeinfini reported it upstream in https://gitlab.freedesktop.org/mesa/mesa/-/issues/2721
Comment by Benjamin Poirier (goben) - Thursday, 02 April 2020, 07:21 GMT
Thanks a lot for the information!

In my case, overriding the driver via MESA_LOADER_DRIVER_OVERRIDE did not fix the problem. Instead, I used the method described here https://gitlab.freedesktop.org/mesa/mesa/issues/1893 and created a file in /usr/share/drirc.d, replacing 'value="iris"' by 'value="i965"'.

The driver in use can be seen in /var/log/Xorg.0.log:
(II) modeset(0): [DRI2] Setup complete
(II) modeset(0): [DRI2] DRI driver: iris
(II) modeset(0): [DRI2] VDPAU driver: va_gl
Comment by Stefan Ecklebe (cklb) - Friday, 03 April 2020, 13:11 GMT
Thank very much for the link. Neither of the environment variable methods worked but putting

<driconf>
<device driver="loader" kernel_driver="i915">
<option name="dri_driver" value="i965" />
</device>
</driconf>

in /usr/share/drirc.d/01-no_iris.conf did the job for me.
However, creating ~/.drirc (as also proposed in the referred issue) did not.
Comment by Xeno Daphron (Daphron) - Saturday, 04 April 2020, 21:57 GMT
Can confirm the tearing issue with Intel HD Graphics 630, particularly noticable with right click menus in chrome and firefox. Downgrading mesa to 19.3.4-2 solves the issue.
Comment by norg (norg) - Tuesday, 07 April 2020, 11:19 GMT
Thanks to Stefan Ecklebe it works for now with the enforced i965 driver on my Thinkpad T480s. The simple environment fix didn't help. I also saw it in some other applications like rocketchat, but for example no issue in thunar or gimp. I guess we need to hope for a fix in the iris driver.
Comment by Eric Bach (bachi55) - Wednesday, 08 April 2020, 07:41 GMT
I experienced the tearing issue as well. System: ThinkPad T470p, Intel HD Graphics 630, Linux LTS 5.4.30, Mesa 20.0.4-1.

For me setting the environment (MESA_LOADER_DRIVER_OVERRIDE=i965) variable in "/etc/environment" fixed the issue.
Comment by Bento B. Schirmer (porcelain1) - Monday, 27 April 2020, 10:51 GMT
I no longer experience the issue. I updated yesterday to mesa 20.0.5-1 and, after commenting MESA_LOADER_DRIVER_OVERRIDE=i965 from /etc/environment and rebooting, no tear appears anymore. Release notes: https://www.mesa3d.org/relnotes/20.0.5.html
Comment by norg (norg) - Monday, 27 April 2020, 16:01 GMT
I can confirm that on the Thinkpad T480s with Intel HD 620 and the iris driver now loaded.

Loading...