Flickering on built-in display (Intel Haswell graphics) since kernel v4.1 [bisected and workaround attached]

Bug #1928138 reported by xalt7x
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linux
Unknown
Unknown
linux (Ubuntu)
New
Undecided
Unassigned

Bug Description

Since kernel 4.1 laptop HP Elitebook Folio 1040 G1 (with Intel i5-4210U) has a pretty serious issue with flickering

Symptoms:
1) If I leave mouse cursor for a few seconds, then start moving it, there's a slight flicker (like display brightness changes a bit). There's also some flickering even without user interactions.
2) On the top left corner sometimes appears artifacts. It's relatively easy to see with black window decorations on top of the screen. This one is showed at the attached video bellow
3) With kernel boot options
drm.debug=0x1e log_buf_len=4M
dmesg shows constant refresh rate changes (even if it's set to 40HZ)

[ 29.977378] [drm:intel_dp_set_drrs_state [i915]] eDP Refresh Rate set to : 40Hz
[ 30.456537] [drm:intel_dp_set_drrs_state [i915]] eDP Refresh Rate set to : 60Hz
[ 33.973392] [drm:intel_dp_set_drrs_state [i915]] eDP Refresh Rate set to : 40Hz
[ 35.055923] [drm:intel_dp_set_drrs_state [i915]] eDP Refresh Rate set to : 60Hz

nomodeset boot option eliminates flickering

Turns out Display Refresh Rate Switching (DRRS) feature doesn't work correctly here. It was implemented on kernels 4.0...4.1 but on a particular machine flickering started with 4.1.

As a workaround I'm attaching a patch which disables DRRS by default and adds module parameter "enable_drrs" to activate it. It's made for kernel 5.12 and should work for older versions as well (tested with 5.11).

Until this issue is resolved, please consider adding parameter to disable DRRS. Windows has such option on Intel® Graphics Command Center.

Revision history for this message
xalt7x (xalt7x) wrote :
description: updated
Revision history for this message
xalt7x (xalt7x) wrote :
xalt7x (xalt7x)
description: updated
tags: added: patch
xalt7x (xalt7x)
tags: removed: patch
summary: Flickering on built-in display (Intel Haswell graphics) since kernel
- v4.1 [bissected and workaround attached]
+ v4.1 [bisected and workaround attached]
tags: added: patch
Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

Is the patch in upstream Linux?

Revision history for this message
xalt7x (xalt7x) wrote :

No, I made it for myself (using another patch (https://bugs.freedesktop.org/show_bug.cgi?id=91393#c31) as a reference for adding i915 module parameter). Not sure if upstream would accept it. This patch doesn't fix root issue but provides ability to disable DRRS power-saving feature which causes it (I didn't find any other way to do that). By the way, Intel® Graphics Command Center on Windows also has an option to enable/disable "Dynamic Refresh Rate Switching" (https://www.intel.com/content/www/us/en/support/articles/000057188/graphics.html).

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

Do you know what's the offending commit?

Revision history for this message
xalt7x (xalt7x) wrote :

Trying to find the reason for this issue I tested kernels from https://kernel.ubuntu.com/~kernel-ppa/mainline/ on Ubuntu 14.04

v4.0.9-wily - flickering didn't happen (but that's because DRRS wasn't activated in the 4.0.y series)
v4.1-rc3-unstable - problem started here.

So it's quite possible that on a particular machine this issue is present since v4.1-rc1

I found that this is DRRS by looking at i915 commits in the 4.1.y tree.
https://github.com/gregkh/linux/commits/linux-4.1.y/drivers/gpu/drm/i915/
intel_pc.c and intel_display.c have some DRRS-related changes

I can try to revert some commits from there.
Some interesting commits:
* drm/i915: Add support for DRRS in intel_dp_set_m_n
(https://github.com/gregkh/linux/commit/fe3cd48d6b616efc76b6a4003e82e933618c788a#diff-83261d1489be7f0a6d1b8306ff0fddbeb13ceb74768ea99274b009dce13ffd2e)
* drm/i915/bdw: Add support for DRRS to switch RR
(https://github.com/gregkh/linux/commit/a4c30b1d108c1ef60667ed357af4aeabc3d05eca#diff-83261d1489be7f0a6d1b8306ff0fddbeb13ceb74768ea99274b009dce13ffd2e)

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

It'll be useful if the offending commit can be found...

Revision history for this message
xalt7x (xalt7x) wrote :

I still believe that this bug is present since initial implementation of DRRS (kernels 4.0 and 4.1).
For now I have to disable DRRS by default with a patch. Updated version in attachment.

Revision history for this message
Alejandro (alepasgar) wrote (last edit ):

Hello there,

I am having a problem that sounds quite similar to yours. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1940285

Could you tell me what exactly I must type on terminal to check how my laptop's refresh rate changes (if any), just to check if it behaves like yours.

Thank you.

Revision history for this message
xalt7x (xalt7x) wrote (last edit ):

@alepasgar

1) Add options to your GRUB
sudo nano /etc/default/grub
At the line with "GRUB_CMDLINE_LINUX_DEFAULT" add "drm.debug=0x1e log_buf_len=4M"
Press Ctrl+x , confirm changes with Y
2) sudo update-grub
3) Restart
4) sudo dmesg | grep "Refresh Rate"

Revision history for this message
Alejandro (alepasgar) wrote :

 I changed that line so that it says:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash drm.debug=0x1e log_buf_len=4M"

and follower the rest of the steps.

when typing:
sudo dmesg | grep "Refresh Rate"
on the terminal, nothing really happens.

I am not sure I am doing that last step well, since I checked the previous ones.

Revision history for this message
xalt7x (xalt7x) wrote :

I guess you have some different issue. In my case HP Folio 1040 G1 had this that problem since kernel 4.1 and it was never fixed. But still you can analyze dmesg for anything suspicious (maybe try it with different kernels)
Here's a command to output information into dmesg.log in your home folder.
sudo dmesg > ~/dmesg.log

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.